Group boosts

This commit is contained in:
Ilya Laktyushin
2024-02-12 05:30:08 +04:00
parent af9a3729ca
commit 977435c9e8
5 changed files with 62 additions and 26 deletions

View File

@@ -291,6 +291,8 @@ public final class WebAppController: ViewController, AttachmentContainable {
private var paymentDisposable: Disposable?
private var lastExpansionTimestamp: Double?
private var didTransitionIn = false
private var dismissed = false
@@ -739,7 +741,7 @@ public final class WebAppController: ViewController, AttachmentContainable {
guard let eventName = body["eventName"] as? String else {
return
}
let currentTimestamp = CACurrentMediaTime()
let eventData = (body["eventData"] as? String)?.data(using: .utf8)
let json = try? JSONSerialization.jsonObject(with: eventData ?? Data(), options: []) as? [String: Any]
@@ -804,7 +806,12 @@ public final class WebAppController: ViewController, AttachmentContainable {
case "web_app_request_theme":
self.sendThemeChangedEvent()
case "web_app_expand":
controller.requestAttachmentMenuExpansion()
if let lastExpansionTimestamp = self.lastExpansionTimestamp, currentTimestamp < lastExpansionTimestamp + 1.0 {
} else {
self.lastExpansionTimestamp = currentTimestamp
controller.requestAttachmentMenuExpansion()
}
case "web_app_close":
controller.dismiss()
case "web_app_open_tg_link":
@@ -846,7 +853,6 @@ public final class WebAppController: ViewController, AttachmentContainable {
case "web_app_open_link":
if let json = json, let url = json["url"] as? String {
let tryInstantView = json["try_instant_view"] as? Bool ?? false
let currentTimestamp = CACurrentMediaTime()
if let lastTouchTimestamp = self.webView?.lastTouchTimestamp, currentTimestamp < lastTouchTimestamp + 10.0 {
self.webView?.lastTouchTimestamp = nil
if tryInstantView {