From 67f34ab53d911eb5fc64d104d7e1608f06374d11 Mon Sep 17 00:00:00 2001 From: Ilya Laktyushin Date: Wed, 1 Feb 2023 02:51:21 +0400 Subject: [PATCH] Fix allow write setting when adding attach menu bot --- .../TwoStepVerificationUnlockController.swift | 2 +- submodules/WebUI/Sources/WebAppAlertContentNode.swift | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/submodules/SettingsUI/Sources/Privacy and Security/TwoStepVerificationUnlockController.swift b/submodules/SettingsUI/Sources/Privacy and Security/TwoStepVerificationUnlockController.swift index 2d53114931..ac7aa8d89e 100644 --- a/submodules/SettingsUI/Sources/Privacy and Security/TwoStepVerificationUnlockController.swift +++ b/submodules/SettingsUI/Sources/Privacy and Security/TwoStepVerificationUnlockController.swift @@ -226,7 +226,7 @@ private func twoStepVerificationUnlockSettingsControllerEntries(presentationData if remainingSeconds <= 0 { text += "[" + presentationData.strings.TwoStepAuth_ResetAction + "](reset)" } else { - text.append(presentationData.strings.TwoStepAuth_ResetPendingText(timeIntervalString(strings: presentationData.strings, value: remainingSeconds)).string) + text.append(presentationData.strings.TwoStepAuth_ResetPendingText(timeIntervalString(strings: presentationData.strings, value: remainingSeconds, usage: .afterTime)).string) text.append("\n[\(presentationData.strings.TwoStepAuth_CancelResetTitle)](declineReset)") } } else { diff --git a/submodules/WebUI/Sources/WebAppAlertContentNode.swift b/submodules/WebUI/Sources/WebAppAlertContentNode.swift index d408b8f675..a3da723cdd 100644 --- a/submodules/WebUI/Sources/WebAppAlertContentNode.swift +++ b/submodules/WebUI/Sources/WebAppAlertContentNode.swift @@ -108,7 +108,6 @@ private final class WebAppAlertContentNode: AlertContentNode { self.addSubnode(self.allowWriteLabelNode) } - self.addSubnode(self.actionNodesSeparator) for actionNode in self.actionNodes { @@ -316,10 +315,14 @@ public func addWebAppToAttachmentController(context: AccountContext, peerName: S var contentNode: WebAppAlertContentNode? let actions: [TextAlertAction] = [TextAlertAction(type: .genericAction, title: presentationData.strings.Common_Cancel, action: { dismissImpl?(true) - }), TextAlertAction(type: .defaultAction, title: presentationData.strings.WebApp_AddToAttachmentAdd, action: { + }), TextAlertAction(type: .defaultAction, title: presentationData.strings.WebApp_AddToAttachmentAdd, action: { [weak contentNode] in dismissImpl?(true) - completion(true) + if requestWriteAccess, let allowWriteAccess = contentNode?.allowWriteAccess { + completion(allowWriteAccess) + } else { + completion(false) + } })] contentNode = WebAppAlertContentNode(account: context.account, theme: AlertControllerTheme(presentationData: presentationData), ptheme: theme, strings: strings, peerName: peerName, icons: icons, requestWriteAccess: requestWriteAccess, actions: actions)