From f91cc7f7443ba87f40e90f799274fe1983852402 Mon Sep 17 00:00:00 2001 From: Ilya Laktyushin Date: Sat, 19 Dec 2020 03:16:15 +0400 Subject: [PATCH] Various fixes --- .../Sources/AccountContext.swift | 3 +++ .../Sources/AuthTransferScanScreen.swift | 9 +++++++++ submodules/Camera/Sources/Camera.swift | 19 +++++++++++++++++++ .../Sources/ChatListController.swift | 16 ++++++++++++++-- .../Sources/ChatListControllerNode.swift | 8 ++++++++ .../Sources/ChannelVisibilityController.swift | 2 +- .../BlockedPeersController.swift | 6 ++---- .../Sources/VoiceChatActionButton.swift | 2 ++ .../Sources/MessageContentKind.swift | 5 +++-- .../TelegramUI/Sources/ChatController.swift | 2 +- .../ChatMessageAnimatedStickerItemNode.swift | 4 ++-- .../Sources/ChatMessageBubbleItemNode.swift | 6 +++--- .../ChatMessageInstantVideoItemNode.swift | 6 +++--- .../TelegramUI/Sources/ChatMessageItem.swift | 2 ++ .../Sources/ChatMessageItemView.swift | 1 + .../Sources/ChatMessageSelectionNode.swift | 4 ++-- .../Sources/ChatMessageStickerItemNode.swift | 15 ++++++++++----- .../Sources/ChatTextInputPanelNode.swift | 2 +- .../Sources/ComposeController.swift | 2 +- .../Sources/PeerSelectionControllerNode.swift | 3 ++- .../Sources/SharedAccountContext.swift | 2 +- .../UrlHandling/Sources/UrlHandling.swift | 3 +++ 22 files changed, 93 insertions(+), 29 deletions(-) diff --git a/submodules/AccountContext/Sources/AccountContext.swift b/submodules/AccountContext/Sources/AccountContext.swift index 05613df54f..a4ca97865a 100644 --- a/submodules/AccountContext/Sources/AccountContext.swift +++ b/submodules/AccountContext/Sources/AccountContext.swift @@ -640,6 +640,9 @@ public final class TonContext { #endif +public protocol ComposeController: ViewController { +} + public protocol ChatLocationContextHolder: class { } diff --git a/submodules/AuthTransferUI/Sources/AuthTransferScanScreen.swift b/submodules/AuthTransferUI/Sources/AuthTransferScanScreen.swift index ed33f1b9a9..c06059be3f 100644 --- a/submodules/AuthTransferUI/Sources/AuthTransferScanScreen.swift +++ b/submodules/AuthTransferUI/Sources/AuthTransferScanScreen.swift @@ -227,6 +227,7 @@ private final class AuthTransferScanScreenNode: ViewControllerTracingNode, UIScr private let camera: Camera private let codeDisposable = MetaDisposable() + private var torchDisposable: Disposable? fileprivate let focusedCode = ValuePromise(ignoreRepeated: true) private var focusedRect: CGRect? @@ -305,6 +306,13 @@ private final class AuthTransferScanScreenNode: ViewControllerTracingNode, UIScr self.backgroundColor = self.presentationData.theme.list.plainBackgroundColor + self.torchDisposable = (self.camera.hasTorch + |> deliverOnMainQueue).start(next: { [weak self] hasTorch in + if let strongSelf = self { + strongSelf.torchButtonNode.isHidden = !hasTorch + } + }) + self.addSubnode(self.previewNode) self.addSubnode(self.fadeNode) self.addSubnode(self.topDimNode) @@ -323,6 +331,7 @@ private final class AuthTransferScanScreenNode: ViewControllerTracingNode, UIScr deinit { self.codeDisposable.dispose() + self.torchDisposable?.dispose() self.camera.stopCapture(invalidate: true) } diff --git a/submodules/Camera/Sources/Camera.swift b/submodules/Camera/Sources/Camera.swift index edb5900912..265638dae2 100644 --- a/submodules/Camera/Sources/Camera.swift +++ b/submodules/Camera/Sources/Camera.swift @@ -93,6 +93,10 @@ private final class CameraContext { self.session.commitConfiguration() } + var hasTorch: Signal { + return self.device.isFlashAvailable + } + func setTorchActive(_ active: Bool) { self.device.setTorchActive(active) } @@ -189,6 +193,21 @@ public final class Camera { } } + public var hasTorch: Signal { + return Signal { subscriber in + let disposable = MetaDisposable() + self.queue.async { + if let context = self.contextRef?.takeUnretainedValue() { + disposable.set(context.hasTorch.start(next: { hasTorch in + subscriber.putNext(hasTorch) + subscriber.putCompletion() + })) + } + } + return disposable + } + } + public func attachPreviewNode(_ node: CameraPreviewNode) { let nodeRef: Unmanaged = Unmanaged.passRetained(node) self.queue.async { diff --git a/submodules/ChatListUI/Sources/ChatListController.swift b/submodules/ChatListUI/Sources/ChatListController.swift index 6cb637ce68..2e560c5298 100644 --- a/submodules/ChatListUI/Sources/ChatListController.swift +++ b/submodules/ChatListUI/Sources/ChatListController.swift @@ -1799,8 +1799,20 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController } @objc private func composePressed() { - let controller = self.context.sharedContext.makeComposeController(context: self.context) - (self.navigationController as? NavigationController)?.pushViewController(controller) + guard let navigationController = self.navigationController as? NavigationController else { + return + } + var hasComposeController = false + navigationController.viewControllers.forEach { controller in + if controller is ComposeController { + hasComposeController = true + } + } + + if !hasComposeController { + let controller = self.context.sharedContext.makeComposeController(context: self.context) + navigationController.pushViewController(controller) + } } public override var keyShortcuts: [KeyShortcut] { diff --git a/submodules/ChatListUI/Sources/ChatListControllerNode.swift b/submodules/ChatListUI/Sources/ChatListControllerNode.swift index bb7a299560..ec1fa2c7a0 100644 --- a/submodules/ChatListUI/Sources/ChatListControllerNode.swift +++ b/submodules/ChatListUI/Sources/ChatListControllerNode.swift @@ -893,6 +893,14 @@ final class ChatListContainerNode: ASDisplayNode, UIGestureRecognizerDelegate { insets.left += layout.safeInsets.left insets.right += layout.safeInsets.right + if isEditing { + if !layout.safeInsets.left.isZero { + insets.bottom += 34.0 + } else { + insets.bottom += 49.0 + } + } + transition.updateAlpha(node: self, alpha: isReorderingFilters ? 0.5 : 1.0) self.isUserInteractionEnabled = !isReorderingFilters diff --git a/submodules/PeerInfoUI/Sources/ChannelVisibilityController.swift b/submodules/PeerInfoUI/Sources/ChannelVisibilityController.swift index 097010cfbc..a43a28298e 100644 --- a/submodules/PeerInfoUI/Sources/ChannelVisibilityController.swift +++ b/submodules/PeerInfoUI/Sources/ChannelVisibilityController.swift @@ -853,7 +853,7 @@ public func channelVisibilityController(context: AccountContext, peerId: PeerId, let revokeLinkDisposable = MetaDisposable() actionsDisposable.add(revokeLinkDisposable) - actionsDisposable.add((context.account.viewTracker.peerView(peerId) |> filter { $0.cachedData != nil } |> take(1) |> mapToSignal { view -> Signal in + actionsDisposable.add((context.account.viewTracker.peerView(peerId) |> filter { $0.cachedData != nil } |> take(1) |> mapToSignal { view -> Signal in return ensuredExistingPeerExportedInvitation(account: context.account, peerId: peerId) }).start()) diff --git a/submodules/SettingsUI/Sources/Privacy and Security/BlockedPeersController.swift b/submodules/SettingsUI/Sources/Privacy and Security/BlockedPeersController.swift index 18a859af8e..03cab0a8c9 100644 --- a/submodules/SettingsUI/Sources/Privacy and Security/BlockedPeersController.swift +++ b/submodules/SettingsUI/Sources/Privacy and Security/BlockedPeersController.swift @@ -128,7 +128,7 @@ private enum BlockedPeersEntry: ItemListNodeEntry { return ItemListPeerActionItem(presentationData: presentationData, icon: PresentationResourcesItemList.addPersonIcon(theme), title: text, sectionId: self.section, editing: false, action: { arguments.addPeer() }) - case let .peerItem(_, theme, strings, dateTimeFormat, nameDisplayOrder, peer, editing, enabled): + case let .peerItem(_, _, strings, dateTimeFormat, nameDisplayOrder, peer, editing, enabled): let revealOptions = ItemListPeerItemRevealOptions(options: [ItemListPeerItemRevealOption(type: .destructive, title: strings.BlockedUsers_Unblock, action: { arguments.removePeer(peer.id) })]) @@ -219,8 +219,6 @@ public func blockedPeersController(context: AccountContext, blockedPeersContext: let removePeerDisposable = MetaDisposable() actionsDisposable.add(removePeerDisposable) - let peersPromise = Promise<[Peer]?>(nil) - let arguments = BlockedPeersControllerArguments(context: context, setPeerIdWithRevealedOptions: { peerId, fromPeerId in updateState { state in if (peerId == nil && fromPeerId == state.peerIdWithRevealedOptions) || (peerId != nil && fromPeerId == nil) { @@ -231,7 +229,7 @@ public func blockedPeersController(context: AccountContext, blockedPeersContext: } }, addPeer: { let presentationData = context.sharedContext.currentPresentationData.with { $0 } - let controller = context.sharedContext.makePeerSelectionController(PeerSelectionControllerParams(context: context, filter: [.onlyPrivateChats, .excludeSavedMessages, .removeSearchHeader, .excludeRecent], title: presentationData.strings.BlockedUsers_SelectUserTitle)) + let controller = context.sharedContext.makePeerSelectionController(PeerSelectionControllerParams(context: context, filter: [.onlyPrivateChats, .excludeSavedMessages, .removeSearchHeader, .excludeRecent, .doNotSearchMessages], title: presentationData.strings.BlockedUsers_SelectUserTitle)) controller.peerSelected = { [weak controller] peerId in guard let strongController = controller else { return diff --git a/submodules/TelegramCallsUI/Sources/VoiceChatActionButton.swift b/submodules/TelegramCallsUI/Sources/VoiceChatActionButton.swift index 2b2efd4bff..71acec2d2e 100644 --- a/submodules/TelegramCallsUI/Sources/VoiceChatActionButton.swift +++ b/submodules/TelegramCallsUI/Sources/VoiceChatActionButton.swift @@ -15,6 +15,8 @@ private let blue = UIColor(rgb: 0x0078ff) private let lightBlue = UIColor(rgb: 0x59c7f8) private let green = UIColor(rgb: 0x33c659) private let activeBlue = UIColor(rgb: 0x00a0b9) +private let purple = UIColor(rgb: 0x6b81f0) +private let pink = UIColor(rgb: 0xd75a76) private let areaSize = CGSize(width: 440.0, height: 440.0) private let blobSize = CGSize(width: 244.0, height: 244.0) diff --git a/submodules/TelegramStringFormatting/Sources/MessageContentKind.swift b/submodules/TelegramStringFormatting/Sources/MessageContentKind.swift index 58b62d7b59..2e3dc12984 100644 --- a/submodules/TelegramStringFormatting/Sources/MessageContentKind.swift +++ b/submodules/TelegramStringFormatting/Sources/MessageContentKind.swift @@ -224,10 +224,11 @@ public func stringForMediaKind(_ kind: MessageContentKind, strings: Presentation } public func descriptionStringForMessage(contentSettings: ContentSettings, message: Message, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, accountPeerId: PeerId) -> (String, Bool) { - if !message.text.isEmpty { + let contentKind = messageContentKind(contentSettings: contentSettings, message: message, strings: strings, nameDisplayOrder: nameDisplayOrder, accountPeerId: accountPeerId) + if !message.text.isEmpty && ![.expiredImage, .expiredVideo].contains(contentKind.key) { return (foldLineBreaks(message.text), false) } - return stringForMediaKind(messageContentKind(contentSettings: contentSettings, message: message, strings: strings, nameDisplayOrder: nameDisplayOrder, accountPeerId: accountPeerId), strings: strings) + return stringForMediaKind(contentKind, strings: strings) } public func foldLineBreaks(_ text: String) -> String { diff --git a/submodules/TelegramUI/Sources/ChatController.swift b/submodules/TelegramUI/Sources/ChatController.swift index 9f8ca8a6a3..f8a3744d34 100644 --- a/submodules/TelegramUI/Sources/ChatController.swift +++ b/submodules/TelegramUI/Sources/ChatController.swift @@ -9778,7 +9778,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G } private func forwardMessages(messages: [Message], resetCurrent: Bool) { - var filter: ChatListNodePeersFilter = [.onlyWriteable, .includeSavedMessages, .excludeDisabled] + var filter: ChatListNodePeersFilter = [.onlyWriteable, .includeSavedMessages, .excludeDisabled, .doNotSearchMessages] var hasPublicPolls = false var hasPublicQuiz = false for message in messages { diff --git a/submodules/TelegramUI/Sources/ChatMessageAnimatedStickerItemNode.swift b/submodules/TelegramUI/Sources/ChatMessageAnimatedStickerItemNode.swift index 79ea783f10..298e30bd70 100644 --- a/submodules/TelegramUI/Sources/ChatMessageAnimatedStickerItemNode.swift +++ b/submodules/TelegramUI/Sources/ChatMessageAnimatedStickerItemNode.swift @@ -1528,7 +1528,7 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView { selectionNode.updateSelected(selected, animated: false) let selectionFrame = CGRect(origin: CGPoint(x: -offset, y: 0.0), size: CGSize(width: self.contentBounds.size.width, height: self.contentBounds.size.height)) selectionNode.frame = selectionFrame - selectionNode.updateLayout(size: selectionFrame.size) + selectionNode.updateLayout(size: selectionFrame.size, leftInset: self.safeInsets.left) self.subnodeTransform = CATransform3DMakeTranslation(offset, 0.0, 0.0); } else { let selectionNode = ChatMessageSelectionNode(wallpaper: item.presentationData.theme.wallpaper, theme: item.presentationData.theme.theme, toggle: { [weak self] value in @@ -1539,7 +1539,7 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView { let selectionFrame = CGRect(origin: CGPoint(x: -offset, y: 0.0), size: CGSize(width: self.contentBounds.size.width, height: self.contentBounds.size.height)) selectionNode.frame = selectionFrame - selectionNode.updateLayout(size: selectionFrame.size) + selectionNode.updateLayout(size: selectionFrame.size, leftInset: self.safeInsets.left) self.addSubnode(selectionNode) self.selectionNode = selectionNode selectionNode.updateSelected(selected, animated: false) diff --git a/submodules/TelegramUI/Sources/ChatMessageBubbleItemNode.swift b/submodules/TelegramUI/Sources/ChatMessageBubbleItemNode.swift index 1889021ac0..9675518bbe 100644 --- a/submodules/TelegramUI/Sources/ChatMessageBubbleItemNode.swift +++ b/submodules/TelegramUI/Sources/ChatMessageBubbleItemNode.swift @@ -2636,7 +2636,7 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode let offset: CGFloat = params.leftInset + (incoming ? 42.0 : 0.0) let selectionFrame = CGRect(origin: CGPoint(x: -offset, y: 0.0), size: CGSize(width: params.width, height: layout.contentSize.height)) strongSelf.selectionNode?.frame = selectionFrame - strongSelf.selectionNode?.updateLayout(size: selectionFrame.size) + strongSelf.selectionNode?.updateLayout(size: selectionFrame.size, leftInset: params.leftInset) if let actionButtonsSizeAndApply = actionButtonsSizeAndApply { var animated = false @@ -3446,7 +3446,7 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode selectionNode.updateSelected(selected, animated: animated) let selectionFrame = CGRect(origin: CGPoint(x: -offset, y: 0.0), size: CGSize(width: self.contentSize.width, height: self.contentSize.height)) selectionNode.frame = selectionFrame - selectionNode.updateLayout(size: selectionFrame.size) + selectionNode.updateLayout(size: selectionFrame.size, leftInset: self.safeInsets.left) self.subnodeTransform = CATransform3DMakeTranslation(offset, 0.0, 0.0); } else { let selectionNode = ChatMessageSelectionNode(wallpaper: item.presentationData.theme.wallpaper, theme: item.presentationData.theme.theme, toggle: { [weak self] value in @@ -3462,7 +3462,7 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode let selectionFrame = CGRect(origin: CGPoint(x: -offset, y: 0.0), size: CGSize(width: self.contentSize.width, height: self.contentSize.height)) selectionNode.frame = selectionFrame - selectionNode.updateLayout(size: selectionFrame.size) + selectionNode.updateLayout(size: selectionFrame.size, leftInset: self.safeInsets.left) self.insertSubnode(selectionNode, belowSubnode: self.messageAccessibilityArea) self.selectionNode = selectionNode selectionNode.updateSelected(selected, animated: false) diff --git a/submodules/TelegramUI/Sources/ChatMessageInstantVideoItemNode.swift b/submodules/TelegramUI/Sources/ChatMessageInstantVideoItemNode.swift index 2adad28a7f..3adce5755b 100644 --- a/submodules/TelegramUI/Sources/ChatMessageInstantVideoItemNode.swift +++ b/submodules/TelegramUI/Sources/ChatMessageInstantVideoItemNode.swift @@ -452,7 +452,7 @@ class ChatMessageInstantVideoItemNode: ChatMessageItemView { strongSelf.appliedItem = item strongSelf.appliedForwardInfo = (forwardSource, forwardAuthorSignature) - + let transition: ContainedViewLayoutTransition if animation.isAnimated { transition = .animated(duration: 0.2, curve: .spring) @@ -886,7 +886,7 @@ class ChatMessageInstantVideoItemNode: ChatMessageItemView { if let selectionNode = self.selectionNode { let selectionFrame = CGRect(origin: CGPoint(x: -offset, y: 0.0), size: CGSize(width: self.contentBounds.size.width, height: self.contentBounds.size.height)) selectionNode.frame = selectionFrame - selectionNode.updateLayout(size: selectionFrame.size) + selectionNode.updateLayout(size: selectionFrame.size, leftInset: self.safeInsets.left) selectionNode.updateSelected(selected, animated: animated) self.subnodeTransform = CATransform3DMakeTranslation(offset, 0.0, 0.0); } else { @@ -897,7 +897,7 @@ class ChatMessageInstantVideoItemNode: ChatMessageItemView { }) let selectionFrame = CGRect(origin: CGPoint(x: -offset, y: 0.0), size: CGSize(width: self.contentBounds.size.width, height: self.contentBounds.size.height)) selectionNode.frame = selectionFrame - selectionNode.updateLayout(size: selectionFrame.size) + selectionNode.updateLayout(size: selectionFrame.size, leftInset: self.safeInsets.left) self.addSubnode(selectionNode) self.selectionNode = selectionNode selectionNode.updateSelected(selected, animated: false) diff --git a/submodules/TelegramUI/Sources/ChatMessageItem.swift b/submodules/TelegramUI/Sources/ChatMessageItem.swift index 546e288117..d50a40ce8b 100644 --- a/submodules/TelegramUI/Sources/ChatMessageItem.swift +++ b/submodules/TelegramUI/Sources/ChatMessageItem.swift @@ -424,6 +424,7 @@ public final class ChatMessageItem: ListViewItem, CustomStringConvertible { node.contentSize = layout.contentSize node.insets = layout.insets + node.safeInsets = UIEdgeInsets(top: 0.0, left: params.leftInset, bottom: 0.0, right: params.rightInset) node.updateSelectionState(animated: false) node.updateHighlightedState(animated: false) @@ -493,6 +494,7 @@ public final class ChatMessageItem: ListViewItem, CustomStringConvertible { completion(layout, { _ in apply(animation, false) if let nodeValue = node() as? ChatMessageItemView { + nodeValue.safeInsets = UIEdgeInsets(top: 0.0, left: params.leftInset, bottom: 0.0, right: params.rightInset) nodeValue.updateSelectionState(animated: false) nodeValue.updateHighlightedState(animated: false) } diff --git a/submodules/TelegramUI/Sources/ChatMessageItemView.swift b/submodules/TelegramUI/Sources/ChatMessageItemView.swift index 06f79274d8..fe2e2c390c 100644 --- a/submodules/TelegramUI/Sources/ChatMessageItemView.swift +++ b/submodules/TelegramUI/Sources/ChatMessageItemView.swift @@ -647,6 +647,7 @@ public class ChatMessageItemView: ListViewItemNode { var item: ChatMessageItem? var accessibilityData: ChatMessageAccessibilityData? + var safeInsets = UIEdgeInsets() var awaitingAppliedReaction: (String?, () -> Void)? diff --git a/submodules/TelegramUI/Sources/ChatMessageSelectionNode.swift b/submodules/TelegramUI/Sources/ChatMessageSelectionNode.swift index ab47b38038..cbec39c245 100644 --- a/submodules/TelegramUI/Sources/ChatMessageSelectionNode.swift +++ b/submodules/TelegramUI/Sources/ChatMessageSelectionNode.swift @@ -50,8 +50,8 @@ final class ChatMessageSelectionNode: ASDisplayNode { } } - func updateLayout(size: CGSize) { + func updateLayout(size: CGSize, leftInset: CGFloat) { let checkSize = CGSize(width: 32.0, height: 32.0) - self.checkNode.frame = CGRect(origin: CGPoint(x: 4.0, y: floor((size.height - checkSize.height) / 2.0)), size: checkSize) + self.checkNode.frame = CGRect(origin: CGPoint(x: 4.0 + leftInset, y: floor((size.height - checkSize.height) / 2.0)), size: checkSize) } } diff --git a/submodules/TelegramUI/Sources/ChatMessageStickerItemNode.swift b/submodules/TelegramUI/Sources/ChatMessageStickerItemNode.swift index a6080de5b2..de7c2acca5 100644 --- a/submodules/TelegramUI/Sources/ChatMessageStickerItemNode.swift +++ b/submodules/TelegramUI/Sources/ChatMessageStickerItemNode.swift @@ -673,9 +673,14 @@ class ChatMessageStickerItemNode: ChatMessageItemView { replyInfoNode.frame = replyInfoFrame strongSelf.replyBackgroundNode?.frame = replyBackgroundFrame ?? CGRect() - if let _ = item.controllerInteraction.selectionState, isEmoji { - replyInfoNode.alpha = 0.0 - strongSelf.replyBackgroundNode?.alpha = 0.0 + if isEmoji && !incoming { + if let _ = item.controllerInteraction.selectionState { + replyInfoNode.alpha = 0.0 + strongSelf.replyBackgroundNode?.alpha = 0.0 + } else { + replyInfoNode.alpha = 1.0 + strongSelf.replyBackgroundNode?.alpha = 1.0 + } } } else if let replyInfoNode = strongSelf.replyInfoNode { replyInfoNode.removeFromSupernode() @@ -1007,7 +1012,7 @@ class ChatMessageStickerItemNode: ChatMessageItemView { if let selectionNode = self.selectionNode { let selectionFrame = CGRect(origin: CGPoint(x: -offset, y: 0.0), size: CGSize(width: self.contentBounds.size.width, height: self.contentBounds.size.height)) selectionNode.frame = selectionFrame - selectionNode.updateLayout(size: selectionFrame.size) + selectionNode.updateLayout(size: selectionFrame.size, leftInset: self.safeInsets.left) selectionNode.updateSelected(selected, animated: animated) self.subnodeTransform = CATransform3DMakeTranslation(offset, 0.0, 0.0); } else { @@ -1018,7 +1023,7 @@ class ChatMessageStickerItemNode: ChatMessageItemView { }) let selectionFrame = CGRect(origin: CGPoint(x: -offset, y: 0.0), size: CGSize(width: self.contentBounds.size.width, height: self.contentBounds.size.height)) selectionNode.frame = selectionFrame - selectionNode.updateLayout(size: selectionFrame.size) + selectionNode.updateLayout(size: selectionFrame.size, leftInset: self.safeInsets.left) self.addSubnode(selectionNode) self.selectionNode = selectionNode selectionNode.updateSelected(selected, animated: false) diff --git a/submodules/TelegramUI/Sources/ChatTextInputPanelNode.swift b/submodules/TelegramUI/Sources/ChatTextInputPanelNode.swift index f35ef17ffb..7151db41a5 100644 --- a/submodules/TelegramUI/Sources/ChatTextInputPanelNode.swift +++ b/submodules/TelegramUI/Sources/ChatTextInputPanelNode.swift @@ -677,7 +677,7 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate { if let previousAdditionalSideInsets = previousAdditionalSideInsets, previousAdditionalSideInsets.right != additionalSideInsets.right { additionalOffset = (previousAdditionalSideInsets.right - additionalSideInsets.right) / 3.0 - if case let .animated(duration, curve) = transition { + if case let .animated(duration, _) = transition { transition = .animated(duration: 0.2, curve: .easeInOut) } } diff --git a/submodules/TelegramUI/Sources/ComposeController.swift b/submodules/TelegramUI/Sources/ComposeController.swift index 8522384ec6..d3b74eac5b 100644 --- a/submodules/TelegramUI/Sources/ComposeController.swift +++ b/submodules/TelegramUI/Sources/ComposeController.swift @@ -15,7 +15,7 @@ import TelegramPermissionsUI import AppBundle import DeviceAccess -public class ComposeController: ViewController { +public class ComposeControllerImpl: ViewController, ComposeController { private let context: AccountContext private var contactsNode: ComposeControllerNode { diff --git a/submodules/TelegramUI/Sources/PeerSelectionControllerNode.swift b/submodules/TelegramUI/Sources/PeerSelectionControllerNode.swift index 16f6e78766..f2a96c89db 100644 --- a/submodules/TelegramUI/Sources/PeerSelectionControllerNode.swift +++ b/submodules/TelegramUI/Sources/PeerSelectionControllerNode.swift @@ -228,7 +228,8 @@ final class PeerSelectionControllerNode: ASDisplayNode { if let requestOpenMessageFromSearch = self?.requestOpenMessageFromSearch { requestOpenMessageFromSearch(peer, messageId) } - }, addContact: nil, peerContextAction: nil, present: { _, _ in + }, addContact: nil, peerContextAction: nil, present: { [weak self] c, a in + self?.present(c, a) }, presentInGlobalOverlay: { _, _ in }, navigationController: nil), cancel: { [weak self] in if let requestDeactivateSearch = self?.requestDeactivateSearch { diff --git a/submodules/TelegramUI/Sources/SharedAccountContext.swift b/submodules/TelegramUI/Sources/SharedAccountContext.swift index 11f4ea0e0f..717e10c6d4 100644 --- a/submodules/TelegramUI/Sources/SharedAccountContext.swift +++ b/submodules/TelegramUI/Sources/SharedAccountContext.swift @@ -1176,7 +1176,7 @@ public final class SharedAccountContextImpl: SharedAccountContext { } public func makeComposeController(context: AccountContext) -> ViewController { - return ComposeController(context: context) + return ComposeControllerImpl(context: context) } public func makeProxySettingsController(context: AccountContext) -> ViewController { diff --git a/submodules/UrlHandling/Sources/UrlHandling.swift b/submodules/UrlHandling/Sources/UrlHandling.swift index 42576e6876..f814af7b40 100644 --- a/submodules/UrlHandling/Sources/UrlHandling.swift +++ b/submodules/UrlHandling/Sources/UrlHandling.swift @@ -48,6 +48,9 @@ public func parseInternalUrl(query: String) -> ParsedInternalUrl? { if query.hasPrefix("s/") { query = String(query[query.index(query.startIndex, offsetBy: 2)...]) } + if query.hasSuffix("/") { + query.removeLast() + } if let components = URLComponents(string: "/" + query) { var pathComponents = components.path.components(separatedBy: "/") if !pathComponents.isEmpty {