diff --git a/Telegram/Telegram-iOS/en.lproj/Localizable.strings b/Telegram/Telegram-iOS/en.lproj/Localizable.strings index af885d6c05..ed9272f447 100644 --- a/Telegram/Telegram-iOS/en.lproj/Localizable.strings +++ b/Telegram/Telegram-iOS/en.lproj/Localizable.strings @@ -7139,3 +7139,5 @@ Sorry for the inconvenience."; "UserInfo.QRCode.InfoOther" = "Everyone on Telegram can scan this code to message %@."; "PeerInfo.QRCode.Title" = "QR Code"; + +"ChatList.Archive" = "Archive"; diff --git a/submodules/ChatListUI/Sources/ChatListSearchContainerNode.swift b/submodules/ChatListUI/Sources/ChatListSearchContainerNode.swift index ec56305d9c..8529e8b1e8 100644 --- a/submodules/ChatListUI/Sources/ChatListSearchContainerNode.swift +++ b/submodules/ChatListUI/Sources/ChatListSearchContainerNode.swift @@ -31,6 +31,7 @@ import UndoUI import TextFormat private enum ChatListTokenId: Int32 { + case archive case filter case peer case date @@ -457,13 +458,17 @@ public final class ChatListSearchContainerNode: SearchDisplayControllerContentNo private func updateSearchOptions(_ options: ChatListSearchOptions?, clearQuery: Bool = false) { var options = options + var tokens: [SearchBarToken] = [] + if self.groupId == .archive { + tokens.append(SearchBarToken(id: ChatListTokenId.archive.rawValue, icon: UIImage(bundleImageName: "Chat List/Search/Archive"), title: self.presentationData.strings.ChatList_Archive, permanent: true)) + } + if options?.isEmpty ?? true { options = nil } self.searchOptionsValue = options self.searchOptions.set(.single(options)) - var tokens: [SearchBarToken] = [] if let (peerId, isGroup, peerName) = options?.peer { let image: UIImage? if isGroup { @@ -473,11 +478,11 @@ public final class ChatListSearchContainerNode: SearchDisplayControllerContentNo } else { image = UIImage(bundleImageName: "Chat List/Search/User") } - tokens.append(SearchBarToken(id: ChatListTokenId.peer.rawValue, icon:image, title: peerName)) + tokens.append(SearchBarToken(id: ChatListTokenId.peer.rawValue, icon: image, title: peerName, permanent: false)) } if let (_, _, dateTitle) = options?.date { - tokens.append(SearchBarToken(id: ChatListTokenId.date.rawValue, icon: UIImage(bundleImageName: "Chat List/Search/Calendar"), title: dateTitle)) + tokens.append(SearchBarToken(id: ChatListTokenId.date.rawValue, icon: UIImage(bundleImageName: "Chat List/Search/Calendar"), title: dateTitle, permanent: false)) self.suggestedDates.set(.single([])) } @@ -524,7 +529,12 @@ public final class ChatListSearchContainerNode: SearchDisplayControllerContentNo self.paneContainerNode.requestSelectPane(key) self.updateSearchOptions(nil) self.searchTextUpdated(text: query ?? "") - self.setQuery?(nil, [], query ?? "") + + var tokens: [SearchBarToken] = [] + if self.groupId == .archive { + tokens.append(SearchBarToken(id: ChatListTokenId.archive.rawValue, icon: UIImage(bundleImageName: "Chat List/Search/Archive"), title: self.presentationData.strings.ChatList_Archive, permanent: true)) + } + self.setQuery?(nil, tokens, query ?? "") } override public func containerLayoutUpdated(_ layout: ContainerViewLayout, navigationBarHeight: CGFloat, transition: ContainedViewLayoutTransition) { diff --git a/submodules/FFMpegBinding/Public/FFMpegBinding/FrameConverter.h b/submodules/FFMpegBinding/Public/FFMpegBinding/FrameConverter.h new file mode 100755 index 0000000000..b4b0beeda0 --- /dev/null +++ b/submodules/FFMpegBinding/Public/FFMpegBinding/FrameConverter.h @@ -0,0 +1,9 @@ +#ifndef FrameConverter_h +#define FrameConverter_h + +#import +#import + +void fillDstPlane(uint8_t * _Nonnull dstPlane, uint8_t * _Nonnull srcPlane1, uint8_t * _Nonnull srcPlane2, size_t srcPlaneSize); + +#endif /* FrameConverter_h */ diff --git a/submodules/FFMpegBinding/Sources/FrameConverter.m b/submodules/FFMpegBinding/Sources/FrameConverter.m new file mode 100755 index 0000000000..6edb6494e2 --- /dev/null +++ b/submodules/FFMpegBinding/Sources/FrameConverter.m @@ -0,0 +1,8 @@ +#import + +void fillDstPlane(uint8_t * _Nonnull dstPlane, uint8_t * _Nonnull srcPlane1, uint8_t * _Nonnull srcPlane2, size_t srcPlaneSize) { + for (size_t i = 0; i < srcPlaneSize; i++){ + dstPlane[2 * i] = srcPlane1[i]; + dstPlane[2 * i + 1] = srcPlane2[i]; + } +} diff --git a/submodules/GalleryUI/Sources/Items/ChatImageGalleryItem.swift b/submodules/GalleryUI/Sources/Items/ChatImageGalleryItem.swift index eb44ee1691..ac3c045fa6 100644 --- a/submodules/GalleryUI/Sources/Items/ChatImageGalleryItem.swift +++ b/submodules/GalleryUI/Sources/Items/ChatImageGalleryItem.swift @@ -322,8 +322,10 @@ final class ChatImageGalleryItemNode: ZoomableContentGalleryItemNode { strongSelf.recognizedContentNode?.removeFromSupernode() if !results.isEmpty { let size = strongSelf.imageNode.bounds.size - let recognizedContentNode = RecognizedContentContainer(size: size, recognitions: results, presentationData: strongSelf.context.sharedContext.currentPresentationData.with { $0 }, present: { c, a in - strongSelf.galleryController()?.presentInGlobalOverlay(c, with: a) + let recognizedContentNode = RecognizedContentContainer(size: size, recognitions: results, presentationData: strongSelf.context.sharedContext.currentPresentationData.with { $0 }, present: { [weak self] c, a in + if let strongSelf = self { + strongSelf.galleryController()?.presentInGlobalOverlay(c, with: a) + } }, performAction: { [weak self] string, action in guard let strongSelf = self else { return diff --git a/submodules/ImageContentAnalysis/Sources/ImageContentAnalysis.swift b/submodules/ImageContentAnalysis/Sources/ImageContentAnalysis.swift index 13b5e5ca05..eb0bf757a8 100644 --- a/submodules/ImageContentAnalysis/Sources/ImageContentAnalysis.swift +++ b/submodules/ImageContentAnalysis/Sources/ImageContentAnalysis.swift @@ -302,6 +302,7 @@ private func recognizeContent(in image: UIImage) -> Signal<[RecognizedContent], let _ = barcodeResult.swap(mappedResults) completion() } + barcodeRequest.preferBackgroundProcessing = true requests.append(barcodeRequest) if #available(iOS 13.0, *) { @@ -310,6 +311,7 @@ private func recognizeContent(in image: UIImage) -> Signal<[RecognizedContent], let _ = textResult.swap(mappedResults) completion() } + textRequest.preferBackgroundProcessing = true textRequest.usesLanguageCorrection = true requests.append(textRequest) } else { @@ -320,7 +322,11 @@ private func recognizeContent(in image: UIImage) -> Signal<[RecognizedContent], try? handler.perform(requests) return ActionDisposable { - + if #available(iOS 13.0, *) { + for request in requests { + request.cancel() + } + } } } } else { diff --git a/submodules/MediaPlayer/Sources/FFMpegMediaVideoFrameDecoder.swift b/submodules/MediaPlayer/Sources/FFMpegMediaVideoFrameDecoder.swift index 22b1b863e0..d0471f68f8 100644 --- a/submodules/MediaPlayer/Sources/FFMpegMediaVideoFrameDecoder.swift +++ b/submodules/MediaPlayer/Sources/FFMpegMediaVideoFrameDecoder.swift @@ -56,30 +56,17 @@ public final class FFMpegMediaVideoFrameDecoder: MediaTrackFrameDecoder { private var delayedFrames: [MediaTrackFrame] = [] + private var dstPlane: (UnsafeMutablePointer, Int)? + public init(codecContext: FFMpegAVCodecContext) { self.codecContext = codecContext self.videoFrame = FFMpegAVFrame() - - /*var sourcePixelBufferOptions: [String: Any] = [:] - sourcePixelBufferOptions[kCVPixelBufferPixelFormatTypeKey as String] = kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange as NSNumber - - sourcePixelBufferOptions[kCVPixelBufferWidthKey as String] = codecContext.pointee.width as NSNumber - sourcePixelBufferOptions[kCVPixelBufferHeightKey as String] = codecContext.pointee.height as NSNumber - sourcePixelBufferOptions[kCVPixelBufferBytesPerRowAlignmentKey as String] = 128 as NSNumber - sourcePixelBufferOptions[kCVPixelBufferPlaneAlignmentKey as String] = 128 as NSNumber - - let ioSurfaceProperties = NSMutableDictionary() - ioSurfaceProperties["IOSurfaceIsGlobal"] = true as NSNumber - - sourcePixelBufferOptions[kCVPixelBufferIOSurfacePropertiesKey as String] = ioSurfaceProperties - - var pixelBufferPoolOptions: [String: Any] = [:] - pixelBufferPoolOptions[kCVPixelBufferPoolMinimumBufferCountKey as String] = bufferCount as NSNumber - - var pixelBufferPool: CVPixelBufferPool? - CVPixelBufferPoolCreate(kCFAllocatorDefault, pixelBufferPoolOptions as CFDictionary, sourcePixelBufferOptions as CFDictionary, &pixelBufferPool) - - self.pixelBufferPool = pixelBufferPool*/ + } + + deinit { + if let (dstPlane, _) = self.dstPlane { + free(dstPlane) + } } func decodeInternal(frame: MediaTrackDecodableFrame) { @@ -298,15 +285,18 @@ public final class FFMpegMediaVideoFrameDecoder: MediaTrackFrameDecoder { let srcPlaneSize = Int(frame.lineSize[1]) * Int(frame.height / 2) let dstPlaneSize = srcPlaneSize * 2 - let dstPlane = malloc(dstPlaneSize)!.assumingMemoryBound(to: UInt8.self) - defer { - free(dstPlane) - } - - for i in 0 ..< srcPlaneSize { - dstPlane[2 * i] = frame.data[1]![i] - dstPlane[2 * i + 1] = frame.data[2]![i] + let dstPlane: UnsafeMutablePointer + if let (existingDstPlane, existingDstPlaneSize) = self.dstPlane, existingDstPlaneSize == dstPlaneSize { + dstPlane = existingDstPlane + } else { + if let (existingDstPlane, _) = self.dstPlane { + free(existingDstPlane) + } + dstPlane = malloc(dstPlaneSize)!.assumingMemoryBound(to: UInt8.self) + self.dstPlane = (dstPlane, dstPlaneSize) } + + fillDstPlane(dstPlane, frame.data[1]!, frame.data[2]!, srcPlaneSize) let status = CVPixelBufferLockBaseAddress(pixelBuffer, []) if status != kCVReturnSuccess { diff --git a/submodules/SearchBarNode/Sources/SearchBarNode.swift b/submodules/SearchBarNode/Sources/SearchBarNode.swift index 2756d839c7..9dec26f70d 100644 --- a/submodules/SearchBarNode/Sources/SearchBarNode.swift +++ b/submodules/SearchBarNode/Sources/SearchBarNode.swift @@ -43,12 +43,14 @@ public struct SearchBarToken { public let icon: UIImage? public let title: String public let style: Style? + public let permanent: Bool - public init(id: AnyHashable, icon: UIImage?, title: String, style: Style? = nil) { + public init(id: AnyHashable, icon: UIImage?, title: String, style: Style? = nil, permanent: Bool) { self.id = id self.icon = icon self.title = title self.style = style + self.permanent = permanent } } @@ -106,6 +108,7 @@ private final class TokenNode: ASDisplayNode { } @objc private func tapGesture() { + self.tapped?() } @@ -264,7 +267,7 @@ private class SearchBarTextField: UITextField, UIScrollViewDelegate { if i < self.tokens.count - 1 && isSelected { hasSelected = true } - let isCollapsed = !isSelected && (i < self.tokens.count - 1 || hasSelected) + let isCollapsed = !isSelected && (token.permanent || (i < self.tokens.count - 1 || hasSelected)) tokenNode.update(theme: self.theme, token: token, isSelected: isSelected, isCollapsed: isCollapsed) } var removeKeys: [AnyHashable] = [] @@ -863,8 +866,10 @@ public class SearchBarNode: ASDisplayNode, UITextFieldDelegate { return false } if let index = strongSelf.textField.selectedTokenIndex { - strongSelf.tokens.remove(at: index) - strongSelf.tokensUpdated?(strongSelf.tokens) + if !strongSelf.tokens[index].permanent { + strongSelf.tokens.remove(at: index) + strongSelf.tokensUpdated?(strongSelf.tokens) + } return true } else if strongSelf.text.isEmpty { strongSelf.clearPressed() diff --git a/submodules/SearchUI/Sources/SearchDisplayController.swift b/submodules/SearchUI/Sources/SearchDisplayController.swift index 341bebff44..ed4dc6974f 100644 --- a/submodules/SearchUI/Sources/SearchDisplayController.swift +++ b/submodules/SearchUI/Sources/SearchDisplayController.swift @@ -70,15 +70,18 @@ public final class SearchDisplayController { self.contentNode.dismissInput = { [weak self] in self?.searchBar.deactivate(clear: false) } + + var isFirstTime = true self.contentNode.setQuery = { [weak self] prefix, tokens, query in if let strongSelf = self { strongSelf.searchBar.prefixString = prefix let previousTokens = strongSelf.searchBar.tokens strongSelf.searchBar.tokens = tokens strongSelf.searchBar.text = query - if previousTokens.count < tokens.count { + if previousTokens.count < tokens.count && !isFirstTime { strongSelf.searchBar.selectLastToken() } + isFirstTime = false } } if let placeholder = placeholder { diff --git a/submodules/SettingsUI/Sources/Themes/ThemeGridSearchContentNode.swift b/submodules/SettingsUI/Sources/Themes/ThemeGridSearchContentNode.swift index bbdd356531..540ec13610 100644 --- a/submodules/SettingsUI/Sources/Themes/ThemeGridSearchContentNode.swift +++ b/submodules/SettingsUI/Sources/Themes/ThemeGridSearchContentNode.swift @@ -681,7 +681,7 @@ final class ThemeGridSearchContentNode: SearchDisplayControllerContentNode { foregroundColor = .white strokeColor = color.displayColor } - tokens = [SearchBarToken(id: 0, icon: UIImage(bundleImageName: "Settings/WallpaperSearchColorIcon"), title: color.localizedString(strings: self.presentationData.strings), style: SearchBarToken.Style(backgroundColor: backgroundColor, foregroundColor: foregroundColor, strokeColor: strokeColor))] + tokens = [SearchBarToken(id: 0, icon: UIImage(bundleImageName: "Settings/WallpaperSearchColorIcon"), title: color.localizedString(strings: self.presentationData.strings), style: SearchBarToken.Style(backgroundColor: backgroundColor, foregroundColor: foregroundColor, strokeColor: strokeColor), permanent: false)] text = query placeholder = self.presentationData.strings.Wallpaper_SearchShort } diff --git a/submodules/TelegramCore/Sources/State/PendingMessageManager.swift b/submodules/TelegramCore/Sources/State/PendingMessageManager.swift index 5450e5743b..620c47927a 100644 --- a/submodules/TelegramCore/Sources/State/PendingMessageManager.swift +++ b/submodules/TelegramCore/Sources/State/PendingMessageManager.swift @@ -75,7 +75,7 @@ private func reasonForError(_ error: String) -> PendingMessageFailureReason? { } private final class PeerPendingMessagesSummaryContext { - var messageDeliveredSubscribers = Bag<(MessageId.Namespace) -> Void>() + var messageDeliveredSubscribers = Bag<((MessageId.Namespace, Bool)) -> Void>() var messageFailedSubscribers = Bag<(PendingMessageFailureReason) -> Void>() } @@ -231,25 +231,29 @@ public final class PendingMessageManager { } if !removedSecretMessageIds.isEmpty { - let _ = (self.postbox.transaction { transaction -> Set in + let _ = (self.postbox.transaction { transaction -> (Set, Bool) in + var silent = false var peerIdsWithDeliveredMessages = Set() for id in removedSecretMessageIds { if let message = transaction.getMessage(id) { if message.isSentOrAcknowledged { peerIdsWithDeliveredMessages.insert(id.peerId) + if message.muted { + silent = true + } } } } - return peerIdsWithDeliveredMessages + return (peerIdsWithDeliveredMessages, silent) } - |> deliverOn(self.queue)).start(next: { [weak self] peerIdsWithDeliveredMessages in + |> deliverOn(self.queue)).start(next: { [weak self] peerIdsWithDeliveredMessages, silent in guard let strongSelf = self else { return } for peerId in peerIdsWithDeliveredMessages { if let context = strongSelf.peerSummaryContexts[peerId] { for subscriber in context.messageDeliveredSubscribers.copyItems() { - subscriber(Namespaces.Message.Cloud) + subscriber((Namespaces.Message.Cloud, silent)) } } } @@ -1179,6 +1183,7 @@ public final class PendingMessageManager { } } + let silent = message.muted var namespace = Namespaces.Message.Cloud if let apiMessage = apiMessage, let id = apiMessage.id(namespace: message.scheduleTime != nil && message.scheduleTime == apiMessage.timestamp ? Namespaces.Message.ScheduledCloud : Namespaces.Message.Cloud) { namespace = id.namespace @@ -1190,7 +1195,7 @@ public final class PendingMessageManager { strongSelf.queue.async { if let context = strongSelf.peerSummaryContexts[message.id.peerId] { for subscriber in context.messageDeliveredSubscribers.copyItems() { - subscriber(namespace) + subscriber((namespace, silent)) } } } @@ -1199,9 +1204,13 @@ public final class PendingMessageManager { } private func applySentGroupMessages(postbox: Postbox, stateManager: AccountStateManager, messages: [Message], result: Api.Updates) -> Signal { + var silent = false var namespace = Namespaces.Message.Cloud if let message = messages.first, let apiMessage = result.messages.first, message.scheduleTime != nil && message.scheduleTime == apiMessage.timestamp { namespace = Namespaces.Message.ScheduledCloud + if message.muted { + silent = true + } } return applyUpdateGroupMessages(postbox: postbox, stateManager: stateManager, messages: messages, result: result) @@ -1210,7 +1219,7 @@ public final class PendingMessageManager { strongSelf.queue.async { if let message = messages.first, let context = strongSelf.peerSummaryContexts[message.id.peerId] { for subscriber in context.messageDeliveredSubscribers.copyItems() { - subscriber(namespace) + subscriber((namespace, silent)) } } } @@ -1218,7 +1227,7 @@ public final class PendingMessageManager { } } - public func deliveredMessageEvents(peerId: PeerId) -> Signal { + public func deliveredMessageEvents(peerId: PeerId) -> Signal<(namespace: MessageId.Namespace, silent: Bool), NoError> { return Signal { subscriber in let disposable = MetaDisposable() @@ -1231,8 +1240,8 @@ public final class PendingMessageManager { self.peerSummaryContexts[peerId] = summaryContext } - let index = summaryContext.messageDeliveredSubscribers.add({ namespace in - subscriber.putNext(namespace) + let index = summaryContext.messageDeliveredSubscribers.add({ namespace, silent in + subscriber.putNext((namespace, silent)) }) disposable.set(ActionDisposable { diff --git a/submodules/TelegramUI/Images.xcassets/Chat List/Search/Archive.imageset/Contents.json b/submodules/TelegramUI/Images.xcassets/Chat List/Search/Archive.imageset/Contents.json new file mode 100644 index 0000000000..b5c9067a42 --- /dev/null +++ b/submodules/TelegramUI/Images.xcassets/Chat List/Search/Archive.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "archive_18.pdf", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/submodules/TelegramUI/Images.xcassets/Chat List/Search/Archive.imageset/archive_18.pdf b/submodules/TelegramUI/Images.xcassets/Chat List/Search/Archive.imageset/archive_18.pdf new file mode 100644 index 0000000000..ef7c2a13f2 --- /dev/null +++ b/submodules/TelegramUI/Images.xcassets/Chat List/Search/Archive.imageset/archive_18.pdf @@ -0,0 +1,109 @@ +%PDF-1.7 + +1 0 obj + << >> +endobj + +2 0 obj + << /Length 3 0 R >> +stream +/DeviceRGB CS +/DeviceRGB cs +q +1.000000 0.000000 -0.000000 1.000000 3.000000 11.625000 cm +0.000000 0.000000 0.000000 scn +0.000000 1.500000 m +0.000000 1.848739 -0.000000 2.023109 0.038333 2.166172 c +0.142359 2.554400 0.445600 2.857641 0.833829 2.961667 c +0.976891 3.000000 1.151261 3.000000 1.500000 3.000000 c +10.500000 3.000000 l +10.848740 3.000000 11.023109 3.000000 11.166171 2.961667 c +11.554400 2.857641 11.857641 2.554400 11.961666 2.166172 c +12.000000 2.023109 12.000000 1.848739 12.000000 1.500000 c +12.000000 1.500000 l +12.000000 1.151261 12.000000 0.976891 11.961666 0.833829 c +11.857641 0.445600 11.554400 0.142359 11.166171 0.038333 c +11.023109 0.000000 10.848740 0.000000 10.500000 0.000000 c +1.500000 0.000000 l +1.151261 0.000000 0.976891 0.000000 0.833829 0.038333 c +0.445600 0.142359 0.142359 0.445600 0.038333 0.833829 c +-0.000000 0.976891 0.000000 1.151261 0.000000 1.500000 c +0.000000 1.500000 l +h +f +n +Q +q +1.000000 0.000000 -0.000000 1.000000 3.750000 3.375000 cm +0.000000 0.000000 0.000000 scn +0.000000 3.200033 m +0.000000 7.625000 l +10.500000 7.625000 l +10.500000 3.200035 l +10.500000 2.079930 10.500000 1.519877 10.282013 1.092054 c +10.090266 0.715730 9.784306 0.409769 9.407981 0.218022 c +8.980158 0.000035 8.420105 0.000035 7.300000 0.000035 c +3.200000 0.000035 l +2.079895 0.000035 1.519843 0.000035 1.092019 0.218022 c +0.715695 0.409769 0.409734 0.715730 0.217987 1.092054 c +0.000000 1.519877 0.000000 2.079929 0.000000 3.200033 c +h +3.000000 6.500000 m +2.723858 6.500000 2.500000 6.276142 2.500000 6.000000 c +2.500000 5.723858 2.723858 5.500000 3.000000 5.500000 c +7.500000 5.500000 l +7.776143 5.500000 8.000000 5.723858 8.000000 6.000000 c +8.000000 6.276142 7.776143 6.500000 7.500000 6.500000 c +3.000000 6.500000 l +h +f* +n +Q + +endstream +endobj + +3 0 obj + 1750 +endobj + +4 0 obj + << /Annots [] + /Type /Page + /MediaBox [ 0.000000 0.000000 18.000000 18.000000 ] + /Resources 1 0 R + /Contents 2 0 R + /Parent 5 0 R + >> +endobj + +5 0 obj + << /Kids [ 4 0 R ] + /Count 1 + /Type /Pages + >> +endobj + +6 0 obj + << /Pages 5 0 R + /Type /Catalog + >> +endobj + +xref +0 7 +0000000000 65535 f +0000000010 00000 n +0000000034 00000 n +0000001840 00000 n +0000001863 00000 n +0000002036 00000 n +0000002110 00000 n +trailer +<< /ID [ (some) (id) ] + /Root 6 0 R + /Size 7 +>> +startxref +2169 +%%EOF \ No newline at end of file diff --git a/submodules/TelegramUI/Sources/ChatController.swift b/submodules/TelegramUI/Sources/ChatController.swift index 6137ced5ba..386e282359 100644 --- a/submodules/TelegramUI/Sources/ChatController.swift +++ b/submodules/TelegramUI/Sources/ChatController.swift @@ -4879,6 +4879,9 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G allPeers?.insert(currentAccountPeer, at: 0) } } + if allPeers?.count == 1 { + allPeers = nil + } strongSelf.updateChatPresentationInterfaceState(animated: true, interactive: false, { return $0.updatedSendAsPeers(allPeers) }) @@ -7915,10 +7918,10 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G } self.sentMessageEventsDisposable.set((self.context.account.pendingMessageManager.deliveredMessageEvents(peerId: peerId) - |> deliverOnMainQueue).start(next: { [weak self] namespace in + |> deliverOnMainQueue).start(next: { [weak self] namespace, silent in if let strongSelf = self { let inAppNotificationSettings = strongSelf.context.sharedContext.currentInAppNotificationSettings.with { $0 } - if inAppNotificationSettings.playSounds { + if inAppNotificationSettings.playSounds && !silent { serviceSoundManager.playMessageDeliveredSound() } if strongSelf.presentationInterfaceState.subject != .scheduledMessages && namespace == Namespaces.Message.ScheduledCloud { diff --git a/submodules/TelegramUI/Sources/ChatMessageSelectionInputPanelNode.swift b/submodules/TelegramUI/Sources/ChatMessageSelectionInputPanelNode.swift index e01f11d8c1..4d04335615 100644 --- a/submodules/TelegramUI/Sources/ChatMessageSelectionInputPanelNode.swift +++ b/submodules/TelegramUI/Sources/ChatMessageSelectionInputPanelNode.swift @@ -132,6 +132,9 @@ final class ChatMessageSelectionInputPanelNode: ChatInputPanelNode { } @objc func forwardButtonPressed() { + if let _ = self.presentationInterfaceState?.renderedPeer?.peer as? TelegramSecretChat { + return + } if let actions = self.actions, actions.isCopyProtected { self.interfaceInteraction?.displayCopyProtectionTip(self.forwardButton, false) } else { @@ -140,6 +143,9 @@ final class ChatMessageSelectionInputPanelNode: ChatInputPanelNode { } @objc func shareButtonPressed() { + if let _ = self.presentationInterfaceState?.renderedPeer?.peer as? TelegramSecretChat { + return + } if let actions = self.actions, actions.isCopyProtected { self.interfaceInteraction?.displayCopyProtectionTip(self.shareButton, true) } else { diff --git a/submodules/TelegramUI/Sources/ChatSearchNavigationContentNode.swift b/submodules/TelegramUI/Sources/ChatSearchNavigationContentNode.swift index f2dce4fdbf..4c2aaf455e 100644 --- a/submodules/TelegramUI/Sources/ChatSearchNavigationContentNode.swift +++ b/submodules/TelegramUI/Sources/ChatSearchNavigationContentNode.swift @@ -112,7 +112,7 @@ final class ChatSearchNavigationContentNode: NavigationBarContentNode { self.searchBar.prefixString = NSAttributedString(string: strings.Conversation_SearchByName_Prefix, font: searchBarFont, textColor: theme.rootController.navigationSearchBar.inputTextColor) self.searchBar.placeholderString = nil case let .member(peer): - self.searchBar.tokens = [SearchBarToken(id: peer.id, icon: UIImage(bundleImageName: "Chat List/Search/User"), title: EnginePeer(peer).compactDisplayTitle)] + self.searchBar.tokens = [SearchBarToken(id: peer.id, icon: UIImage(bundleImageName: "Chat List/Search/User"), title: EnginePeer(peer).compactDisplayTitle, permanent: false)] self.searchBar.prefixString = nil self.searchBar.placeholderString = nil } diff --git a/submodules/TelegramUI/Sources/OverlayPlayerControlsNode.swift b/submodules/TelegramUI/Sources/OverlayPlayerControlsNode.swift index 30c4063095..84c70e68e0 100644 --- a/submodules/TelegramUI/Sources/OverlayPlayerControlsNode.swift +++ b/submodules/TelegramUI/Sources/OverlayPlayerControlsNode.swift @@ -79,7 +79,7 @@ private func stringsForDisplayData(_ data: SharedMediaPlaybackDisplayData?, pres } titleString = NSAttributedString(string: titleText, font: titleFont, textColor: presentationData.theme.list.itemPrimaryTextColor) - descriptionString = NSAttributedString(string: subtitleText, font: descriptionFont, textColor: presentationData.theme.list.itemSecondaryTextColor) + descriptionString = NSAttributedString(string: subtitleText, font: descriptionFont, textColor: hasArtist ? presentationData.theme.list.itemAccentColor : presentationData.theme.list.itemSecondaryTextColor) } return (titleString, descriptionString, hasArtist) diff --git a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift index f6c28de76b..5ccb99dd7d 100644 --- a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift +++ b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift @@ -6444,7 +6444,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate } strongSelf.deleteMessages(messageIds: nil) }, shareMessages: { [weak self] in - guard let strongSelf = self, let messageIds = strongSelf.state.selectedMessageIds, !messageIds.isEmpty else { + guard let strongSelf = self, let messageIds = strongSelf.state.selectedMessageIds, !messageIds.isEmpty, strongSelf.peerId.namespace != Namespaces.Peer.SecretChat else { return } let _ = (strongSelf.context.account.postbox.transaction { transaction -> [Message] in @@ -6468,7 +6468,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate } }) }, forwardMessages: { [weak self] in - guard let strongSelf = self else { + guard let strongSelf = self, strongSelf.peerId.namespace != Namespaces.Peer.SecretChat else { return } strongSelf.forwardMessages(messageIds: nil) diff --git a/submodules/TelegramUI/Sources/PeerInfoGifPaneNode.swift b/submodules/TelegramUI/Sources/PeerInfoGifPaneNode.swift index 0552a6691a..d16b75a67f 100644 --- a/submodules/TelegramUI/Sources/PeerInfoGifPaneNode.swift +++ b/submodules/TelegramUI/Sources/PeerInfoGifPaneNode.swift @@ -875,8 +875,11 @@ final class PeerInfoGifPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScrollViewDe animationTimer.start() self.statusPromise.set(context.account.postbox.combinedView(keys: [PostboxViewKey.historyTagSummaryView(tag: tagMaskForType(self.contentType), peerId: peerId, namespace: Namespaces.Message.Cloud)]) - |> map { views -> PeerInfoStatusData? in - let count: Int32 = (views.views[PostboxViewKey.historyTagSummaryView(tag: tagMaskForType(self.contentType), peerId: peerId, namespace: Namespaces.Message.Cloud)] as? MessageHistoryTagSummaryView)?.count ?? 0 + |> map { [weak self] views -> PeerInfoStatusData? in + guard let strongSelf = self else { + return nil + } + let count: Int32 = (views.views[PostboxViewKey.historyTagSummaryView(tag: tagMaskForType(strongSelf.contentType), peerId: peerId, namespace: Namespaces.Message.Cloud)] as? MessageHistoryTagSummaryView)?.count ?? 0 if count == 0 { return nil } diff --git a/submodules/TelegramUI/Sources/PeerMessagesMediaPlaylist.swift b/submodules/TelegramUI/Sources/PeerMessagesMediaPlaylist.swift index 44839c6c05..996269fd3a 100644 --- a/submodules/TelegramUI/Sources/PeerMessagesMediaPlaylist.swift +++ b/submodules/TelegramUI/Sources/PeerMessagesMediaPlaylist.swift @@ -114,7 +114,7 @@ final class MessageMediaPlaylistItem: SharedMediaPlaylistItem { albumArt = SharedMediaPlaybackAlbumArt(thumbnailResource: ExternalMusicAlbumArtResource(title: updatedTitle ?? "", performer: updatedPerformer ?? "", isThumbnail: true), fullSizeResource: ExternalMusicAlbumArtResource(title: updatedTitle ?? "", performer: updatedPerformer ?? "", isThumbnail: false)) } - return SharedMediaPlaybackDisplayData.music(title: updatedTitle, performer: updatedPerformer, albumArt: albumArt, long: duration > 60 * 20) + return SharedMediaPlaybackDisplayData.music(title: updatedTitle, performer: updatedPerformer, albumArt: albumArt, long: CGFloat(duration) > 10.0 * 60.0) } case let .Video(_, _, flags): if flags.contains(.instantRoundVideo) { diff --git a/submodules/TelegramUI/Sources/StickerPaneTrendingListGridItem.swift b/submodules/TelegramUI/Sources/StickerPaneTrendingListGridItem.swift index f023e78890..a6616e5e59 100644 --- a/submodules/TelegramUI/Sources/StickerPaneTrendingListGridItem.swift +++ b/submodules/TelegramUI/Sources/StickerPaneTrendingListGridItem.swift @@ -528,7 +528,7 @@ class StickerPaneTrendingListGridItemNode: GridItemNode { let titleFrame = CGRect(origin: CGPoint(x: params.leftInset + leftInset, y: topOffset), size: titleLayout.size) let dismissButtonSize = CGSize(width: 12.0, height: 12.0) - self.dismissButtonNode.frame = CGRect(origin: CGPoint(x: params.width - params.rightInset - rightInset - dismissButtonSize.width, y: topOffset - 1.0), size: dismissButtonSize) + self.dismissButtonNode.frame = CGRect(origin: CGPoint(x: params.width - params.rightInset - rightInset - dismissButtonSize.width + 1.0, y: topOffset - 1.0), size: dismissButtonSize) self.dismissButtonNode.isHidden = item.dismiss == nil self.titleNode.frame = titleFrame }