mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-11-29 11:25:38 +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):
|
case let .logToFile(theme, value):
|
||||||
return ItemListSwitchItem(theme: theme, title: "Log to File", value: value, sectionId: self.section, style: .blocks, updated: { value in
|
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)
|
$0.withUpdatedLogToFile(value)
|
||||||
}).start()
|
}).start()
|
||||||
})
|
})
|
||||||
case let .logToConsole(theme, value):
|
case let .logToConsole(theme, value):
|
||||||
return ItemListSwitchItem(theme: theme, title: "Log to Console", value: value, sectionId: self.section, style: .blocks, updated: { value in
|
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)
|
$0.withUpdatedLogToConsole(value)
|
||||||
}).start()
|
}).start()
|
||||||
})
|
})
|
||||||
case let .redactSensitiveData(theme, value):
|
case let .redactSensitiveData(theme, value):
|
||||||
return ItemListSwitchItem(theme: theme, title: "Remove Sensitive Data", value: value, sectionId: self.section, style: .blocks, updated: { value in
|
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)
|
$0.withUpdatedRedactSensitiveData(value)
|
||||||
}).start()
|
}).start()
|
||||||
})
|
})
|
||||||
@ -250,10 +250,10 @@ public func debugController(account: Account, accountManager: AccountManager) ->
|
|||||||
hasLegacyAppData = FileManager.default.fileExists(atPath: statusPath)
|
hasLegacyAppData = FileManager.default.fileExists(atPath: statusPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
let signal = combineLatest((account.applicationContext as! TelegramApplicationContext).presentationData, account.postbox.preferencesView(keys: [PreferencesKeys.loggingSettings, ApplicationSpecificPreferencesKeys.mediaInputSettings, ApplicationSpecificPreferencesKeys.experimentalUISettings]))
|
let signal = combineLatest((account.applicationContext as! TelegramApplicationContext).presentationData, accountManager.sharedData(keys: Set([SharedDataKeys.loggingSettings])), account.postbox.preferencesView(keys: [ApplicationSpecificPreferencesKeys.mediaInputSettings, ApplicationSpecificPreferencesKeys.experimentalUISettings]))
|
||||||
|> map { presentationData, preferencesView -> (ItemListControllerState, (ItemListNodeState<DebugControllerEntry>, DebugControllerEntry.ItemGenerationArguments)) in
|
|> map { presentationData, sharedData, preferencesView -> (ItemListControllerState, (ItemListNodeState<DebugControllerEntry>, DebugControllerEntry.ItemGenerationArguments)) in
|
||||||
let loggingSettings: LoggingSettings
|
let loggingSettings: LoggingSettings
|
||||||
if let value = preferencesView.values[PreferencesKeys.loggingSettings] as? LoggingSettings {
|
if let value = sharedData.entries [SharedDataKeys.loggingSettings] as? LoggingSettings {
|
||||||
loggingSettings = value
|
loggingSettings = value
|
||||||
} else {
|
} else {
|
||||||
loggingSettings = LoggingSettings.defaultSettings
|
loggingSettings = LoggingSettings.defaultSettings
|
||||||
|
|||||||
@ -159,16 +159,14 @@ private func currentPersonNameDisplayOrder() -> PresentationPersonNameOrder {
|
|||||||
public final class InitialPresentationDataAndSettings {
|
public final class InitialPresentationDataAndSettings {
|
||||||
public let presentationData: PresentationData
|
public let presentationData: PresentationData
|
||||||
public let automaticMediaDownloadSettings: AutomaticMediaDownloadSettings
|
public let automaticMediaDownloadSettings: AutomaticMediaDownloadSettings
|
||||||
public let loggingSettings: LoggingSettings
|
|
||||||
public let callListSettings: CallListSettings
|
public let callListSettings: CallListSettings
|
||||||
public let inAppNotificationSettings: InAppNotificationSettings
|
public let inAppNotificationSettings: InAppNotificationSettings
|
||||||
public let mediaInputSettings: MediaInputSettings
|
public let mediaInputSettings: MediaInputSettings
|
||||||
public let experimentalUISettings: ExperimentalUISettings
|
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.presentationData = presentationData
|
||||||
self.automaticMediaDownloadSettings = automaticMediaDownloadSettings
|
self.automaticMediaDownloadSettings = automaticMediaDownloadSettings
|
||||||
self.loggingSettings = loggingSettings
|
|
||||||
self.callListSettings = callListSettings
|
self.callListSettings = callListSettings
|
||||||
self.inAppNotificationSettings = inAppNotificationSettings
|
self.inAppNotificationSettings = inAppNotificationSettings
|
||||||
self.mediaInputSettings = mediaInputSettings
|
self.mediaInputSettings = mediaInputSettings
|
||||||
@ -177,7 +175,7 @@ public final class InitialPresentationDataAndSettings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func currentPresentationDataAndSettings(postbox: Postbox) -> Signal<InitialPresentationDataAndSettings, NoError> {
|
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
|
let themeSettings: PresentationThemeSettings
|
||||||
if let current = transaction.getPreferencesEntry(key: ApplicationSpecificPreferencesKeys.presentationThemeSettings) as? PresentationThemeSettings {
|
if let current = transaction.getPreferencesEntry(key: ApplicationSpecificPreferencesKeys.presentationThemeSettings) as? PresentationThemeSettings {
|
||||||
themeSettings = current
|
themeSettings = current
|
||||||
@ -199,13 +197,6 @@ public func currentPresentationDataAndSettings(postbox: Postbox) -> Signal<Initi
|
|||||||
automaticMediaDownloadSettings = AutomaticMediaDownloadSettings.defaultSettings
|
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
|
let callListSettings: CallListSettings
|
||||||
if let value = transaction.getPreferencesEntry(key: ApplicationSpecificPreferencesKeys.callListSettings) as? CallListSettings {
|
if let value = transaction.getPreferencesEntry(key: ApplicationSpecificPreferencesKeys.callListSettings) as? CallListSettings {
|
||||||
callListSettings = value
|
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
|
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 themeValue: PresentationTheme
|
||||||
|
|
||||||
let effectiveTheme: PresentationThemeReference
|
let effectiveTheme: PresentationThemeReference
|
||||||
@ -278,7 +269,7 @@ public func currentPresentationDataAndSettings(postbox: Postbox) -> Signal<Initi
|
|||||||
let dateTimeFormat = currentDateTimeFormat()
|
let dateTimeFormat = currentDateTimeFormat()
|
||||||
let nameDisplayOrder = currentPersonNameDisplayOrder()
|
let nameDisplayOrder = currentPersonNameDisplayOrder()
|
||||||
let nameSortOrder = currentPersonNameSortOrder()
|
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