From 25d5a4b589968ebaf07c9ea73f22a90bfc1c2439 Mon Sep 17 00:00:00 2001 From: Ali <> Date: Thu, 8 Dec 2022 17:20:18 +0400 Subject: [PATCH 1/6] Update string attribute range clipping --- .../ChatListUI/Sources/Node/ChatListItem.swift | 18 ++++++++++++++++++ .../Sources/StringWithAppliedEntities.swift | 5 +++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/submodules/ChatListUI/Sources/Node/ChatListItem.swift b/submodules/ChatListUI/Sources/Node/ChatListItem.swift index 2d8ea068ab..c01105c60f 100644 --- a/submodules/ChatListUI/Sources/Node/ChatListItem.swift +++ b/submodules/ChatListUI/Sources/Node/ChatListItem.swift @@ -1822,11 +1822,23 @@ class ChatListItemNode: ItemListRevealOptionsItemNode { let mutableString = NSMutableAttributedString(string: messageText, font: textFont, textColor: theme.messageTextColor) if let spoilers = spoilers { for range in spoilers { + var range = range + if range.location > mutableString.length { + continue + } else if range.location + range.length > mutableString.length { + range.length = mutableString.length - range.location + } mutableString.addAttribute(NSAttributedString.Key(rawValue: TelegramTextAttributes.Spoiler), value: true, range: range) } } if let customEmojiRanges = customEmojiRanges { for (range, attribute) in customEmojiRanges { + var range = range + if range.location > mutableString.length { + continue + } else if range.location + range.length > mutableString.length { + range.length = mutableString.length - range.location + } mutableString.addAttribute(ChatTextInputAttributes.customEmoji, value: attribute, range: range) } } @@ -1857,6 +1869,12 @@ class ChatListItemNode: ItemListRevealOptionsItemNode { for range in chatListSearchResult.resultRanges { let stringRange = NSRange(range, in: chatListSearchResult.text) if stringRange.location >= 0 && stringRange.location + stringRange.length <= composedString.length { + var stringRange = stringRange + if stringRange.location > composedString.length { + continue + } else if stringRange.location + stringRange.length > composedString.length { + stringRange.length = composedString.length - stringRange.location + } composedString.addAttribute(.foregroundColor, value: theme.messageHighlightedTextColor, range: stringRange) } } diff --git a/submodules/TextFormat/Sources/StringWithAppliedEntities.swift b/submodules/TextFormat/Sources/StringWithAppliedEntities.swift index 7400c9b364..ec6f8826a0 100644 --- a/submodules/TextFormat/Sources/StringWithAppliedEntities.swift +++ b/submodules/TextFormat/Sources/StringWithAppliedEntities.swift @@ -18,8 +18,10 @@ public func chatInputStateStringWithAppliedEntities(_ text: String, entities: [M if nsString == nil { nsString = text as NSString } + if range.location >= stringLength { + continue + } if range.location + range.length > stringLength { - range.location = max(0, stringLength - range.length) range.length = stringLength - range.location } switch entity.type { @@ -75,7 +77,6 @@ public func stringWithAppliedEntities(_ text: String, entities: [MessageTextEnti if range.location > stringLength { continue } else if range.location + range.length > stringLength { - range.location = max(0, stringLength - range.length) range.length = stringLength - range.location } switch entity.type { From f24c1ea6bb46cea44b21e010950f4c453aa109ea Mon Sep 17 00:00:00 2001 From: Ali <> Date: Sat, 10 Dec 2022 00:22:55 +0400 Subject: [PATCH 2/6] Fix document preview --- .../Sources/DocumentPreviewController.swift | 34 ++++++++++++------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/submodules/TelegramUI/Sources/DocumentPreviewController.swift b/submodules/TelegramUI/Sources/DocumentPreviewController.swift index fc2adef437..21944e57b8 100644 --- a/submodules/TelegramUI/Sources/DocumentPreviewController.swift +++ b/submodules/TelegramUI/Sources/DocumentPreviewController.swift @@ -200,22 +200,32 @@ final class CompactDocumentPreviewController: QLPreviewController, QLPreviewCont } private func tick() { - self.navigationItem.rightBarButtonItems = [UIBarButtonItem()] - self.navigationItem.setRightBarButton(UIBarButtonItem(), animated: false) - - self.navigationController?.toolbar.isHidden = true - let (navigationBars, toolbars) = navigationAndToolbarsInSubviews(forView: self.view) self.navigationBars = navigationBars self.toolbars = toolbars - - for navigationBar in self.navigationBars { - navigationBar.topItem?.rightBarButtonItem = UIBarButtonItem() - navigationBar.topItem?.rightBarButtonItems = [UIBarButtonItem()] - } - for toolbar in self.toolbars { - toolbar.isHidden = true + if #available(iOS 16.0, *) { + if let navigationController = self.children.first as? UINavigationController, let topController = navigationController.topViewController { + topController.navigationItem.titleMenuProvider = nil + } + + for toolbar in self.toolbars { + toolbar.isHidden = true + } + } else { + self.navigationItem.rightBarButtonItems = [UIBarButtonItem()] + self.navigationItem.setRightBarButton(UIBarButtonItem(), animated: false) + + self.navigationController?.toolbar.isHidden = true + + for navigationBar in self.navigationBars { + navigationBar.topItem?.rightBarButtonItem = UIBarButtonItem() + navigationBar.topItem?.rightBarButtonItems = [UIBarButtonItem()] + } + + for toolbar in self.toolbars { + toolbar.isHidden = true + } } } From c9c1376967d8bf31171663f08030efe10f7dc50a Mon Sep 17 00:00:00 2001 From: Ali <> Date: Wed, 14 Dec 2022 18:26:10 +0400 Subject: [PATCH 3/6] Bump version --- versions.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions.json b/versions.json index 842d73869c..3820859635 100644 --- a/versions.json +++ b/versions.json @@ -1,5 +1,5 @@ { - "app": "9.2.1", + "app": "9.2.2", "bazel": "5.3.1", "xcode": "14.1" } From 7e349d5d01158099af6265b42eb5d53c56d1ac08 Mon Sep 17 00:00:00 2001 From: Ali <> Date: Thu, 15 Dec 2022 21:20:26 +0400 Subject: [PATCH 4/6] Enable IDs --- Telegram/BUILD | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Telegram/BUILD b/Telegram/BUILD index e6fc4a82dc..3bae5e2c8c 100644 --- a/Telegram/BUILD +++ b/Telegram/BUILD @@ -413,9 +413,9 @@ official_apple_pay_merchants = [ "merchant.org.telegram.Best2pay.test", "merchant.psbank.test.telegramios", "merchant.psbank.prod.telegramios", - #"merchant.org.telegram.billinenet.test", - #"merchant.org.telegram.billinenet.prod", - #"merchant.org.telegram.portmone.test", + "merchant.org.telegram.billinenet.test", + "merchant.org.telegram.billinenet.prod", + "merchant.org.telegram.portmone.test", ] official_bundle_ids = [ From da5fa050420ecafb6b31de507d201669230c8b7c Mon Sep 17 00:00:00 2001 From: Ali <> Date: Thu, 15 Dec 2022 21:52:49 +0400 Subject: [PATCH 5/6] Trigger build --- Random.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Random.txt b/Random.txt index e1f36b1340..c6648d1db0 100644 --- a/Random.txt +++ b/Random.txt @@ -1 +1 @@ -c190c625502c4d5a9b1ac0d016da64ce +44eed22b384449bcec8962f2fddbfebd From ab4671c631f5a7f80dca9863672c1a451238fbd4 Mon Sep 17 00:00:00 2001 From: Ali <> Date: Fri, 16 Dec 2022 00:34:01 +0400 Subject: [PATCH 6/6] [Temp] call-related changes --- .../TelegramVoip/Sources/OngoingCallContext.swift | 10 ++++++++++ .../Sources/OngoingCallThreadLocalContext.mm | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/submodules/TelegramVoip/Sources/OngoingCallContext.swift b/submodules/TelegramVoip/Sources/OngoingCallContext.swift index 923e197044..e1c0edaee6 100644 --- a/submodules/TelegramVoip/Sources/OngoingCallContext.swift +++ b/submodules/TelegramVoip/Sources/OngoingCallContext.swift @@ -79,6 +79,11 @@ private func callConnectionDescriptionsWebrtc(_ connection: CallSessionConnectio guard let id = idMapping[reflector.id] else { return [] } + #if DEBUG + if id != 1 { + return [] + } + #endif var result: [OngoingCallConnectionDescriptionWebrtc] = [] if !reflector.ip.isEmpty { result.append(OngoingCallConnectionDescriptionWebrtc(reflectorId: id, hasStun: false, hasTurn: true, hasTcp: reflector.isTcp, ip: reflector.ip, port: reflector.port, username: "reflector", password: hexString(reflector.peerTag))) @@ -88,6 +93,11 @@ private func callConnectionDescriptionsWebrtc(_ connection: CallSessionConnectio } return result case let .webRtcReflector(reflector): + #if DEBUG + if "".isEmpty { + return [] + } + #endif var result: [OngoingCallConnectionDescriptionWebrtc] = [] if !reflector.ip.isEmpty { result.append(OngoingCallConnectionDescriptionWebrtc(reflectorId: 0, hasStun: reflector.hasStun, hasTurn: reflector.hasTurn, hasTcp: false, ip: reflector.ip, port: reflector.port, username: reflector.username, password: reflector.password)) diff --git a/submodules/TgVoipWebrtc/Sources/OngoingCallThreadLocalContext.mm b/submodules/TgVoipWebrtc/Sources/OngoingCallThreadLocalContext.mm index 3795954fc4..e03bff6a6f 100644 --- a/submodules/TgVoipWebrtc/Sources/OngoingCallThreadLocalContext.mm +++ b/submodules/TgVoipWebrtc/Sources/OngoingCallThreadLocalContext.mm @@ -115,7 +115,9 @@ public: if (!_audioDeviceModule->Playing()) { _audioDeviceModule->InitPlayout(); //_audioDeviceModule->InitRecording(); - _audioDeviceModule->InternalStartPlayout(); + if (_audioDeviceModule->PlayoutIsInitialized()) { + _audioDeviceModule->InternalStartPlayout(); + } //_audioDeviceModule->InternalStartRecording(); } }