diff --git a/build-system/Make/Make.py b/build-system/Make/Make.py index de54c8d46b..e8ce6321d9 100644 --- a/build-system/Make/Make.py +++ b/build-system/Make/Make.py @@ -123,6 +123,16 @@ class BazelCommandLine: # Build single-architecture binaries. It is almost 2 times faster is 32-bit support is not required. '--ios_multi_cpus=arm64', + # Always build universal Watch binaries. + '--watchos_cpus=armv7k,arm64_32' + ] + self.common_debug_args + elif configuration == 'debug_armv7': + self.configuration_args = [ + # bazel debug build configuration + '-c', 'dbg', + + '--ios_multi_cpus=armv7', + # Always build universal Watch binaries. '--watchos_cpus=armv7k,arm64_32' ] + self.common_debug_args @@ -465,6 +475,7 @@ if __name__ == '__main__': '--configuration', choices=[ 'debug_arm64', + 'debug_armv7', 'release_arm64', 'release_universal' ], diff --git a/submodules/ChatImportUI/Sources/ChatImportActivityScreen.swift b/submodules/ChatImportUI/Sources/ChatImportActivityScreen.swift index 02dd1bc03d..c7b4cff179 100644 --- a/submodules/ChatImportUI/Sources/ChatImportActivityScreen.swift +++ b/submodules/ChatImportUI/Sources/ChatImportActivityScreen.swift @@ -17,9 +17,15 @@ import ConfettiEffect import TelegramUniversalVideoContent public final class ChatImportActivityScreen: ViewController { + enum ImportError { + case generic + case chatAdminRequired + case invalidChatType + } + private enum State { case progress(CGFloat) - case error + case error(ImportError) case done } @@ -213,8 +219,17 @@ public final class ChatImportActivityScreen: ViewController { switch self.state { case .progress: self.statusText.attributedText = NSAttributedString(string: "Please keep this window open\nduring the import.", font: Font.regular(17.0), textColor: self.presentationData.theme.list.itemSecondaryTextColor) - case .error: - self.statusText.attributedText = NSAttributedString(string: "An error occurred.", font: Font.regular(17.0), textColor: self.presentationData.theme.list.itemDestructiveColor) + case let .error(error): + let errorText: String + switch error { + case .chatAdminRequired: + errorText = "You need to be an admin." + case .invalidChatType: + errorText = "You can't import this history in this type of chat." + case .generic: + errorText = "An error occurred." + } + self.statusText.attributedText = NSAttributedString(string: errorText, font: Font.regular(17.0), textColor: self.presentationData.theme.list.itemDestructiveColor) case .done: self.statusText.attributedText = NSAttributedString(string: "This chat has been imported\nsuccessfully.", font: Font.semibold(17.0), textColor: self.presentationData.theme.list.itemPrimaryTextColor) } @@ -427,10 +442,6 @@ public final class ChatImportActivityScreen: ViewController { } private func beginImport() { - enum ImportError { - case generic - } - for (key, value) in self.pendingEntries { self.pendingEntries[key] = (value.0, 0.0) } @@ -459,8 +470,15 @@ public final class ChatImportActivityScreen: ViewController { } return ChatHistoryImport.initSession(account: context.account, peerId: peerId, file: mainEntry, mediaCount: Int32(otherEntries.count)) - |> mapError { _ -> ImportError in - return .generic + |> mapError { error -> ImportError in + switch error { + case .chatAdminRequired: + return .chatAdminRequired + case .invalidChatType: + return .invalidChatType + case .generic: + return .generic + } } } |> mapToSignal { session -> Signal<(String, Float), ImportError> in @@ -531,11 +549,11 @@ public final class ChatImportActivityScreen: ViewController { totalProgress = CGFloat(totalDoneBytes) / CGFloat(strongSelf.totalBytes) } strongSelf.controllerNode.updateState(state: .progress(totalProgress), animated: true) - }, error: { [weak self] _ in + }, error: { [weak self] error in guard let strongSelf = self else { return } - strongSelf.controllerNode.updateState(state: .error, animated: true) + strongSelf.controllerNode.updateState(state: .error(error), animated: true) }, completed: { [weak self] in guard let strongSelf = self else { return diff --git a/submodules/ChatListUI/Sources/Node/ChatListItem.swift b/submodules/ChatListUI/Sources/Node/ChatListItem.swift index 98a5e2476f..d1b19a8e70 100644 --- a/submodules/ChatListUI/Sources/Node/ChatListItem.swift +++ b/submodules/ChatListUI/Sources/Node/ChatListItem.swift @@ -958,7 +958,11 @@ class ChatListItemNode: ItemListRevealOptionsItemNode { } else if let message = messages.last, let author = message.author as? TelegramUser, let peer = itemPeer.chatMainPeer, !(peer is TelegramUser) { if let peer = peer as? TelegramChannel, case .broadcast = peer.info { } else if !displayAsMessage { - peerText = author.id == account.peerId ? item.presentationData.strings.DialogList_You : author.displayTitle(strings: item.presentationData.strings, displayOrder: item.presentationData.nameDisplayOrder) + if let forwardInfo = message.forwardInfo, forwardInfo.flags.contains(.isImported), let authorSignature = forwardInfo.authorSignature { + peerText = authorSignature + } else { + peerText = author.id == account.peerId ? item.presentationData.strings.DialogList_You : author.displayTitle(strings: item.presentationData.strings, displayOrder: item.presentationData.nameDisplayOrder) + } } } diff --git a/submodules/TelegramApi/Sources/Api0.swift b/submodules/TelegramApi/Sources/Api0.swift index 72232932be..2d7bc7c981 100644 --- a/submodules/TelegramApi/Sources/Api0.swift +++ b/submodules/TelegramApi/Sources/Api0.swift @@ -139,7 +139,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[1511503333] = { return Api.InputEncryptedFile.parse_inputEncryptedFile($0) } dict[767652808] = { return Api.InputEncryptedFile.parse_inputEncryptedFileBigUploaded($0) } dict[-1456996667] = { return Api.messages.InactiveChats.parse_inactiveChats($0) } - dict[-1199443157] = { return Api.GroupCallParticipant.parse_groupCallParticipant($0) } + dict[1690708501] = { return Api.GroupCallParticipant.parse_groupCallParticipant($0) } dict[1443858741] = { return Api.messages.SentEncryptedMessage.parse_sentEncryptedMessage($0) } dict[-1802240206] = { return Api.messages.SentEncryptedMessage.parse_sentEncryptedFile($0) } dict[1571494644] = { return Api.ExportedMessageLink.parse_exportedMessageLink($0) } diff --git a/submodules/TelegramApi/Sources/Api1.swift b/submodules/TelegramApi/Sources/Api1.swift index 52bbc3fae0..912be5f591 100644 --- a/submodules/TelegramApi/Sources/Api1.swift +++ b/submodules/TelegramApi/Sources/Api1.swift @@ -5510,13 +5510,13 @@ public extension Api { } public enum GroupCallParticipant: TypeConstructorDescription { - case groupCallParticipant(flags: Int32, userId: Int32, date: Int32, activeDate: Int32?, source: Int32, volume: Int32?, mutedCnt: Int32?) + case groupCallParticipant(flags: Int32, userId: Int32, date: Int32, activeDate: Int32?, source: Int32, volume: Int32?) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { - case .groupCallParticipant(let flags, let userId, let date, let activeDate, let source, let volume, let mutedCnt): + case .groupCallParticipant(let flags, let userId, let date, let activeDate, let source, let volume): if boxed { - buffer.appendInt32(-1199443157) + buffer.appendInt32(1690708501) } serializeInt32(flags, buffer: buffer, boxed: false) serializeInt32(userId, buffer: buffer, boxed: false) @@ -5524,15 +5524,14 @@ public extension Api { if Int(flags) & Int(1 << 3) != 0 {serializeInt32(activeDate!, buffer: buffer, boxed: false)} serializeInt32(source, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 7) != 0 {serializeInt32(volume!, buffer: buffer, boxed: false)} - if Int(flags) & Int(1 << 8) != 0 {serializeInt32(mutedCnt!, buffer: buffer, boxed: false)} break } } public func descriptionFields() -> (String, [(String, Any)]) { switch self { - case .groupCallParticipant(let flags, let userId, let date, let activeDate, let source, let volume, let mutedCnt): - return ("groupCallParticipant", [("flags", flags), ("userId", userId), ("date", date), ("activeDate", activeDate), ("source", source), ("volume", volume), ("mutedCnt", mutedCnt)]) + case .groupCallParticipant(let flags, let userId, let date, let activeDate, let source, let volume): + return ("groupCallParticipant", [("flags", flags), ("userId", userId), ("date", date), ("activeDate", activeDate), ("source", source), ("volume", volume)]) } } @@ -5549,17 +5548,14 @@ public extension Api { _5 = reader.readInt32() var _6: Int32? if Int(_1!) & Int(1 << 7) != 0 {_6 = reader.readInt32() } - var _7: Int32? - if Int(_1!) & Int(1 << 8) != 0 {_7 = reader.readInt32() } let _c1 = _1 != nil let _c2 = _2 != nil let _c3 = _3 != nil let _c4 = (Int(_1!) & Int(1 << 3) == 0) || _4 != nil let _c5 = _5 != nil let _c6 = (Int(_1!) & Int(1 << 7) == 0) || _6 != nil - let _c7 = (Int(_1!) & Int(1 << 8) == 0) || _7 != nil - if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 { - return Api.GroupCallParticipant.groupCallParticipant(flags: _1!, userId: _2!, date: _3!, activeDate: _4, source: _5!, volume: _6, mutedCnt: _7) + if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 { + return Api.GroupCallParticipant.groupCallParticipant(flags: _1!, userId: _2!, date: _3!, activeDate: _4, source: _5!, volume: _6) } else { return nil diff --git a/submodules/TelegramCore/Sources/ChatHistoryImport.swift b/submodules/TelegramCore/Sources/ChatHistoryImport.swift index d9610ef932..b929e0722d 100644 --- a/submodules/TelegramCore/Sources/ChatHistoryImport.swift +++ b/submodules/TelegramCore/Sources/ChatHistoryImport.swift @@ -14,6 +14,8 @@ public enum ChatHistoryImport { public enum InitImportError { case generic + case chatAdminRequired + case invalidChatType } public enum ParsedInfo { @@ -63,8 +65,15 @@ public enum ChatHistoryImport { return .fail(.generic) } return account.network.request(Api.functions.messages.initHistoryImport(peer: inputPeer, file: inputFile, mediaCount: mediaCount)) - |> mapError { _ -> InitImportError in - return .generic + |> mapError { error -> InitImportError in + switch error.errorDescription { + case "CHAT_ADMIN_REQUIRED": + return .chatAdminRequired + case "IMPORT_PEER_TYPE_INVALID": + return .invalidChatType + default: + return .generic + } } |> map { result -> Session in switch result { diff --git a/submodules/TelegramCore/Sources/GroupCalls.swift b/submodules/TelegramCore/Sources/GroupCalls.swift index c659976bec..8cd16a414d 100644 --- a/submodules/TelegramCore/Sources/GroupCalls.swift +++ b/submodules/TelegramCore/Sources/GroupCalls.swift @@ -88,7 +88,7 @@ public func getCurrentGroupCall(account: Account, callId: Int64, accessHash: Int loop: for participant in participants { switch participant { - case let .groupCallParticipant(flags, userId, date, activeDate, source, volume, mutedCnt): + case let .groupCallParticipant(flags, userId, date, activeDate, source, volume): let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: userId) let ssrc = UInt32(bitPattern: source) guard let peer = transaction.getPeer(peerId) else { @@ -228,7 +228,7 @@ public func getGroupCallParticipants(account: Account, callId: Int64, accessHash loop: for participant in participants { switch participant { - case let .groupCallParticipant(flags, userId, date, activeDate, source, volume, mutedCnt): + case let .groupCallParticipant(flags, userId, date, activeDate, source, volume): let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: userId) let ssrc = UInt32(bitPattern: source) guard let peer = transaction.getPeer(peerId) else { @@ -1194,7 +1194,7 @@ public final class GroupCallParticipantsContext { extension GroupCallParticipantsContext.Update.StateUpdate.ParticipantUpdate { init(_ apiParticipant: Api.GroupCallParticipant) { switch apiParticipant { - case let .groupCallParticipant(flags, userId, date, activeDate, source, volume, mutedCnt): + case let .groupCallParticipant(flags, userId, date, activeDate, source, volume): let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: userId) let ssrc = UInt32(bitPattern: source) let muted = (flags & (1 << 0)) != 0 @@ -1236,7 +1236,7 @@ extension GroupCallParticipantsContext.Update.StateUpdate { var participantUpdates: [GroupCallParticipantsContext.Update.StateUpdate.ParticipantUpdate] = [] for participant in participants { switch participant { - case let .groupCallParticipant(flags, userId, date, activeDate, source, volume, mutedCnt): + case let .groupCallParticipant(flags, userId, date, activeDate, source, volume): let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: userId) let ssrc = UInt32(bitPattern: source) let muted = (flags & (1 << 0)) != 0 diff --git a/submodules/TelegramUI/Sources/ChatMessageAvatarAccessoryItem.swift b/submodules/TelegramUI/Sources/ChatMessageAvatarAccessoryItem.swift index 7850dd1b42..3797f05651 100644 --- a/submodules/TelegramUI/Sources/ChatMessageAvatarAccessoryItem.swift +++ b/submodules/TelegramUI/Sources/ChatMessageAvatarAccessoryItem.swift @@ -62,19 +62,15 @@ final class ChatMessageAvatarAccessoryItem: ListViewAccessoryItem { if abs(effectiveTimestamp - effectiveOtherTimestamp) >= 10 * 60 { return false } - if let forwardInfo = self.forwardInfo, let otherForwardInfo = other.forwardInfo { - if forwardInfo.flags.contains(.isImported) && forwardInfo.flags.contains(.isImported) == forwardInfo.flags.contains(.isImported) { - if let authorSignature = forwardInfo.authorSignature, let otherAuthorSignature = otherForwardInfo.authorSignature { - if authorSignature != otherAuthorSignature { - return false - } - } else if let authorId = forwardInfo.author?.id, let otherAuthorId = other.forwardInfo?.author?.id { - if authorId != otherAuthorId { - return false - } + if let forwardInfo = self.forwardInfo, let otherForwardInfo = other.forwardInfo, forwardInfo.flags.contains(.isImported), otherForwardInfo.flags.contains(.isImported) { + if let authorSignature = forwardInfo.authorSignature, let otherAuthorSignature = otherForwardInfo.authorSignature { + if authorSignature != otherAuthorSignature { + return false + } + } else if let authorId = forwardInfo.author?.id, let otherAuthorId = other.forwardInfo?.author?.id { + if authorId != otherAuthorId { + return false } - } else { - return false } } else if let forwardInfo = self.forwardInfo, forwardInfo.flags.contains(.isImported) { return false diff --git a/submodules/TelegramUI/Sources/ChatMessageInteractiveFileNode.swift b/submodules/TelegramUI/Sources/ChatMessageInteractiveFileNode.swift index 90ab7914da..b943a8e2b2 100644 --- a/submodules/TelegramUI/Sources/ChatMessageInteractiveFileNode.swift +++ b/submodules/TelegramUI/Sources/ChatMessageInteractiveFileNode.swift @@ -534,9 +534,16 @@ final class ChatMessageInteractiveFileNode: ASDisplayNode { let addedWidth = intersection.width + 20 fittedLayoutSize.width += addedWidth } - if let statusFrameValue = statusFrame, let iconFrame = iconFrame, iconFrame.intersects(statusFrameValue) { - fittedLayoutSize.height += 15.0 - statusFrame = statusFrameValue.offsetBy(dx: 0.0, dy: 15.0) + if let statusFrameValue = statusFrame, let iconFrame = iconFrame { + if iconFrame.intersects(statusFrameValue) { + fittedLayoutSize.height += 15.0 + statusFrame = statusFrameValue.offsetBy(dx: 0.0, dy: 15.0) + } + } else if let statusFrameValue = statusFrame { + if progressFrame.intersects(statusFrameValue) { + fittedLayoutSize.height += 10.0 + statusFrame = statusFrameValue.offsetBy(dx: 0.0, dy: 15.0) + } } if (isAudio && !isVoice) || file.previewRepresentations.isEmpty { diff --git a/third-party/webrtc/BUILD b/third-party/webrtc/BUILD index 6ffa5c5ba0..256b9ab9ad 100644 --- a/third-party/webrtc/BUILD +++ b/third-party/webrtc/BUILD @@ -3266,7 +3266,8 @@ common_arm_specific_sources = ["webrtc-ios/src/" + path for path in [ ]] armv7_specific_sources = ["webrtc-ios/src/" + path for path in [ - + "common_audio/signal_processing/filter_ar_fast_q12.c", + "common_audio/signal_processing/complex_bit_reverse.c", ]] arm64_specific_sources = ["webrtc-ios/src/" + path for path in [