Merge branch 'feature/hardcoded_json' into 'develop'
Feature/hardcoded json See merge request BPHV_MIPS/mvm_core!14
This commit is contained in:
commit
5bb580b6de
@ -19,6 +19,8 @@
|
||||
|
||||
- (NSDictionary *) getHardCodedResponseForRequest:(MVMCoreRequestParameters *)request;
|
||||
|
||||
- (NSDictionary *) getHardCodedResponseForPageType:(NSString *)pageType;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user