Fix allow write setting when adding attach menu bot

This commit is contained in:
Ilya Laktyushin
2023-02-01 02:51:21 +04:00
parent a460d06411
commit 67f34ab53d
2 changed files with 7 additions and 4 deletions

View File

@@ -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)