mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 06:35:51 +00:00
Various Fixes
This commit is contained in:
@@ -870,9 +870,10 @@ private class ChatQrCodeScreenNode: ViewControllerTracingNode, UIScrollViewDeleg
|
||||
}
|
||||
|
||||
let initiallySelectedEmoticon: Signal<String, NoError>
|
||||
let sharedData = self.context.sharedContext.accountManager.sharedData(keys: [ApplicationSpecificSharedDataKeys.presentationThemeSettings])
|
||||
|> take(1)
|
||||
if self.peer.id == self.context.account.peerId {
|
||||
initiallySelectedEmoticon = self.context.sharedContext.accountManager.sharedData(keys: [ApplicationSpecificSharedDataKeys.presentationThemeSettings])
|
||||
|> take(1)
|
||||
initiallySelectedEmoticon = sharedData
|
||||
|> map { sharedData -> String in
|
||||
let themeSettings: PresentationThemeSettings
|
||||
if let current = sharedData.entries[ApplicationSpecificSharedDataKeys.presentationThemeSettings]?.get(PresentationThemeSettings.self) {
|
||||
@@ -883,19 +884,27 @@ private class ChatQrCodeScreenNode: ViewControllerTracingNode, UIScrollViewDeleg
|
||||
return themeSettings.theme.emoticon ?? defaultEmoticon
|
||||
}
|
||||
} else {
|
||||
initiallySelectedEmoticon = self.context.account.postbox.transaction { transaction in
|
||||
let cachedData = self.context.account.postbox.transaction { transaction in
|
||||
return transaction.getPeerCachedData(peerId: peer.id)
|
||||
}
|
||||
|> take(1)
|
||||
|> map { cachedData -> String in
|
||||
if let cachedData = cachedData as? CachedUserData {
|
||||
return cachedData.themeEmoticon ?? defaultEmoticon
|
||||
} else if let cachedData = cachedData as? CachedGroupData {
|
||||
return cachedData.themeEmoticon ?? defaultEmoticon
|
||||
} else if let cachedData = cachedData as? CachedChannelData {
|
||||
return cachedData.themeEmoticon ?? defaultEmoticon
|
||||
initiallySelectedEmoticon = combineLatest(cachedData, sharedData)
|
||||
|> map { cachedData, sharedData -> String in
|
||||
let themeSettings: PresentationThemeSettings
|
||||
if let current = sharedData.entries[ApplicationSpecificSharedDataKeys.presentationThemeSettings]?.get(PresentationThemeSettings.self) {
|
||||
themeSettings = current
|
||||
} else {
|
||||
return defaultEmoticon
|
||||
themeSettings = PresentationThemeSettings.defaultSettings
|
||||
}
|
||||
let currentDefaultEmoticon = themeSettings.theme.emoticon ?? defaultEmoticon
|
||||
|
||||
if let cachedData = cachedData as? CachedUserData {
|
||||
return cachedData.themeEmoticon ?? currentDefaultEmoticon
|
||||
} else if let cachedData = cachedData as? CachedGroupData {
|
||||
return cachedData.themeEmoticon ?? currentDefaultEmoticon
|
||||
} else if let cachedData = cachedData as? CachedChannelData {
|
||||
return cachedData.themeEmoticon ?? currentDefaultEmoticon
|
||||
} else {
|
||||
return currentDefaultEmoticon
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user