From a79644bf514ab3467dcae54274bd40eb68b334d4 Mon Sep 17 00:00:00 2001 From: Ilya Laktyushin Date: Mon, 18 Mar 2024 21:45:36 +0400 Subject: [PATCH] Various fixes --- .../StickerPackPreviewUI/Sources/StickerPackScreen.swift | 4 ++-- .../Sources/ChatEntityKeyboardInputNode.swift | 2 +- .../Sources/ContactMultiselectionController.swift | 4 +++- .../Sources/ContactMultiselectionControllerNode.swift | 9 ++++++++- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/submodules/StickerPackPreviewUI/Sources/StickerPackScreen.swift b/submodules/StickerPackPreviewUI/Sources/StickerPackScreen.swift index 57226f3a74..be1351a8c5 100644 --- a/submodules/StickerPackPreviewUI/Sources/StickerPackScreen.swift +++ b/submodules/StickerPackPreviewUI/Sources/StickerPackScreen.swift @@ -1155,8 +1155,8 @@ private final class StickerPackContainer: ASDisplayNode { controller.controllerNode.dismiss() })) items.append(ActionSheetButtonItem(title: "Add an Existing Sticker", color: .accent, action: { [weak actionSheet, weak self] in - actionSheet?.dismissAnimated() - + actionSheet?.dismissAnimated() + guard let self, let controller = self.controller else { return } diff --git a/submodules/TelegramUI/Components/ChatEntityKeyboardInputNode/Sources/ChatEntityKeyboardInputNode.swift b/submodules/TelegramUI/Components/ChatEntityKeyboardInputNode/Sources/ChatEntityKeyboardInputNode.swift index de524211ea..ce68a301e5 100644 --- a/submodules/TelegramUI/Components/ChatEntityKeyboardInputNode/Sources/ChatEntityKeyboardInputNode.swift +++ b/submodules/TelegramUI/Components/ChatEntityKeyboardInputNode/Sources/ChatEntityKeyboardInputNode.swift @@ -1337,7 +1337,7 @@ public final class ChatEntityKeyboardInputNode: ChatInputNode { stickerPacks: [packReference], loadedStickerPacks: [], isEditing: true, - parentNavigationController: nil, + parentNavigationController: interaction.getNavigationController(), sendSticker: { [weak interaction] fileReference, sourceView, sourceRect in return interaction?.sendSticker(fileReference, false, false, nil, false, sourceView, sourceRect, nil, []) ?? false } diff --git a/submodules/TelegramUI/Sources/ContactMultiselectionController.swift b/submodules/TelegramUI/Sources/ContactMultiselectionController.swift index a5cc74ff9f..9c4404101b 100644 --- a/submodules/TelegramUI/Sources/ContactMultiselectionController.swift +++ b/submodules/TelegramUI/Sources/ContactMultiselectionController.swift @@ -287,7 +287,9 @@ class ContactMultiselectionControllerImpl: ViewController, ContactMultiselection } override func loadDisplayNode() { - self.displayNode = ContactMultiselectionControllerNode(navigationBar: self.navigationBar, context: self.context, presentationData: self.presentationData, mode: self.mode, isPeerEnabled: self.isPeerEnabled, attemptDisabledItemSelection: self.attemptDisabledItemSelection, options: self.options, filters: self.filters, onlyWriteable: self.onlyWriteable, limit: self.limit, reachedSelectionLimit: self.params.reachedLimit) + self.displayNode = ContactMultiselectionControllerNode(navigationBar: self.navigationBar, context: self.context, presentationData: self.presentationData, mode: self.mode, isPeerEnabled: self.isPeerEnabled, attemptDisabledItemSelection: self.attemptDisabledItemSelection, options: self.options, filters: self.filters, onlyWriteable: self.onlyWriteable, limit: self.limit, reachedSelectionLimit: self.params.reachedLimit, present: { [weak self] c, a in + self?.present(c, in: .window(.root), with: a) + }) switch self.contactsNode.contentNode { case let .contacts(contactsNode): self._listReady.set(contactsNode.ready) diff --git a/submodules/TelegramUI/Sources/ContactMultiselectionControllerNode.swift b/submodules/TelegramUI/Sources/ContactMultiselectionControllerNode.swift index 75da214999..a3758e9dc8 100644 --- a/submodules/TelegramUI/Sources/ContactMultiselectionControllerNode.swift +++ b/submodules/TelegramUI/Sources/ContactMultiselectionControllerNode.swift @@ -79,7 +79,7 @@ final class ContactMultiselectionControllerNode: ASDisplayNode { private let isPeerEnabled: ((EnginePeer) -> Bool)? private let onlyWriteable: Bool - init(navigationBar: NavigationBar?, context: AccountContext, presentationData: PresentationData, mode: ContactMultiselectionControllerMode, isPeerEnabled: ((EnginePeer) -> Bool)?, attemptDisabledItemSelection: ((EnginePeer, ChatListDisabledPeerReason) -> Void)?, options: [ContactListAdditionalOption], filters: [ContactListFilter], onlyWriteable: Bool, limit: Int32?, reachedSelectionLimit: ((Int32) -> Void)?) { + init(navigationBar: NavigationBar?, context: AccountContext, presentationData: PresentationData, mode: ContactMultiselectionControllerMode, isPeerEnabled: ((EnginePeer) -> Bool)?, attemptDisabledItemSelection: ((EnginePeer, ChatListDisabledPeerReason) -> Void)?, options: [ContactListAdditionalOption], filters: [ContactListFilter], onlyWriteable: Bool, limit: Int32?, reachedSelectionLimit: ((Int32) -> Void)?, present: @escaping (ViewController, Any?) -> Void) { self.navigationBar = navigationBar self.context = context @@ -233,6 +233,13 @@ final class ContactMultiselectionControllerNode: ASDisplayNode { } self.openDisabledPeer?(peer, reason) } + contactsNode.suppressPermissionWarning = { [weak self] in + if let strongSelf = self { + strongSelf.context.sharedContext.presentContactsWarningSuppression(context: strongSelf.context, present: { c, a in + present(c, a) + }) + } + } case let .chats(chatsNode): chatsNode.peerSelected = { [weak self] peer, _, _, _, _ in self?.openPeer?(.peer(peer: peer._asPeer(), isGlobal: false, participantCount: nil))