Merge branch 'feature/remove_cached_pagesandmodules' into 'develop'

removed pages and modules from cache based on server input.

See merge request BPHV_MIPS/mvm_core!20
This commit is contained in:
Pfeil, Scott Robert 2019-07-15 10:45:21 -04:00
commit 9cf84619e6

View File

@ -361,6 +361,9 @@
loadObject.pageType = [pageJSON string:KeyPageType];
}
//Remove the pages and modules from cache
[self removeCaches:[jsonDictionary dict:@"RemoveCaches"]];
// Sets the response info map
loadObject.responseInfoMap = [jsonDictionary dict:KeyResponseInfo];
@ -830,6 +833,20 @@
}
}
+ (void)removeCaches:(nullable NSDictionary *)cacheDictionary {
if (cacheDictionary) {
NSArray *pagesToClear = [cacheDictionary array:@"pagesToClear"];
NSArray *modulesToClear = [cacheDictionary array:@"modulesToClear"];
if (modulesToClear) {
[[MVMCoreCache sharedCache] removeJSONForModules:modulesToClear];
}
[pagesToClear enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
[[MVMCoreCache sharedCache] removeJSONForPageType:obj];
}];
}
}
#pragma mark - Presentation Delegate
- (void)navigationController:(UINavigationController *)navigationController willDisplayViewController:(UIViewController *)viewController {