Merge branch 'feature/hardcoded_helpers' into 'develop'

Hardcoded response testing.

### Summary
Make it easy to modify json for local testing.

Co-authored-by: Scott Pfeil <Scott.Pfeil3@verizonwireless.com>

See merge request https://gitlab.verizon.com/BPHV_MIPS/mvm_core/-/merge_requests/274
This commit is contained in:
Hedden, Kyle Matthew 2023-07-31 21:52:46 +00:00
commit 1aed90a1fe
2 changed files with 19 additions and 0 deletions

View File

@ -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]) {

View File

@ -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