Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios

This commit is contained in:
Ilya Laktyushin
2023-12-19 20:56:31 +04:00
46 changed files with 650 additions and 381 deletions

View File

@@ -6368,6 +6368,11 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
var presentationData = presentationData
var useDarkAppearance = presentationData.theme.overallDarkAppearance
if let wallpaper = chatWallpaper, case let .emoticon(wallpaperEmoticon) = wallpaper, let theme = chatThemes.first(where: { $0.emoticon?.strippedEmoji == wallpaperEmoticon.strippedEmoji }) {
if let themeWallpaper = theme.settings?.first?.wallpaper {
chatWallpaper = themeWallpaper
}
}
if let themeEmoticon = themeEmoticon, let theme = chatThemes.first(where: { $0.emoticon?.strippedEmoji == themeEmoticon.strippedEmoji }) {
if let darkAppearancePreview = darkAppearancePreview {
useDarkAppearance = darkAppearancePreview
@@ -7400,17 +7405,8 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
if let peerId = self.chatLocation.peerId {
self.chatThemeEmoticonPromise.set(self.context.engine.data.get(TelegramEngine.EngineData.Item.Peer.ThemeEmoticon(id: peerId)))
let chatWallpaper = self.context.account.viewTracker.peerView(peerId)
let chatWallpaper = self.context.engine.data.get(TelegramEngine.EngineData.Item.Peer.Wallpaper(id: peerId))
|> take(1)
|> map { view -> TelegramWallpaper? in
if let cachedData = view.cachedData as? CachedUserData {
return cachedData.wallpaper
} else if let cachedData = view.cachedData as? CachedChannelData {
return cachedData.wallpaper
} else {
return nil
}
}
self.chatWallpaperPromise.set(chatWallpaper)
} else {
self.chatThemeEmoticonPromise.set(.single(nil))