mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
Chat-specific theme improvements
This commit is contained in:
@@ -3783,19 +3783,27 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
themeEmoticon = nil
|
||||
}
|
||||
}
|
||||
|
||||
var isDarkAppearance = presentationData.theme.overallDarkAppearance
|
||||
if let darkAppearancePreview = darkAppearancePreview {
|
||||
isDarkAppearance = darkAppearancePreview
|
||||
}
|
||||
|
||||
|
||||
var presentationData = presentationData
|
||||
if let themeEmoticon = themeEmoticon, let theme = chatThemes.first(where: { $0.emoji == themeEmoticon }) {
|
||||
var isDarkAppearance = presentationData.theme.overallDarkAppearance
|
||||
if let darkAppearancePreview = darkAppearancePreview {
|
||||
isDarkAppearance = darkAppearancePreview
|
||||
}
|
||||
let customTheme = isDarkAppearance ? theme.darkTheme : theme.theme
|
||||
if let settings = customTheme.settings, let theme = makePresentationTheme(settings: settings) {
|
||||
presentationData = presentationData.withUpdated(theme: theme)
|
||||
presentationData = presentationData.withUpdated(chatWallpaper: theme.chat.defaultWallpaper)
|
||||
}
|
||||
} else if let darkAppearancePreview = darkAppearancePreview {
|
||||
let lightTheme: PresentationTheme
|
||||
let darkTheme: PresentationTheme
|
||||
|
||||
if presentationData.theme.overallDarkAppearance {
|
||||
darkTheme = presentationData.theme
|
||||
} else {
|
||||
lightTheme = presentationData.theme
|
||||
}
|
||||
}
|
||||
strongSelf.presentationData = presentationData
|
||||
|
||||
@@ -12942,6 +12950,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
strongSelf.themeDarkAppearancePreviewPromise.set(dark)
|
||||
}
|
||||
}, completion: { [weak self] emoticon in
|
||||
strongSelf.presentCrossfadeSnapshot()
|
||||
strongSelf.themeDarkAppearancePreviewPromise.set(nil)
|
||||
let _ = context.engine.themes.setChatTheme(peerId: peerId, emoji: emoticon).start(completed: { [weak self] in
|
||||
if let strongSelf = self {
|
||||
|
||||
Reference in New Issue
Block a user