diff --git a/submodules/AudioBlob/Sources/BlobView.swift b/submodules/AudioBlob/Sources/BlobView.swift index 11a8a47ae4..559fb39d2d 100644 --- a/submodules/AudioBlob/Sources/BlobView.swift +++ b/submodules/AudioBlob/Sources/BlobView.swift @@ -55,6 +55,8 @@ public final class VoiceBlobView: UIView, TGModernConversationInputMicButtonDeco private(set) var isAnimating = false + public var hitTestSize: CGFloat? + public typealias BlobRange = (min: CGFloat, max: CGFloat) public init( @@ -224,6 +226,15 @@ public final class VoiceBlobView: UIView, TGModernConversationInputMicButtonDeco self.updateBlobsState() } + + override public func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? { + if let hitTestSize = self.hitTestSize { + if !CGSize(width: hitTestSize, height: hitTestSize).centered(in: self.bounds).contains(point) { + return nil + } + } + return super.hitTest(point, with: event) + } } final class BlobNode: ASDisplayNode { diff --git a/submodules/Postbox/Sources/PeerChatTopIndexableMessageIds.swift b/submodules/Postbox/Sources/PeerChatTopIndexableMessageIds.swift index 84e6c9969d..f4e0c55a33 100644 --- a/submodules/Postbox/Sources/PeerChatTopIndexableMessageIds.swift +++ b/submodules/Postbox/Sources/PeerChatTopIndexableMessageIds.swift @@ -83,12 +83,14 @@ final class PeerChatTopTaggedMessageIdsTable: Table { let currentTopMessageId = self.get(peerId: message.id.peerId, threadId: message.threadId, namespace: message.id.namespace) if currentTopMessageId == nil || currentTopMessageId! < message.id { self.set(peerId: message.id.peerId, threadId: message.threadId, namespace: message.id.namespace, id: message.id) + self.set(peerId: message.id.peerId, threadId: 0, namespace: message.id.namespace, id: message.id) } } case let .Remove(indices): for (index, _, threadId) in indices { if let messageId = self.get(peerId: index.id.peerId, threadId: threadId, namespace: index.id.namespace), index.id == messageId { self.set(peerId: index.id.peerId, threadId: threadId, namespace: index.id.namespace, id: nil) + self.set(peerId: index.id.peerId, threadId: 0, namespace: index.id.namespace, id: nil) } } default: @@ -110,8 +112,12 @@ final class PeerChatTopTaggedMessageIdsTable: Table { if let maybeMessageId = maybeMessageId { var messageIdId: Int32 = maybeMessageId.id self.valueBox.set(self.table, key: self.key(combinedId: record.peerAndThreadId, namespace: record.namespace), value: MemoryBuffer(memory: &messageIdId, capacity: 4, length: 4, freeWhenDone: false)) + if record.peerAndThreadId.threadId != nil { + self.valueBox.set(self.table, key: self.key(combinedId: PeerAndThreadId(peerId: record.peerAndThreadId.peerId, threadId: 0), namespace: record.namespace), value: MemoryBuffer(memory: &messageIdId, capacity: 4, length: 4, freeWhenDone: false)) + } } else { self.valueBox.remove(self.table, key: self.key(combinedId: record.peerAndThreadId, namespace: record.namespace), secure: false) + self.valueBox.remove(self.table, key: self.key(combinedId: PeerAndThreadId(peerId: record.peerAndThreadId.peerId, threadId: 0), namespace: record.namespace), secure: false) } } } diff --git a/submodules/Postbox/Sources/Postbox.swift b/submodules/Postbox/Sources/Postbox.swift index 396fe12a46..232bb7dfe4 100644 --- a/submodules/Postbox/Sources/Postbox.swift +++ b/submodules/Postbox/Sources/Postbox.swift @@ -3507,7 +3507,13 @@ final class PostboxImpl { } if let peerId = mainPeerIdForTopTaggedMessages { for namespace in topTaggedMessageIdNamespaces { - if let messageId = self.peerChatTopTaggedMessageIdsTable.get(peerId: peerId.peerId, threadId: peerId.threadId, namespace: namespace) { + var messageId: MessageId? + messageId = self.peerChatTopTaggedMessageIdsTable.get(peerId: peerId.peerId, threadId: peerId.threadId, namespace: namespace) + if messageId == nil && peerId.threadId == nil { + messageId = self.peerChatTopTaggedMessageIdsTable.get(peerId: peerId.peerId, threadId: 0, namespace: namespace) + } + + if let messageId { if let index = self.messageHistoryIndexTable.getIndex(messageId) { if let message = self.messageHistoryTable.getMessage(index) { topTaggedMessages[namespace] = MessageHistoryTopTaggedMessage.intermediate(message) diff --git a/submodules/TelegramStringFormatting/Sources/PeerDisplayName.swift b/submodules/TelegramStringFormatting/Sources/PeerDisplayName.swift index 21c26624cf..cb12788532 100644 --- a/submodules/TelegramStringFormatting/Sources/PeerDisplayName.swift +++ b/submodules/TelegramStringFormatting/Sources/PeerDisplayName.swift @@ -12,7 +12,7 @@ public func stringForFullAuthorName(message: EngineMessage, strings: Presentatio } else if author.isDeleted { authorName = strings.User_DeletedAccount } else { - authorName = author.compactDisplayTitle + authorName = author.displayTitle(strings: strings, displayOrder: nameDisplayOrder) } if let peer = message.peers[message.id.peerId].flatMap(EnginePeer.init), author.id != peer.id { authorString = [authorName, peer.displayTitle(strings: strings, displayOrder: nameDisplayOrder)] diff --git a/submodules/TelegramUI/Components/ChatTextInputMediaRecordingButton/Sources/ChatTextInputMediaRecordingButton.swift b/submodules/TelegramUI/Components/ChatTextInputMediaRecordingButton/Sources/ChatTextInputMediaRecordingButton.swift index 5dd97ec41b..88cf765598 100644 --- a/submodules/TelegramUI/Components/ChatTextInputMediaRecordingButton/Sources/ChatTextInputMediaRecordingButton.swift +++ b/submodules/TelegramUI/Components/ChatTextInputMediaRecordingButton/Sources/ChatTextInputMediaRecordingButton.swift @@ -322,6 +322,7 @@ public final class ChatTextInputMediaRecordingButton: TGModernConversationInputM ) let theme = self.hidesOnLock ? defaultDarkColorPresentationTheme : self.theme blobView.setColor(theme.chat.inputPanel.actionControlFillColor) + blobView.hitTestSize = 110.0 self.micDecorationValue = blobView return blobView } diff --git a/submodules/TelegramUI/Components/ContextControllerImpl/Sources/ContextControllerActionsStackNode.swift b/submodules/TelegramUI/Components/ContextControllerImpl/Sources/ContextControllerActionsStackNode.swift index cc6168d58e..1a1e7bb9e4 100644 --- a/submodules/TelegramUI/Components/ContextControllerImpl/Sources/ContextControllerActionsStackNode.swift +++ b/submodules/TelegramUI/Components/ContextControllerImpl/Sources/ContextControllerActionsStackNode.swift @@ -827,6 +827,17 @@ public final class ContextControllerActionsListStackItem: ContextControllerActio self.addSubnode(item.node) } + if let tipSignal = tipSignal { + self.tipDisposable = (tipSignal + |> deliverOnMainQueue).start(next: { [weak self] tip in + guard let strongSelf = self else { + return + } + strongSelf.tip = tip + requestUpdate(.immediate) + }).strict() + } + requestUpdateAction = { [weak self] id, action in guard let self else { return @@ -981,17 +992,26 @@ public final class ContextControllerActionsListStackItem: ContextControllerActio if let tip = self.tip { let tipNode: InnerTextSelectionTipContainerNode var tipTransition = transition - if let current = self.tipNode { + if let current = self.tipNode, current.tip == tip { tipNode = current } else { tipTransition = .immediate + + let previousTipNode = self.tipNode tipNode = InnerTextSelectionTipContainerNode(presentationData: presentationData, tip: tip, isInline: true) - self.addSubnode(tipNode) - self.tipNode = tipNode let getController = self.getController tipNode.requestDismiss = { completion in getController()?.dismiss(completion: completion) } + self.addSubnode(tipNode) + self.tipNode = tipNode + + if let previousTipNode = previousTipNode { + previousTipNode.animateTransitionInside(other: tipNode) + previousTipNode.removeFromSupernode() + + tipNode.animateContentIn() + } } let tipSeparatorNode: ContextControllerActionsListSeparatorItemNode @@ -1004,12 +1024,15 @@ public final class ContextControllerActionsListStackItem: ContextControllerActio } let (tipSeparatorMinSize, tipSeparatorApply) = tipSeparatorNode.update(presentationData: presentationData, constrainedSize: CGSize(width: combinedSize.width, height: 10.0)) + tipSeparatorNode.isHidden = self.itemNodes.isEmpty let tipSeparatorSize = CGSize(width: combinedSize.width, height: tipSeparatorMinSize.height) tipSeparatorApply(tipSeparatorSize, tipTransition) let tipSeparatorFrame = CGRect(origin: nextItemOrigin, size: tipSeparatorSize) tipTransition.updateFrame(node: tipSeparatorNode, frame: tipSeparatorFrame) - nextItemOrigin.y += tipSeparatorSize.height - combinedSize.height += tipSeparatorSize.height + if !tipSeparatorNode.isHidden { + nextItemOrigin.y += tipSeparatorSize.height + combinedSize.height += tipSeparatorSize.height + } let tipSize = tipNode.updateLayout(widthClass: .compact, presentation: .inline, width: combinedSize.width, transition: tipTransition) let tipFrame = CGRect(origin: nextItemOrigin, size: tipSize) diff --git a/submodules/TelegramUI/Components/ShareExtensionContext/BUILD b/submodules/TelegramUI/Components/ShareExtensionContext/BUILD index 8a0c3ecf8d..becdf07725 100644 --- a/submodules/TelegramUI/Components/ShareExtensionContext/BUILD +++ b/submodules/TelegramUI/Components/ShareExtensionContext/BUILD @@ -39,6 +39,7 @@ swift_library( "//submodules/TelegramUI/Components/TelegramAccountAuxiliaryMethods", "//submodules/TelegramUI/Components/PeerSelectionController", "//submodules/TelegramUI/Components/ContextMenuScreen", + "//submodules/TelegramUI/Components/NavigationBarImpl", ], visibility = [ "//visibility:public", diff --git a/submodules/TelegramUI/Components/ShareExtensionContext/Sources/ShareExtensionContext.swift b/submodules/TelegramUI/Components/ShareExtensionContext/Sources/ShareExtensionContext.swift index d491abba5a..9d236de495 100644 --- a/submodules/TelegramUI/Components/ShareExtensionContext/Sources/ShareExtensionContext.swift +++ b/submodules/TelegramUI/Components/ShareExtensionContext/Sources/ShareExtensionContext.swift @@ -31,6 +31,7 @@ import TelegramUIDeclareEncodables import TelegramAccountAuxiliaryMethods import PeerSelectionController import ContextMenuScreen +import NavigationBarImpl private var installedSharedLogger = false @@ -194,6 +195,10 @@ public class ShareRootControllerImpl { public init(initializationData: ShareRootControllerInitializationData, getExtensionContext: @escaping () -> NSExtensionContext?) { self.initializationData = initializationData self.getExtensionContext = getExtensionContext + + defaultNavigationBarImpl = { presentationData in + return NavigationBarImpl(presentationData: presentationData) + } } deinit { diff --git a/submodules/TelegramUI/Sources/ChatHistoryListNode.swift b/submodules/TelegramUI/Sources/ChatHistoryListNode.swift index 3b886be589..38d8072019 100644 --- a/submodules/TelegramUI/Sources/ChatHistoryListNode.swift +++ b/submodules/TelegramUI/Sources/ChatHistoryListNode.swift @@ -2324,8 +2324,12 @@ public final class ChatHistoryListNodeImpl: ListView, ChatHistoryNode, ChatHisto } var keyboardButtonsMessage = view.topTaggedMessages.first - if keyboardButtonsMessage != nil && keyboardButtonsMessage?.threadId != chatLocation.threadId { - keyboardButtonsMessage = nil + if let keyboardButtonsMessageValue = keyboardButtonsMessage { + if keyboardButtonsMessageValue.threadId != chatLocation.threadId { + if chatLocation.threadId != nil { + keyboardButtonsMessage = nil + } + } } if let keyboardButtonsMessageValue = keyboardButtonsMessage, keyboardButtonsMessageValue.isRestricted(platform: "ios", contentSettings: context.currentContentSettings.with({ $0 })) { keyboardButtonsMessage = nil diff --git a/third-party/libyuv/BUILD b/third-party/libyuv/BUILD index 402dc97822..14e2255c5e 100644 --- a/third-party/libyuv/BUILD +++ b/third-party/libyuv/BUILD @@ -25,6 +25,7 @@ arch_specific_cflags = select({ "@build_bazel_rules_apple//apple:ios_arm64": common_flags + arm64_specific_flags, "//build-system:ios_sim_arm64": common_flags + arm64_specific_flags, "@build_bazel_rules_apple//apple:ios_x86_64": common_flags + x86_64_specific_flags, + "//conditions:default": common_flags, }) cc_library( diff --git a/third-party/opus/BUILD b/third-party/opus/BUILD index 5ea4abdd86..873cdda53d 100644 --- a/third-party/opus/BUILD +++ b/third-party/opus/BUILD @@ -29,6 +29,10 @@ genrule( BUILD_ARCH="sim_arm64" elif [ "$(TARGET_CPU)" == "ios_x86_64" ]; then BUILD_ARCH="x86_64" + elif [ "$(TARGET_CPU)" == "k8" ] || [ "$(TARGET_CPU)" == "x86_64" ]; then + BUILD_ARCH="linux_x86_64" + elif [ "$(TARGET_CPU)" == "aarch64" ] || [ "$(TARGET_CPU)" == "arm64" ]; then + BUILD_ARCH="linux_arm64" else echo "Unsupported architecture $(TARGET_CPU)" fi @@ -63,6 +67,20 @@ cc_library( srcs = [":Public/opus/lib/lib" + x + ".a" for x in libs], ) +cc_library( + name = "opus_cc", + hdrs = [":Public/opus/" + x for x in headers], + includes = [ + "Public", + ], + deps = [ + ":opus_lib", + ], + visibility = [ + "//visibility:public", + ], +) + objc_library( name = "opus", module_name = "opus", diff --git a/third-party/opus/build-opus-bazel.sh b/third-party/opus/build-opus-bazel.sh index 60c2246a61..bb79c9efc6 100755 --- a/third-party/opus/build-opus-bazel.sh +++ b/third-party/opus/build-opus-bazel.sh @@ -12,8 +12,6 @@ OPT_CFLAGS="-Os -g" OPT_LDFLAGS="" OPT_CONFIG_ARGS="" -DEVELOPER=`xcode-select -print-path` - OUTPUTDIR="$BUILD_DIR/Public" # where we will keep our sources and build from. @@ -28,7 +26,27 @@ mkdir -p $INTERDIR tar zxf "$BUILD_DIR/$SOURCE_CODE_ARCHIVE" -C $SRCDIR cd "${SRCDIR}/opus-"* -if [ "${ARCH}" == "x86_64" ]; then +if [ "${ARCH}" = "linux_x86_64" ] || [ "${ARCH}" = "linux_arm64" ]; then + mkdir -p "${INTERDIR}" + + # Keep it simple and portable for container builds. + ./configure \ + --disable-shared \ + --enable-static \ + --with-pic \ + --disable-extra-programs \ + --disable-doc \ + --disable-asm \ + --enable-intrinsics \ + ${OPT_CONFIG_ARGS} \ + --prefix="${INTERDIR}" \ + CFLAGS="$CFLAGS ${OPT_CFLAGS} -fPIC" \ + LDFLAGS="$LDFLAGS ${OPT_LDFLAGS}" + + make -j"$(getconf _NPROCESSORS_ONLN || echo 4)" + make install + exit 0 +elif [ "${ARCH}" == "x86_64" ]; then PLATFORM="iphonesimulator" EXTRA_CFLAGS="-arch ${ARCH}" EXTRA_CONFIG="--host=x86_64-apple-darwin" diff --git a/third-party/webrtc/absl/BUILD b/third-party/webrtc/absl/BUILD index 62f1d938ff..5ab49294ac 100644 --- a/third-party/webrtc/absl/BUILD +++ b/third-party/webrtc/absl/BUILD @@ -355,9 +355,15 @@ absl_sources = [ "absl/types/bad_variant_access.cc", ] +absl_inc_files = [ + f + for f in glob(["absl/**/*.inc"]) + if f not in absl_headers +] + cc_library( name = "absl", - hdrs = absl_headers, + hdrs = absl_headers + absl_inc_files, srcs = absl_sources, cxxopts = [ "-std=c++17", diff --git a/third-party/webrtc/crc32c/BUILD b/third-party/webrtc/crc32c/BUILD index 52d9138c7e..f32c5e6120 100644 --- a/third-party/webrtc/crc32c/BUILD +++ b/third-party/webrtc/crc32c/BUILD @@ -6,6 +6,7 @@ arch_specific_crc32c_sources = select({ "//build-system:ios_sim_arm64": [ "third_party/crc32c/src/crc32c_arm64.cc", ], + "//conditions:default": [], }) crc32c_sources = ["third_party/crc32c/src/" + x for x in [ diff --git a/third-party/webrtc/libsrtp/BUILD b/third-party/webrtc/libsrtp/BUILD index bc29d57cdb..624b70c184 100644 --- a/third-party/webrtc/libsrtp/BUILD +++ b/third-party/webrtc/libsrtp/BUILD @@ -37,6 +37,7 @@ arm64_specific_flags = [ arch_specific_cflags = select({ "@build_bazel_rules_apple//apple:ios_arm64": common_flags + arm64_specific_flags, "//build-system:ios_sim_arm64": common_flags + arm64_specific_flags, + "//conditions:default": [], }) optimization_flags = select({