mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
Fix Share auto theme
This commit is contained in:
parent
85c564ad70
commit
7d86ef5c4c
@ -55,6 +55,6 @@ class ShareRootController: UIViewController {
|
||||
|
||||
override func viewDidLayoutSubviews() {
|
||||
super.viewDidLayoutSubviews()
|
||||
self.impl?.viewDidLayoutSubviews(view: self.view)
|
||||
self.impl?.viewDidLayoutSubviews(view: self.view, traitCollection: self.traitCollection)
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ public enum WindowUserInterfaceStyle {
|
||||
case dark
|
||||
|
||||
@available(iOS 12.0, *)
|
||||
fileprivate init(style: UIUserInterfaceStyle) {
|
||||
public init(style: UIUserInterfaceStyle) {
|
||||
switch style {
|
||||
case .light, .unspecified:
|
||||
self = .light
|
||||
|
@ -195,7 +195,7 @@ public final class InitialPresentationDataAndSettings {
|
||||
}
|
||||
}
|
||||
|
||||
public func currentPresentationDataAndSettings(accountManager: AccountManager) -> Signal<InitialPresentationDataAndSettings, NoError> {
|
||||
public func currentPresentationDataAndSettings(accountManager: AccountManager, systemUserInterfaceStyle: WindowUserInterfaceStyle) -> Signal<InitialPresentationDataAndSettings, NoError> {
|
||||
return accountManager.transaction { transaction -> InitialPresentationDataAndSettings in
|
||||
let localizationSettings: LocalizationSettings?
|
||||
if let current = transaction.getSharedData(SharedDataKeys.localizationSettings) as? LocalizationSettings {
|
||||
@ -249,7 +249,7 @@ public func currentPresentationDataAndSettings(accountManager: AccountManager) -
|
||||
var effectiveChatWallpaper: TelegramWallpaper = themeSettings.chatWallpaper
|
||||
|
||||
let parameters = AutomaticThemeSwitchParameters(settings: themeSettings.automaticThemeSwitchSetting)
|
||||
if automaticThemeShouldSwitchNow(parameters, systemUserInterfaceStyle: .light) {
|
||||
if automaticThemeShouldSwitchNow(parameters, systemUserInterfaceStyle: systemUserInterfaceStyle) {
|
||||
effectiveTheme = themeSettings.automaticThemeSwitchSetting.theme
|
||||
} else {
|
||||
effectiveTheme = themeSettings.theme
|
||||
|
@ -715,9 +715,9 @@ final class SharedApplicationContext {
|
||||
|> deliverOnMainQueue
|
||||
|> take(1)
|
||||
|> mapToSignal { accountManager -> Signal<(AccountManager, InitialPresentationDataAndSettings), NoError> in
|
||||
return currentPresentationDataAndSettings(accountManager: accountManager)
|
||||
|> map { initialPresentationDataAndSettings -> (AccountManager, InitialPresentationDataAndSettings) in
|
||||
return (accountManager, initialPresentationDataAndSettings)
|
||||
return currentPresentationDataAndSettings(accountManager: accountManager, systemUserInterfaceStyle: .light)
|
||||
|> map { initialPresentationDataAndSettings -> (AccountManager, InitialPresentationDataAndSettings) in
|
||||
return (accountManager, initialPresentationDataAndSettings)
|
||||
}
|
||||
}
|
||||
|> deliverOnMainQueue
|
||||
|
@ -115,7 +115,7 @@ public final class NotificationViewControllerImpl {
|
||||
|
||||
var initialPresentationDataAndSettings: InitialPresentationDataAndSettings?
|
||||
let semaphore = DispatchSemaphore(value: 0)
|
||||
let _ = currentPresentationDataAndSettings(accountManager: accountManager).start(next: { value in
|
||||
let _ = currentPresentationDataAndSettings(accountManager: accountManager, systemUserInterfaceStyle: .light).start(next: { value in
|
||||
initialPresentationDataAndSettings = value
|
||||
semaphore.signal()
|
||||
})
|
||||
|
@ -114,7 +114,7 @@ public class ShareRootControllerImpl {
|
||||
inForeground.set(false)
|
||||
}
|
||||
|
||||
public func viewDidLayoutSubviews(view: UIView) {
|
||||
public func viewDidLayoutSubviews(view: UIView, traitCollection: UITraitCollection) {
|
||||
if self.mainWindow == nil {
|
||||
let mainWindow = Window1(hostView: childWindowHostView(parent: view), statusBarHost: nil)
|
||||
mainWindow.hostView.eventView.backgroundColor = UIColor.clear
|
||||
@ -168,7 +168,13 @@ public class ShareRootControllerImpl {
|
||||
let accountManager = AccountManager(basePath: rootPath + "/accounts-metadata")
|
||||
var initialPresentationDataAndSettings: InitialPresentationDataAndSettings?
|
||||
let semaphore = DispatchSemaphore(value: 0)
|
||||
let _ = currentPresentationDataAndSettings(accountManager: accountManager).start(next: { value in
|
||||
let systemUserInterfaceStyle: WindowUserInterfaceStyle
|
||||
if #available(iOSApplicationExtension 12.0, iOS 12.0, *) {
|
||||
systemUserInterfaceStyle = WindowUserInterfaceStyle(style: traitCollection.userInterfaceStyle)
|
||||
} else {
|
||||
systemUserInterfaceStyle = .light
|
||||
}
|
||||
let _ = currentPresentationDataAndSettings(accountManager: accountManager, systemUserInterfaceStyle: systemUserInterfaceStyle).start(next: { value in
|
||||
initialPresentationDataAndSettings = value
|
||||
semaphore.signal()
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user