From bb404dbbd38842a4aabfd52ec52b4006e5cb6d80 Mon Sep 17 00:00:00 2001 From: Isaac <> Date: Mon, 29 Apr 2024 18:59:13 +0400 Subject: [PATCH 1/2] Various improvements --- .../ItemListUI/Sources/ItemListControllerNode.swift | 6 +----- .../Sources/AnimatedTextComponent.swift | 2 +- .../Sources/ChatMessageTextBubbleContentNode.swift | 6 ++++++ .../ListItems/PeerInfoScreenLabeledValueItem.swift | 12 ++++++++++++ .../PeerInfoScreen/Sources/PeerInfoHeaderNode.swift | 6 ++++++ .../TelegramUI/Sources/ApplicationContext.swift | 9 +++++++++ 6 files changed, 35 insertions(+), 6 deletions(-) diff --git a/submodules/ItemListUI/Sources/ItemListControllerNode.swift b/submodules/ItemListUI/Sources/ItemListControllerNode.swift index 35785719f8..07c3cc8c8b 100644 --- a/submodules/ItemListUI/Sources/ItemListControllerNode.swift +++ b/submodules/ItemListUI/Sources/ItemListControllerNode.swift @@ -905,11 +905,7 @@ open class ItemListControllerNode: ASDisplayNode, ASGestureRecognizerDelegate { if let validLayout = self.validLayout { updatedNode.updateLayout(layout: validLayout.0, navigationBarHeight: validLayout.1, transition: .immediate) } - if self.rightOverlayNode.supernode != nil { - self.insertSubnode(updatedNode, aboveSubnode: self.rightOverlayNode) - } else { - self.insertSubnode(updatedNode, aboveSubnode: self.listNode) - } + self.addSubnode(updatedNode) updatedNode.activate() } } else { diff --git a/submodules/TelegramUI/Components/AnimatedTextComponent/Sources/AnimatedTextComponent.swift b/submodules/TelegramUI/Components/AnimatedTextComponent/Sources/AnimatedTextComponent.swift index cf7766a76a..d30ca5dcb4 100644 --- a/submodules/TelegramUI/Components/AnimatedTextComponent/Sources/AnimatedTextComponent.swift +++ b/submodules/TelegramUI/Components/AnimatedTextComponent/Sources/AnimatedTextComponent.swift @@ -123,7 +123,7 @@ public final class AnimatedTextComponent: Component { color: component.color )), environment: {}, - containerSize: CGSize(width: 100.0, height: 100.0) + containerSize: CGSize(width: availableSize.width, height: 100.0) ) let characterFrame = CGRect(origin: CGPoint(x: size.width, y: 0.0), size: characterSize) if let characterComponentView = characterView.view { diff --git a/submodules/TelegramUI/Components/Chat/ChatMessageTextBubbleContentNode/Sources/ChatMessageTextBubbleContentNode.swift b/submodules/TelegramUI/Components/Chat/ChatMessageTextBubbleContentNode/Sources/ChatMessageTextBubbleContentNode.swift index 1a8a6505f6..e555b4d992 100644 --- a/submodules/TelegramUI/Components/Chat/ChatMessageTextBubbleContentNode/Sources/ChatMessageTextBubbleContentNode.swift +++ b/submodules/TelegramUI/Components/Chat/ChatMessageTextBubbleContentNode/Sources/ChatMessageTextBubbleContentNode.swift @@ -930,6 +930,12 @@ public class ChatMessageTextBubbleContentNode: ChatMessageBubbleContentNode { return ChatMessageBubbleContentTapAction(content: .copy(pre)) } else if let code = attributes[NSAttributedString.Key(rawValue: TelegramTextAttributes.Code)] as? String { return ChatMessageBubbleContentTapAction(content: .copy(code)) + } else if let _ = attributes[NSAttributedString.Key(rawValue: "Attribute__Blockquote")] { + if let text = self.textNode.textNode.attributeSubstring(name: "Attribute__Blockquote", index: index) { + return ChatMessageBubbleContentTapAction(content: .copy(text.1)) + } else { + return ChatMessageBubbleContentTapAction(content: .none) + } } else if let emoji = attributes[NSAttributedString.Key(rawValue: ChatTextInputAttributes.customEmoji.rawValue)] as? ChatTextInputTextCustomEmojiAttribute, let file = emoji.file { return ChatMessageBubbleContentTapAction(content: .customEmoji(file)) } else { diff --git a/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/ListItems/PeerInfoScreenLabeledValueItem.swift b/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/ListItems/PeerInfoScreenLabeledValueItem.swift index 61ee6f0ae6..9f5865fc1e 100644 --- a/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/ListItems/PeerInfoScreenLabeledValueItem.swift +++ b/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/ListItems/PeerInfoScreenLabeledValueItem.swift @@ -268,6 +268,18 @@ private final class PeerInfoScreenLabeledValueItemNode: PeerInfoScreenItemNode { } } + self.containerNode.shouldBegin = { [weak self] point in + guard let self else { + return false + } + + if self.linkItemAtPoint(point) != nil { + return false + } + + return true + } + self.containerNode.activated = { [weak self] gesture, _ in guard let strongSelf = self, let item = strongSelf.item, let contextAction = item.contextAction else { gesture.cancel() diff --git a/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoHeaderNode.swift b/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoHeaderNode.swift index 6c83253053..e1580cd240 100644 --- a/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoHeaderNode.swift +++ b/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoHeaderNode.swift @@ -2235,6 +2235,12 @@ final class PeerInfoHeaderNode: ASDisplayNode { return result } + if self.isSettings { + if self.subtitleNodeRawContainer.bounds.contains(self.view.convert(point, to: self.subtitleNodeRawContainer.view)) { + return self.subtitleNodeRawContainer.view + } + } + if let result = self.buttonsContainerNode.view.hitTest(self.view.convert(point, to: self.buttonsContainerNode.view), with: event) { return result } diff --git a/submodules/TelegramUI/Sources/ApplicationContext.swift b/submodules/TelegramUI/Sources/ApplicationContext.swift index b206a10e12..fb0ac7b444 100644 --- a/submodules/TelegramUI/Sources/ApplicationContext.swift +++ b/submodules/TelegramUI/Sources/ApplicationContext.swift @@ -396,6 +396,15 @@ final class AuthorizedApplicationContext { return } + if firstMessage.restrictionReason(platform: "ios", contentSettings: strongSelf.context.currentContentSettings.with { $0 }) != nil { + return + } + if let chatPeer = firstMessage.peers[firstMessage.id.peerId] { + if EnginePeer(chatPeer).restrictionText(platform: "ios", contentSettings: strongSelf.context.currentContentSettings.with { $0 }) != nil { + return + } + } + if inAppNotificationSettings.displayPreviews { let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 } strongSelf.notificationController.enqueue(ChatMessageNotificationItem(context: strongSelf.context, strings: presentationData.strings, dateTimeFormat: presentationData.dateTimeFormat, nameDisplayOrder: presentationData.nameDisplayOrder, messages: messages, threadData: threadData, tapAction: { From 50fa5e6d66815172492286ac650d8f3c37d5503b Mon Sep 17 00:00:00 2001 From: Isaac <> Date: Mon, 29 Apr 2024 18:59:26 +0400 Subject: [PATCH 2/2] Attempt to change notification service name every release --- Telegram/BUILD | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-) diff --git a/Telegram/BUILD b/Telegram/BUILD index f16386e42a..ad348cdc04 100644 --- a/Telegram/BUILD +++ b/Telegram/BUILD @@ -143,6 +143,8 @@ genrule( minimum_os_version = "12.0" minimum_watchos_version="9.0" +notificationServiceExtensionVersion = "v1" + empty_languages = [ "ar", "be", @@ -1712,31 +1714,12 @@ plist_fragment( """.format( - telegram_bundle_id = telegram_bundle_id, + telegram_bundle_id = telegram_bundle_id ) ) -'''genrule( - name = "SetMinOsVersionNotificationServiceExtension", - cmd_bash = -""" - name=NotificationServiceExtension.appex - cat $(location PatchMinOSVersion.source.sh) | sed -e "s/<<>>/10\\.0/g" | sed -e "s/<<>>/$$name/g" > $(location SetMinOsVersionNotificationServiceExtension.sh) -""", - srcs = [ - "PatchMinOSVersion.source.sh", - ], - outs = [ - "SetMinOsVersionNotificationServiceExtension.sh", - ], - executable = True, - visibility = [ - "//visibility:public", - ] -)''' - ios_extension( - name = "NotificationServiceExtension", + name = "NotificationServiceExtension" + notificationServiceExtensionVersion, bundle_id = "{telegram_bundle_id}.NotificationService".format( telegram_bundle_id = telegram_bundle_id, ), @@ -1752,7 +1735,6 @@ ios_extension( ":AppNameInfoPlist", ], minimum_os_version = minimum_os_version, # maintain the same minimum OS version across extensions - #ipa_post_processor = ":SetMinOsVersionNotificationServiceExtension", provisioning_profile = select({ ":disableProvisioningProfilesSetting": None, "//conditions:default": "@build_configuration//provisioning:NotificationService.mobileprovision", @@ -1997,7 +1979,7 @@ ios_application( "//conditions:default": [ ":ShareExtension", ":NotificationContentExtension", - ":NotificationServiceExtension", + ":NotificationServiceExtension" + notificationServiceExtensionVersion, ":IntentsExtension", ":WidgetExtension", ":BroadcastUploadExtension",