removed pages and modules from cache based on server input.

This commit is contained in:
Murugan, Vimal 2019-07-09 17:06:29 +05:30
parent b2484bd852
commit f30bdf20c5

View File

@ -359,6 +359,8 @@
if (!loadObject.pageDataFromCache) {
loadObject.pageJSON = pageJSON;
loadObject.pageType = [pageJSON string:KeyPageType];
//Remove the pages and modules from cache
[self removeCaches:[jsonDictionary dict:@"RemoveCaches"]];
}
// Sets the response info map
@ -830,6 +832,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 {