Hardcoded response testing.
This commit is contained in:
parent
eafd275527
commit
985d01842d
@ -167,6 +167,12 @@
|
||||
// Send a new request to the server.
|
||||
[MVMCoreLoadRequestOperation sendRequest:requestForMissingData loadObject:loadObject completionHandler:^(NSDictionary * _Nullable json) {
|
||||
|
||||
#if ENABLE_HARD_CODED_RESPONSE
|
||||
if ([[MVMCoreObject sharedInstance].globalLoadDelegate respondsToSelector:@selector(modifyJSON:)]) {
|
||||
json = [[MVMCoreObject sharedInstance].globalLoadDelegate modifyJSON:json];
|
||||
}
|
||||
#endif
|
||||
|
||||
NSString *serverProcessTime = [(NSDictionary *)json objectChainOfKeysOrIndexes:@[@"ResponseInfo", @"timeStamp"]] ?: @"0";
|
||||
|
||||
if(!self.backgroundLoad && loadObject.requestParameters.pageType && serverProcessTime) {
|
||||
@ -291,6 +297,14 @@
|
||||
return;
|
||||
}
|
||||
|
||||
#if ENABLE_HARD_CODED_RESPONSE
|
||||
if ([[MVMCoreObject sharedInstance].globalLoadDelegate respondsToSelector:@selector(getJSONForPageType:)]) {
|
||||
NSDictionary *json = [[MVMCoreObject sharedInstance].globalLoadDelegate getJSONForPageType:requestParameters.pageType];
|
||||
completionHandler(json);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
loadObject.operation.sessionTask = [[MVMCoreLoadHandler sharedGlobal] sendRequest:requestParameters locationForError:[[MVMCoreLoadHandler sharedGlobal] errorLocationForRequest:loadObject] requestFinished:^(id jsonObject, MVMCoreErrorObject *error) {
|
||||
|
||||
if ([loadObject.operation checkAndHandleForCancellation]) {
|
||||
|
||||
@ -41,4 +41,9 @@
|
||||
/// Checks to see if the operation has content to show.
|
||||
- (BOOL)hasContentToShow:(nonnull MVMCoreLoadObject *)loadObject error:(nullable MVMCoreErrorObject *)error;
|
||||
|
||||
#if ENABLE_HARD_CODED_RESPONSE
|
||||
- (nonnull NSDictionary *)getJSONForPageType:(nonnull NSString *)pageType;
|
||||
- (nonnull NSDictionary *)modifyJSON:(nonnull NSDictionary *)json;
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
||||
Loading…
Reference in New Issue
Block a user