From 2fedd366696a5411563a573b6a218c90acb645c7 Mon Sep 17 00:00:00 2001 From: mayur nilwant Date: Tue, 11 Jun 2024 20:54:48 -0400 Subject: [PATCH] Swift code conversion. --- .../MVMCoreCache+Extension.swift | 19 +++++++++++++++---- MVMCore/MVMCore/OtherHandlers/MVMCoreCache.m | 9 --------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/MVMCore/MVMCore/OtherHandlers/MVMCoreCache+Extension.swift b/MVMCore/MVMCore/OtherHandlers/MVMCoreCache+Extension.swift index 13df18d..4827882 100644 --- a/MVMCore/MVMCore/OtherHandlers/MVMCoreCache+Extension.swift +++ b/MVMCore/MVMCore/OtherHandlers/MVMCoreCache+Extension.swift @@ -135,7 +135,7 @@ extension PersistentCacheManager { } @objc public extension MVMCoreCache { - + @objc func shouldSaveAtAppLevel(infoDictionary:[String: AnyHashable]) -> Bool { guard let cachePolicy = infoDictionary[KeyCachePolicy] as? Dictionary, @@ -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") + } + + } + } - - - diff --git a/MVMCore/MVMCore/OtherHandlers/MVMCoreCache.m b/MVMCore/MVMCore/OtherHandlers/MVMCoreCache.m index ae6c4fd..d7113f6 100644 --- a/MVMCore/MVMCore/OtherHandlers/MVMCoreCache.m +++ b/MVMCore/MVMCore/OtherHandlers/MVMCoreCache.m @@ -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"]; }