From 74b08e1056681f77efb2d7c1121e19d760729b35 Mon Sep 17 00:00:00 2001 From: Ali <> Date: Wed, 31 Mar 2021 02:50:58 +0400 Subject: [PATCH] Temporarily disable account cleanup --- submodules/Postbox/Sources/Postbox.swift | 11 ---------- submodules/TelegramCore/Sources/Account.swift | 20 ++++++++++--------- .../TelegramCore/Sources/AccountManager.swift | 3 ++- 3 files changed, 13 insertions(+), 21 deletions(-) diff --git a/submodules/Postbox/Sources/Postbox.swift b/submodules/Postbox/Sources/Postbox.swift index 5b0f799b5f..b7ff4a1e0c 100644 --- a/submodules/Postbox/Sources/Postbox.swift +++ b/submodules/Postbox/Sources/Postbox.swift @@ -1412,17 +1412,6 @@ public final class Postbox { self.mediaBox = MediaBox(basePath: self.basePath + "/media") self.valueBox = valueBox - /*self.pipeNotifier = PipeNotifier(basePath: basePath, notify: { [weak self] in - //if let strongSelf = self { - /*strongSelf.queue.async { - if strongSelf.valueBox != nil { - let _ = strongSelf.transaction({ _ -> Void in - }).start() - } - }*/ - //} - })*/ - self.metadataTable = MetadataTable(valueBox: self.valueBox, table: MetadataTable.tableSpec(0)) self.keychainTable = KeychainTable(valueBox: self.valueBox, table: KeychainTable.tableSpec(1)) diff --git a/submodules/TelegramCore/Sources/Account.swift b/submodules/TelegramCore/Sources/Account.swift index 73786ebc8e..eb509bba7f 100644 --- a/submodules/TelegramCore/Sources/Account.swift +++ b/submodules/TelegramCore/Sources/Account.swift @@ -1123,15 +1123,17 @@ public class Account { self.managedOperationsDisposable.add(managedAnimatedEmojiUpdates(postbox: self.postbox, network: self.network).start()) } self.managedOperationsDisposable.add(managedGreetingStickers(postbox: self.postbox, network: self.network).start()) - - let mediaBox = postbox.mediaBox - self.storageSettingsDisposable = accountManager.sharedData(keys: [SharedDataKeys.cacheStorageSettings]).start(next: { [weak mediaBox] sharedData in - guard let mediaBox = mediaBox else { - return - } - let settings: CacheStorageSettings = sharedData.entries[SharedDataKeys.cacheStorageSettings] as? CacheStorageSettings ?? CacheStorageSettings.defaultSettings - mediaBox.setMaxStoreTimes(general: settings.defaultCacheStorageTimeout, shortLived: 60 * 60, gigabytesLimit: settings.defaultCacheStorageLimitGigabytes) - }) + + if !supplementary { + let mediaBox = postbox.mediaBox + self.storageSettingsDisposable = accountManager.sharedData(keys: [SharedDataKeys.cacheStorageSettings]).start(next: { [weak mediaBox] sharedData in + guard let mediaBox = mediaBox else { + return + } + let settings: CacheStorageSettings = sharedData.entries[SharedDataKeys.cacheStorageSettings] as? CacheStorageSettings ?? CacheStorageSettings.defaultSettings + mediaBox.setMaxStoreTimes(general: settings.defaultCacheStorageTimeout, shortLived: 60 * 60, gigabytesLimit: settings.defaultCacheStorageLimitGigabytes) + }) + } let _ = masterNotificationsKey(masterNotificationKeyValue: self.masterNotificationKey, postbox: self.postbox, ignoreDisabled: false).start(next: { key in let encoder = JSONEncoder() diff --git a/submodules/TelegramCore/Sources/AccountManager.swift b/submodules/TelegramCore/Sources/AccountManager.swift index 69ed985493..a75d49c018 100644 --- a/submodules/TelegramCore/Sources/AccountManager.swift +++ b/submodules/TelegramCore/Sources/AccountManager.swift @@ -373,7 +373,8 @@ public func managedCleanupAccounts(networkArguments: NetworkInitializationArgume } for (id, attributes, disposable) in beginList { Logger.shared.log("managedCleanupAccounts", "cleanup \(id), current is \(String(describing: view.currentRecord?.id))") - disposable.set(cleanupAccount(networkArguments: networkArguments, accountManager: accountManager, id: id, encryptionParameters: encryptionParameters, attributes: attributes, rootPath: rootPath, auxiliaryMethods: auxiliaryMethods).start()) + //TODO:localize + //disposable.set(cleanupAccount(networkArguments: networkArguments, accountManager: accountManager, id: id, encryptionParameters: encryptionParameters, attributes: attributes, rootPath: rootPath, auxiliaryMethods: auxiliaryMethods).start()) } var validPaths = Set()