mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-11-28 19:05:49 +00:00
Support for updated logging settings
This commit is contained in:
parent
44cb1acbdc
commit
fe48f1e979
@ -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>, 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>, 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
|
||||
|
||||
@ -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<InitialPresentationDataAndSettings, NoError> {
|
||||
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<Initi
|
||||
automaticMediaDownloadSettings = AutomaticMediaDownloadSettings.defaultSettings
|
||||
}
|
||||
|
||||
let loggingSettings: LoggingSettings
|
||||
if let value = transaction.getPreferencesEntry(key: PreferencesKeys.loggingSettings) as? LoggingSettings {
|
||||
loggingSettings = value
|
||||
} else {
|
||||
loggingSettings = LoggingSettings.defaultSettings
|
||||
}
|
||||
|
||||
let callListSettings: CallListSettings
|
||||
if let value = transaction.getPreferencesEntry(key: ApplicationSpecificPreferencesKeys.callListSettings) as? CallListSettings {
|
||||
callListSettings = value
|
||||
@ -229,9 +220,9 @@ public func currentPresentationDataAndSettings(postbox: Postbox) -> Signal<Initi
|
||||
|
||||
let experimentalUISettings: ExperimentalUISettings = (transaction.getPreferencesEntry(key: ApplicationSpecificPreferencesKeys.experimentalUISettings) as? ExperimentalUISettings) ?? ExperimentalUISettings.defaultSettings
|
||||
|
||||
return (themeSettings, localizationSettings, automaticMediaDownloadSettings, loggingSettings, callListSettings, inAppNotificationSettings, mediaInputSettings, experimentalUISettings)
|
||||
return (themeSettings, localizationSettings, automaticMediaDownloadSettings, callListSettings, inAppNotificationSettings, mediaInputSettings, experimentalUISettings)
|
||||
}
|
||||
|> 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<Initi
|
||||
let dateTimeFormat = currentDateTimeFormat()
|
||||
let nameDisplayOrder = currentPersonNameDisplayOrder()
|
||||
let nameSortOrder = currentPersonNameSortOrder()
|
||||
return InitialPresentationDataAndSettings(presentationData: PresentationData(strings: stringsValue, theme: themeValue, chatWallpaper: effectiveChatWallpaper, fontSize: themeSettings.fontSize, dateTimeFormat: dateTimeFormat, nameDisplayOrder: nameDisplayOrder, nameSortOrder: nameSortOrder, disableAnimations: themeSettings.disableAnimations), automaticMediaDownloadSettings: automaticMediaDownloadSettings, loggingSettings: loggingSettings, callListSettings: callListSettings, inAppNotificationSettings: inAppNotificationSettings, mediaInputSettings: mediaInputSettings, experimentalUISettings: experimentalUISettings)
|
||||
return InitialPresentationDataAndSettings(presentationData: PresentationData(strings: stringsValue, theme: themeValue, chatWallpaper: effectiveChatWallpaper, fontSize: themeSettings.fontSize, dateTimeFormat: dateTimeFormat, nameDisplayOrder: nameDisplayOrder, nameSortOrder: nameSortOrder, disableAnimations: themeSettings.disableAnimations), automaticMediaDownloadSettings: automaticMediaDownloadSettings, callListSettings: callListSettings, inAppNotificationSettings: inAppNotificationSettings, mediaInputSettings: mediaInputSettings, experimentalUISettings: experimentalUISettings)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user