Various fixes

This commit is contained in:
Ilya Laktyushin
2023-10-29 17:52:44 +04:00
parent bbb543f836
commit 32de3c0e53
4 changed files with 27 additions and 9 deletions

View File

@@ -235,7 +235,6 @@ public struct WebAppParameters {
public func generateWebAppThemeParams(_ presentationTheme: PresentationTheme) -> [String: Any] {
let backgroundColor = presentationTheme.list.plainBackgroundColor.rgb
let secondaryBackgroundColor = presentationTheme.list.blocksBackgroundColor.rgb
return [
"bg_color": Int32(bitPattern: backgroundColor),
"secondary_bg_color": Int32(bitPattern: secondaryBackgroundColor),
@@ -329,6 +328,13 @@ public final class WebAppController: ViewController, AttachmentContainable {
strongSelf.handleScriptMessage(delayedScriptMessage)
}
}
if #available(iOS 13.0, *) {
if self.presentationData.theme.overallDarkAppearance {
webView.overrideUserInterfaceStyle = .dark
} else {
webView.overrideUserInterfaceStyle = .unspecified
}
}
self.webView = webView
self.addSubnode(self.backgroundNode)
@@ -1120,6 +1126,14 @@ public final class WebAppController: ViewController, AttachmentContainable {
}
self.updateHeaderBackgroundColor(transition: .immediate)
self.sendThemeChangedEvent()
if #available(iOS 13.0, *) {
if self.presentationData.theme.overallDarkAppearance {
self.webView?.overrideUserInterfaceStyle = .dark
} else {
self.webView?.overrideUserInterfaceStyle = .unspecified
}
}
}
private func sendThemeChangedEvent() {