diff --git a/submodules/AttachmentUI/Sources/AttachmentContainer.swift b/submodules/AttachmentUI/Sources/AttachmentContainer.swift index b4edaed71c..7ea7aecff3 100644 --- a/submodules/AttachmentUI/Sources/AttachmentContainer.swift +++ b/submodules/AttachmentUI/Sources/AttachmentContainer.swift @@ -234,7 +234,7 @@ final class AttachmentContainer: ASDisplayNode, UIGestureRecognizerDelegate { } } - if translation > 40.0, let shouldCancelPanGesture = self.shouldCancelPanGesture, shouldCancelPanGesture() { + if !self.isExpanded, translation > 40.0, let shouldCancelPanGesture = self.shouldCancelPanGesture, shouldCancelPanGesture() { self.cancelPanGesture() return } diff --git a/submodules/WebUI/Sources/WebAppController.swift b/submodules/WebUI/Sources/WebAppController.swift index 24ac6baf41..f51919647f 100644 --- a/submodules/WebUI/Sources/WebAppController.swift +++ b/submodules/WebUI/Sources/WebAppController.swift @@ -898,7 +898,7 @@ public final class WebAppController: ViewController, AttachmentContainable { fileprivate func sendAlertButtonEvent(id: String?) { var paramsString: String? if let id = id { - paramsString = "{id: \"\(id)\"}" + paramsString = "{button_id: \"\(id)\"}" } self.webView?.sendEvent(name: "popup_closed", data: paramsString) } @@ -1013,7 +1013,9 @@ public final class WebAppController: ViewController, AttachmentContainable { if case .back = self.cancelButtonNode.state { self.controllerNode.sendBackButtonEvent() } else { - self.dismiss() + self.requestDismiss { + self.dismiss() + } } } @@ -1126,12 +1128,23 @@ public final class WebAppController: ViewController, AttachmentContainable { public func requestDismiss(completion: @escaping () -> Void) { if self.controllerNode.needDismissConfirmation { - let controller = textAlertController(context: self.context, title: nil, text: self.presentationData.strings.WebApp_CloseConfirmation, actions: [TextAlertAction(type: .genericAction, title: self.presentationData.strings.WebApp_CloseAnyway, action: { - completion() - }), TextAlertAction(type: .defaultAction, title: self.presentationData.strings.Common_Cancel, action: { - - })], actionLayout: .vertical) - self.present(controller, in: .window(.root)) + let actionSheet = ActionSheetController(presentationData: self.presentationData) + actionSheet.setItemGroups([ + ActionSheetItemGroup(items: [ + ActionSheetTextItem(title: self.presentationData.strings.WebApp_CloseConfirmation), + ActionSheetButtonItem(title: self.presentationData.strings.WebApp_CloseAnyway, color: .destructive, action: { [weak actionSheet] in + actionSheet?.dismissAnimated() + + completion() + }) + ]), + ActionSheetItemGroup(items: [ + ActionSheetButtonItem(title: self.presentationData.strings.Common_Cancel, color: .accent, font: .bold, action: { [weak actionSheet] in + actionSheet?.dismissAnimated() + }) + ]) + ]) + self.present(actionSheet, in: .window(.root)) } else { completion() }