diff --git a/TelegramUI/DebugController.swift b/TelegramUI/DebugController.swift index 34c8b1a9bb..6b02453031 100644 --- a/TelegramUI/DebugController.swift +++ b/TelegramUI/DebugController.swift @@ -147,19 +147,19 @@ private enum DebugControllerEntry: ItemListNodeEntry { }) case let .logToFile(theme, value): return ItemListSwitchItem(theme: theme, title: "Log to File", value: value, sectionId: self.section, style: .blocks, updated: { value in - let _ = updateLoggingSettings(postbox: arguments.account.postbox, { + let _ = updateLoggingSettings(accountManager: arguments.accountManager, { $0.withUpdatedLogToFile(value) }).start() }) case let .logToConsole(theme, value): return ItemListSwitchItem(theme: theme, title: "Log to Console", value: value, sectionId: self.section, style: .blocks, updated: { value in - let _ = updateLoggingSettings(postbox: arguments.account.postbox, { + let _ = updateLoggingSettings(accountManager: arguments.accountManager, { $0.withUpdatedLogToConsole(value) }).start() }) case let .redactSensitiveData(theme, value): return ItemListSwitchItem(theme: theme, title: "Remove Sensitive Data", value: value, sectionId: self.section, style: .blocks, updated: { value in - let _ = updateLoggingSettings(postbox: arguments.account.postbox, { + let _ = updateLoggingSettings(accountManager: arguments.accountManager, { $0.withUpdatedRedactSensitiveData(value) }).start() }) @@ -250,10 +250,10 @@ public func debugController(account: Account, accountManager: AccountManager) -> hasLegacyAppData = FileManager.default.fileExists(atPath: statusPath) } - let signal = combineLatest((account.applicationContext as! TelegramApplicationContext).presentationData, account.postbox.preferencesView(keys: [PreferencesKeys.loggingSettings, ApplicationSpecificPreferencesKeys.mediaInputSettings, ApplicationSpecificPreferencesKeys.experimentalUISettings])) - |> map { presentationData, preferencesView -> (ItemListControllerState, (ItemListNodeState, DebugControllerEntry.ItemGenerationArguments)) in + let signal = combineLatest((account.applicationContext as! TelegramApplicationContext).presentationData, accountManager.sharedData(keys: Set([SharedDataKeys.loggingSettings])), account.postbox.preferencesView(keys: [ApplicationSpecificPreferencesKeys.mediaInputSettings, ApplicationSpecificPreferencesKeys.experimentalUISettings])) + |> map { presentationData, sharedData, preferencesView -> (ItemListControllerState, (ItemListNodeState, DebugControllerEntry.ItemGenerationArguments)) in let loggingSettings: LoggingSettings - if let value = preferencesView.values[PreferencesKeys.loggingSettings] as? LoggingSettings { + if let value = sharedData.entries [SharedDataKeys.loggingSettings] as? LoggingSettings { loggingSettings = value } else { loggingSettings = LoggingSettings.defaultSettings diff --git a/TelegramUI/PresentationData.swift b/TelegramUI/PresentationData.swift index 02fc5746d1..9d1c5b46c9 100644 --- a/TelegramUI/PresentationData.swift +++ b/TelegramUI/PresentationData.swift @@ -159,16 +159,14 @@ private func currentPersonNameDisplayOrder() -> PresentationPersonNameOrder { public final class InitialPresentationDataAndSettings { public let presentationData: PresentationData public let automaticMediaDownloadSettings: AutomaticMediaDownloadSettings - public let loggingSettings: LoggingSettings public let callListSettings: CallListSettings public let inAppNotificationSettings: InAppNotificationSettings public let mediaInputSettings: MediaInputSettings public let experimentalUISettings: ExperimentalUISettings - init(presentationData: PresentationData, automaticMediaDownloadSettings: AutomaticMediaDownloadSettings, loggingSettings: LoggingSettings, callListSettings: CallListSettings, inAppNotificationSettings: InAppNotificationSettings, mediaInputSettings: MediaInputSettings, experimentalUISettings: ExperimentalUISettings) { + init(presentationData: PresentationData, automaticMediaDownloadSettings: AutomaticMediaDownloadSettings, callListSettings: CallListSettings, inAppNotificationSettings: InAppNotificationSettings, mediaInputSettings: MediaInputSettings, experimentalUISettings: ExperimentalUISettings) { self.presentationData = presentationData self.automaticMediaDownloadSettings = automaticMediaDownloadSettings - self.loggingSettings = loggingSettings self.callListSettings = callListSettings self.inAppNotificationSettings = inAppNotificationSettings self.mediaInputSettings = mediaInputSettings @@ -177,7 +175,7 @@ public final class InitialPresentationDataAndSettings { } public func currentPresentationDataAndSettings(postbox: Postbox) -> Signal { - return postbox.transaction { transaction -> (PresentationThemeSettings, LocalizationSettings?, AutomaticMediaDownloadSettings, LoggingSettings, CallListSettings, InAppNotificationSettings, MediaInputSettings, ExperimentalUISettings) in + return postbox.transaction { transaction -> (PresentationThemeSettings, LocalizationSettings?, AutomaticMediaDownloadSettings, CallListSettings, InAppNotificationSettings, MediaInputSettings, ExperimentalUISettings) in let themeSettings: PresentationThemeSettings if let current = transaction.getPreferencesEntry(key: ApplicationSpecificPreferencesKeys.presentationThemeSettings) as? PresentationThemeSettings { themeSettings = current @@ -199,13 +197,6 @@ public func currentPresentationDataAndSettings(postbox: Postbox) -> Signal Signal map { (themeSettings, localizationSettings, automaticMediaDownloadSettings, loggingSettings, callListSettings, inAppNotificationSettings, mediaInputSettings, experimentalUISettings) -> InitialPresentationDataAndSettings in + |> map { (themeSettings, localizationSettings, automaticMediaDownloadSettings, callListSettings, inAppNotificationSettings, mediaInputSettings, experimentalUISettings) -> InitialPresentationDataAndSettings in let themeValue: PresentationTheme let effectiveTheme: PresentationThemeReference @@ -278,7 +269,7 @@ public func currentPresentationDataAndSettings(postbox: Postbox) -> Signal