Swift code conversion.

This commit is contained in:
mayur nilwant 2024-06-11 20:54:48 -04:00
parent b64602939d
commit 2fedd36669
2 changed files with 15 additions and 13 deletions

View File

@ -135,7 +135,7 @@ extension PersistentCacheManager {
}
@objc public extension MVMCoreCache {
@objc func shouldSaveAtAppLevel(infoDictionary:[String: AnyHashable]) -> Bool {
guard let cachePolicy = infoDictionary[KeyCachePolicy] as? Dictionary<String, Any>,
@ -145,8 +145,19 @@ extension PersistentCacheManager {
self.isJSONExpired(infoDictionary) == false else {return false}
return true
}
@objc func getPathForPersistentCachePage(pageType: String, isAppLevel appLevel: Bool) -> URL?{
if appLevel {
return PersistentCacheManager.shared.appLevelCacheDirectory.appendingPathComponent("Pages").appendingPathComponent(pageType).appendingPathExtension("json")
}else {
return PersistentCacheManager.shared.cacheDirectory.appendingPathComponent("Pages").appendingPathComponent(pageType).appendingPathExtension("json")
}
}
}

View File

@ -141,15 +141,6 @@ static NSString * const STATIC_CACHE_COMPONENT = @"StaticCache.txt";
return [self shouldPersistentlyCacheJSON:jsonDictionary];
}
- (nullable NSURL *)getPathForPersistentCachePage:(nonnull NSString *)pageType isAppLevel:(BOOL)isAppLevel{
if (isAppLevel) {
return [[[[PersistentCacheManager shared].appLevelCacheDirectory URLByAppendingPathComponent:@"Pages"] URLByAppendingPathComponent:pageType] URLByAppendingPathExtension:@"json"];
} else {
return [[[[PersistentCacheManager shared].cacheDirectory URLByAppendingPathComponent:@"Pages"] URLByAppendingPathComponent:pageType] URLByAppendingPathExtension:@"json"];
}
}
- (nullable NSURL *)getPathForPersistentCacheModule:(nonnull NSString *)moduleName {
return [[[[PersistentCacheManager shared].cacheDirectory URLByAppendingPathComponent:@"Modules"] URLByAppendingPathComponent:moduleName]URLByAppendingPathExtension:@"json"];
}