Add web app theme request

This commit is contained in:
Ilya Laktyushin 2022-04-15 19:57:30 +04:00
parent 6e4b9a82e9
commit 2c4dd3d411

View File

@ -460,6 +460,8 @@ public final class WebAppController: ViewController, AttachmentContainable {
if let (layout, navigationBarHeight) = self.validLayout { if let (layout, navigationBarHeight) = self.validLayout {
self.containerLayoutUpdated(layout, navigationBarHeight: navigationBarHeight, transition: .immediate) self.containerLayoutUpdated(layout, navigationBarHeight: navigationBarHeight, transition: .immediate)
} }
case "web_app_request_theme":
self.sendThemeChangedEvent()
case "web_app_expand": case "web_app_expand":
self.controller?.requestAttachmentMenuExpansion() self.controller?.requestAttachmentMenuExpansion()
case "web_app_close": case "web_app_close":
@ -498,7 +500,10 @@ public final class WebAppController: ViewController, AttachmentContainable {
} else { } else {
self.backgroundColor = self.presentationData.theme.list.plainBackgroundColor self.backgroundColor = self.presentationData.theme.list.plainBackgroundColor
} }
self.sendThemeChangedEvent()
}
private func sendThemeChangedEvent() {
let themeParams = generateWebAppThemeParams(presentationData.theme) let themeParams = generateWebAppThemeParams(presentationData.theme)
var themeParamsString = "{theme_params: {" var themeParamsString = "{theme_params: {"
for (key, value) in themeParams { for (key, value) in themeParams {