mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
Fix initial presentation data for preset themes
This commit is contained in:
parent
bf4da379b9
commit
5befa9e1c8
@ -285,18 +285,29 @@ public func currentPresentationDataAndSettings(accountManager: AccountManager<Te
|
|||||||
let contactSettings: ContactSynchronizationSettings = transaction.getSharedData(ApplicationSpecificSharedDataKeys.contactSynchronizationSettings)?.get(ContactSynchronizationSettings.self) ?? ContactSynchronizationSettings.defaultSettings
|
let contactSettings: ContactSynchronizationSettings = transaction.getSharedData(ApplicationSpecificSharedDataKeys.contactSynchronizationSettings)?.get(ContactSynchronizationSettings.self) ?? ContactSynchronizationSettings.defaultSettings
|
||||||
|
|
||||||
let effectiveTheme: PresentationThemeReference
|
let effectiveTheme: PresentationThemeReference
|
||||||
|
var preferredBaseTheme: TelegramBaseTheme?
|
||||||
let parameters = AutomaticThemeSwitchParameters(settings: themeSettings.automaticThemeSwitchSetting)
|
let parameters = AutomaticThemeSwitchParameters(settings: themeSettings.automaticThemeSwitchSetting)
|
||||||
let autoNightModeTriggered: Bool
|
let autoNightModeTriggered: Bool
|
||||||
if automaticThemeShouldSwitchNow(parameters, systemUserInterfaceStyle: systemUserInterfaceStyle) {
|
if automaticThemeShouldSwitchNow(parameters, systemUserInterfaceStyle: systemUserInterfaceStyle) {
|
||||||
effectiveTheme = themeSettings.automaticThemeSwitchSetting.theme
|
effectiveTheme = themeSettings.automaticThemeSwitchSetting.theme
|
||||||
autoNightModeTriggered = true
|
autoNightModeTriggered = true
|
||||||
|
|
||||||
|
if let baseTheme = themeSettings.themePreferredBaseTheme[effectiveTheme.index], [.night, .tinted].contains(baseTheme) {
|
||||||
|
preferredBaseTheme = baseTheme
|
||||||
|
} else {
|
||||||
|
preferredBaseTheme = .night
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
effectiveTheme = themeSettings.theme
|
effectiveTheme = themeSettings.theme
|
||||||
autoNightModeTriggered = false
|
autoNightModeTriggered = false
|
||||||
|
|
||||||
|
if let baseTheme = themeSettings.themePreferredBaseTheme[effectiveTheme.index], [.classic, .day].contains(baseTheme) {
|
||||||
|
preferredBaseTheme = baseTheme
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let effectiveColors = themeSettings.themeSpecificAccentColors[effectiveTheme.index]
|
let effectiveColors = themeSettings.themeSpecificAccentColors[effectiveTheme.index]
|
||||||
let theme = makePresentationTheme(mediaBox: accountManager.mediaBox, themeReference: effectiveTheme, accentColor: effectiveColors?.color, bubbleColors: effectiveColors?.customBubbleColors ?? [], baseColor: effectiveColors?.baseColor) ?? defaultPresentationTheme
|
let theme = makePresentationTheme(mediaBox: accountManager.mediaBox, themeReference: effectiveTheme, baseTheme: preferredBaseTheme, accentColor: effectiveColors?.color, bubbleColors: effectiveColors?.customBubbleColors ?? [], baseColor: effectiveColors?.baseColor) ?? defaultPresentationTheme
|
||||||
|
|
||||||
|
|
||||||
let effectiveChatWallpaper: TelegramWallpaper = (themeSettings.themeSpecificChatWallpapers[coloredThemeIndex(reference: effectiveTheme, accentColor: effectiveColors)] ?? themeSettings.themeSpecificChatWallpapers[effectiveTheme.index]) ?? theme.chat.defaultWallpaper
|
let effectiveChatWallpaper: TelegramWallpaper = (themeSettings.themeSpecificChatWallpapers[coloredThemeIndex(reference: effectiveTheme, accentColor: effectiveColors)] ?? themeSettings.themeSpecificChatWallpapers[effectiveTheme.index]) ?? theme.chat.defaultWallpaper
|
||||||
|
Loading…
x
Reference in New Issue
Block a user