mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-17 11:50:56 +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() {
|
override func viewDidLayoutSubviews() {
|
||||||
super.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
|
case dark
|
||||||
|
|
||||||
@available(iOS 12.0, *)
|
@available(iOS 12.0, *)
|
||||||
fileprivate init(style: UIUserInterfaceStyle) {
|
public init(style: UIUserInterfaceStyle) {
|
||||||
switch style {
|
switch style {
|
||||||
case .light, .unspecified:
|
case .light, .unspecified:
|
||||||
self = .light
|
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
|
return accountManager.transaction { transaction -> InitialPresentationDataAndSettings in
|
||||||
let localizationSettings: LocalizationSettings?
|
let localizationSettings: LocalizationSettings?
|
||||||
if let current = transaction.getSharedData(SharedDataKeys.localizationSettings) as? LocalizationSettings {
|
if let current = transaction.getSharedData(SharedDataKeys.localizationSettings) as? LocalizationSettings {
|
||||||
@ -249,7 +249,7 @@ public func currentPresentationDataAndSettings(accountManager: AccountManager) -
|
|||||||
var effectiveChatWallpaper: TelegramWallpaper = themeSettings.chatWallpaper
|
var effectiveChatWallpaper: TelegramWallpaper = themeSettings.chatWallpaper
|
||||||
|
|
||||||
let parameters = AutomaticThemeSwitchParameters(settings: themeSettings.automaticThemeSwitchSetting)
|
let parameters = AutomaticThemeSwitchParameters(settings: themeSettings.automaticThemeSwitchSetting)
|
||||||
if automaticThemeShouldSwitchNow(parameters, systemUserInterfaceStyle: .light) {
|
if automaticThemeShouldSwitchNow(parameters, systemUserInterfaceStyle: systemUserInterfaceStyle) {
|
||||||
effectiveTheme = themeSettings.automaticThemeSwitchSetting.theme
|
effectiveTheme = themeSettings.automaticThemeSwitchSetting.theme
|
||||||
} else {
|
} else {
|
||||||
effectiveTheme = themeSettings.theme
|
effectiveTheme = themeSettings.theme
|
||||||
|
|||||||
@ -715,7 +715,7 @@ final class SharedApplicationContext {
|
|||||||
|> deliverOnMainQueue
|
|> deliverOnMainQueue
|
||||||
|> take(1)
|
|> take(1)
|
||||||
|> mapToSignal { accountManager -> Signal<(AccountManager, InitialPresentationDataAndSettings), NoError> in
|
|> mapToSignal { accountManager -> Signal<(AccountManager, InitialPresentationDataAndSettings), NoError> in
|
||||||
return currentPresentationDataAndSettings(accountManager: accountManager)
|
return currentPresentationDataAndSettings(accountManager: accountManager, systemUserInterfaceStyle: .light)
|
||||||
|> map { initialPresentationDataAndSettings -> (AccountManager, InitialPresentationDataAndSettings) in
|
|> map { initialPresentationDataAndSettings -> (AccountManager, InitialPresentationDataAndSettings) in
|
||||||
return (accountManager, initialPresentationDataAndSettings)
|
return (accountManager, initialPresentationDataAndSettings)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -115,7 +115,7 @@ public final class NotificationViewControllerImpl {
|
|||||||
|
|
||||||
var initialPresentationDataAndSettings: InitialPresentationDataAndSettings?
|
var initialPresentationDataAndSettings: InitialPresentationDataAndSettings?
|
||||||
let semaphore = DispatchSemaphore(value: 0)
|
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
|
initialPresentationDataAndSettings = value
|
||||||
semaphore.signal()
|
semaphore.signal()
|
||||||
})
|
})
|
||||||
|
|||||||
@ -114,7 +114,7 @@ public class ShareRootControllerImpl {
|
|||||||
inForeground.set(false)
|
inForeground.set(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func viewDidLayoutSubviews(view: UIView) {
|
public func viewDidLayoutSubviews(view: UIView, traitCollection: UITraitCollection) {
|
||||||
if self.mainWindow == nil {
|
if self.mainWindow == nil {
|
||||||
let mainWindow = Window1(hostView: childWindowHostView(parent: view), statusBarHost: nil)
|
let mainWindow = Window1(hostView: childWindowHostView(parent: view), statusBarHost: nil)
|
||||||
mainWindow.hostView.eventView.backgroundColor = UIColor.clear
|
mainWindow.hostView.eventView.backgroundColor = UIColor.clear
|
||||||
@ -168,7 +168,13 @@ public class ShareRootControllerImpl {
|
|||||||
let accountManager = AccountManager(basePath: rootPath + "/accounts-metadata")
|
let accountManager = AccountManager(basePath: rootPath + "/accounts-metadata")
|
||||||
var initialPresentationDataAndSettings: InitialPresentationDataAndSettings?
|
var initialPresentationDataAndSettings: InitialPresentationDataAndSettings?
|
||||||
let semaphore = DispatchSemaphore(value: 0)
|
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
|
initialPresentationDataAndSettings = value
|
||||||
semaphore.signal()
|
semaphore.signal()
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user