diff --git a/MVMCore/MVMCore/Utility/HardCodedServerResponse/MFHardCodedServerResponse.h b/MVMCore/MVMCore/Utility/HardCodedServerResponse/MFHardCodedServerResponse.h index a1c3eb9..eb9fba9 100644 --- a/MVMCore/MVMCore/Utility/HardCodedServerResponse/MFHardCodedServerResponse.h +++ b/MVMCore/MVMCore/Utility/HardCodedServerResponse/MFHardCodedServerResponse.h @@ -19,6 +19,8 @@ - (NSDictionary *) getHardCodedResponseForRequest:(MVMCoreRequestParameters *)request; +- (NSDictionary *) getHardCodedResponseForPageType:(NSString *)pageType; + @end #endif diff --git a/MVMCore/MVMCore/Utility/HardCodedServerResponse/MFHardCodedServerResponse.m b/MVMCore/MVMCore/Utility/HardCodedServerResponse/MFHardCodedServerResponse.m index 4ed21be..e32ec74 100644 --- a/MVMCore/MVMCore/Utility/HardCodedServerResponse/MFHardCodedServerResponse.m +++ b/MVMCore/MVMCore/Utility/HardCodedServerResponse/MFHardCodedServerResponse.m @@ -56,6 +56,16 @@ return self; } +- (NSDictionary *) getHardCodedResponseForPageType:(NSString *)pageType { + + NSError *error; + NSString *filePath = [[NSBundle mainBundle] pathForResource:pageType ofType:@"json"]; + if (filePath) { + return [NSJSONSerialization JSONObjectWithData:[NSData dataWithContentsOfFile:filePath] options:NSJSONReadingMutableContainers error:&error]; + } + return nil; +} + - (NSDictionary *) getHardCodedResponseForRequest:(MVMCoreRequestParameters *)request { NSDictionary *cannedResponse = nil; @@ -87,6 +97,11 @@ } } + if (!cannedResponse) { + cannedResponse = [self getHardCodedResponseForPageType:request.pageType]; + } + + return cannedResponse; }