From 8527ac09280f5f338750a9eeedbac3722f3fd1bc Mon Sep 17 00:00:00 2001 From: Isaac <> Date: Tue, 21 Jan 2025 22:07:43 +0400 Subject: [PATCH] Pre-release --- .../Telegram-iOS/en.lproj/Localizable.strings | 6 ++++ .../ChatListFilterPresetController.swift | 1 - .../Display/Source/TabBarController.swift | 2 ++ .../Items/UniversalVideoGalleryItem.swift | 5 ++-- .../TabBarUI/Sources/TabBarController.swift | 29 +++++++++++++++++++ .../Sources/AvatarUploadToastScreen.swift | 22 +++++++++++--- .../Sources/ChatSendStarsScreen.swift | 4 ++- .../Sources/JoinAffiliateProgramScreen.swift | 3 +- .../Sources/TelegramRootController.swift | 5 +++- 9 files changed, 66 insertions(+), 11 deletions(-) diff --git a/Telegram/Telegram-iOS/en.lproj/Localizable.strings b/Telegram/Telegram-iOS/en.lproj/Localizable.strings index 166ad92b4b..c58a4eeb79 100644 --- a/Telegram/Telegram-iOS/en.lproj/Localizable.strings +++ b/Telegram/Telegram-iOS/en.lproj/Localizable.strings @@ -13770,3 +13770,9 @@ Sorry for the inconvenience."; "Gift.Hidden.ChannelText" = "The gift is removed from channel's Page."; "Gift.Upgrade.AddChannelName" = "Add channel name to the gift"; + +"AffiliateProgram.OpenBot" = "View %@"; + +"AvatarUpload.StatusUploading" = "Your photo is uploading."; +"AvatarUpload.StatusDone" = "Your photo is now set."; +"AvatarUpload.ViewAction" = "View"; diff --git a/submodules/ChatListUI/Sources/ChatListFilterPresetController.swift b/submodules/ChatListUI/Sources/ChatListFilterPresetController.swift index 8105752585..03ad7bd696 100644 --- a/submodules/ChatListUI/Sources/ChatListFilterPresetController.swift +++ b/submodules/ChatListUI/Sources/ChatListFilterPresetController.swift @@ -674,7 +674,6 @@ private func chatListFilterPresetControllerEntries(context: AccountContext, pres resolvedColor = context.peerNameColors.getChatFolderTag(tagColor, dark: presentationData.theme.overallDarkAppearance) } - //TODO:localize entries.append(.tagColorHeader(name: state.name, color: resolvedColor, isPremium: isPremium)) entries.append(.tagColor(colors: context.peerNameColors, currentColor: tagColor, isPremium: isPremium)) entries.append(.tagColorFooter) diff --git a/submodules/Display/Source/TabBarController.swift b/submodules/Display/Source/TabBarController.swift index 2c09401ee1..e552c5fafe 100644 --- a/submodules/Display/Source/TabBarController.swift +++ b/submodules/Display/Source/TabBarController.swift @@ -27,4 +27,6 @@ public protocol TabBarController: ViewController { func updateIsTabBarEnabled(_ value: Bool, transition: ContainedViewLayoutTransition) func updateIsTabBarHidden(_ value: Bool, transition: ContainedViewLayoutTransition) func updateLayout(transition: ContainedViewLayoutTransition) + + func updateControllerLayout(controller: ViewController) } diff --git a/submodules/GalleryUI/Sources/Items/UniversalVideoGalleryItem.swift b/submodules/GalleryUI/Sources/Items/UniversalVideoGalleryItem.swift index 71fcebb2df..677647b671 100644 --- a/submodules/GalleryUI/Sources/Items/UniversalVideoGalleryItem.swift +++ b/submodules/GalleryUI/Sources/Items/UniversalVideoGalleryItem.swift @@ -1404,7 +1404,8 @@ final class UniversalVideoGalleryItemNode: ZoomableContentGalleryItemNode { self.clipsToBounds = true - self.footerContentNode.shareMediaParameters = { [weak self] in + //TODO:wip-release + /*self.footerContentNode.shareMediaParameters = { [weak self] in guard let self, let playerStatusValue = self.playerStatusValue else { return nil } @@ -1413,7 +1414,7 @@ final class UniversalVideoGalleryItemNode: ZoomableContentGalleryItemNode { } else { return nil } - } + }*/ self.moreBarButton.addTarget(self, action: #selector(self.moreButtonPressed), forControlEvents: .touchUpInside) self.settingsBarButton.addTarget(self, action: #selector(self.settingsButtonPressed), forControlEvents: .touchUpInside) diff --git a/submodules/TabBarUI/Sources/TabBarController.swift b/submodules/TabBarUI/Sources/TabBarController.swift index 13b171ace0..091b864989 100644 --- a/submodules/TabBarUI/Sources/TabBarController.swift +++ b/submodules/TabBarUI/Sources/TabBarController.swift @@ -454,6 +454,35 @@ open class TabBarControllerImpl: ViewController, TabBarController { } } + public func updateControllerLayout(controller: ViewController) { + guard let layout = self.validLayout else { + return + } + if self.controllers.contains(where: { $0 === controller }) { + let currentController = controller + currentController.view.frame = CGRect(origin: CGPoint(), size: layout.size) + + var updatedLayout = layout + + var tabBarHeight: CGFloat + var options: ContainerViewLayoutInsetOptions = [] + if updatedLayout.metrics.widthClass == .regular { + options.insert(.input) + } + let bottomInset: CGFloat = updatedLayout.insets(options: options).bottom + if !updatedLayout.safeInsets.left.isZero { + tabBarHeight = 34.0 + bottomInset + } else { + tabBarHeight = 49.0 + bottomInset + } + if !self.tabBarControllerNode.tabBarHidden { + updatedLayout.intrinsicInsets.bottom = tabBarHeight + } + + currentController.containerLayoutUpdated(updatedLayout, transition: .immediate) + } + } + override open func navigationStackConfigurationUpdated(next: [ViewController]) { super.navigationStackConfigurationUpdated(next: next) for controller in self.controllers { diff --git a/submodules/TelegramUI/Components/AvatarUploadToastScreen/Sources/AvatarUploadToastScreen.swift b/submodules/TelegramUI/Components/AvatarUploadToastScreen/Sources/AvatarUploadToastScreen.swift index 6adb8a69c4..00c1588cc6 100644 --- a/submodules/TelegramUI/Components/AvatarUploadToastScreen/Sources/AvatarUploadToastScreen.swift +++ b/submodules/TelegramUI/Components/AvatarUploadToastScreen/Sources/AvatarUploadToastScreen.swift @@ -218,19 +218,33 @@ private final class AvatarUploadToastScreenComponent: Component { let iconSize = CGSize(width: 30.0, height: 30.0) let iconProgressInset: CGFloat = 3.0 + let uploadingString = environment.strings.AvatarUpload_StatusUploading + let doneString = environment.strings.AvatarUpload_StatusDone + + var commonPrefixLength = 0 + for i in 0 ..< min(uploadingString.count, doneString.count) { + if uploadingString[uploadingString.index(uploadingString.startIndex, offsetBy: i)] != doneString[doneString.index(doneString.startIndex, offsetBy: i)] { + break + } + commonPrefixLength = i + } + var textItems: [AnimatedTextComponent.Item] = [] - textItems.append(AnimatedTextComponent.Item(id: AnyHashable(0), isUnbreakable: true, content: .text("Your photo is "))) + + if commonPrefixLength != 0 { + textItems.append(AnimatedTextComponent.Item(id: AnyHashable(0), isUnbreakable: true, content: .text(String(uploadingString[uploadingString.startIndex ..< uploadingString.index(uploadingString.startIndex, offsetBy: commonPrefixLength)])))) + } if isDone { - textItems.append(AnimatedTextComponent.Item(id: AnyHashable(1), isUnbreakable: true, content: .text("now set."))) + textItems.append(AnimatedTextComponent.Item(id: AnyHashable(1), isUnbreakable: true, content: .text(String(doneString[doneString.index(doneString.startIndex, offsetBy: commonPrefixLength)...])))) } else { - textItems.append(AnimatedTextComponent.Item(id: AnyHashable(1), isUnbreakable: true, content: .text("uploading."))) + textItems.append(AnimatedTextComponent.Item(id: AnyHashable(1), isUnbreakable: true, content: .text(String(uploadingString[uploadingString.index(uploadingString.startIndex, offsetBy: commonPrefixLength)...])))) } let actionButtonSize = self.actionButton.update( transition: .immediate, component: AnyComponent(PlainButtonComponent( content: AnyComponent(MultilineTextComponent( - text: .plain(NSAttributedString(string: "View", font: Font.regular(17.0), textColor: environment.theme.list.itemAccentColor.withMultiplied(hue: 0.933, saturation: 0.61, brightness: 1.0))) + text: .plain(NSAttributedString(string: environment.strings.AvatarUpload_ViewAction, font: Font.regular(17.0), textColor: environment.theme.list.itemAccentColor.withMultiplied(hue: 0.933, saturation: 0.61, brightness: 1.0))) )), effectAlignment: .center, contentInsets: UIEdgeInsets(top: -8.0, left: -8.0, bottom: -8.0, right: -8.0), diff --git a/submodules/TelegramUI/Components/Chat/ChatSendStarsScreen/Sources/ChatSendStarsScreen.swift b/submodules/TelegramUI/Components/Chat/ChatSendStarsScreen/Sources/ChatSendStarsScreen.swift index 99c73109a9..a7d9564ab0 100644 --- a/submodules/TelegramUI/Components/Chat/ChatSendStarsScreen/Sources/ChatSendStarsScreen.swift +++ b/submodules/TelegramUI/Components/Chat/ChatSendStarsScreen/Sources/ChatSendStarsScreen.swift @@ -2419,7 +2419,9 @@ public class ChatSendStarsScreen: ViewControllerComponentContainer { topPeers = Array(topPeers.prefix(3)) } - let channelsForPublicReaction = context.engine.peers.channelsForPublicReaction(useLocalCache: true) + //TODO:wip-release + //let channelsForPublicReaction = context.engine.peers.channelsForPublicReaction(useLocalCache: true) + let channelsForPublicReaction: Signal<[EnginePeer], NoError> = .single([]) let sendAsPeer: Signal = .single(nil) return combineLatest( diff --git a/submodules/TelegramUI/Components/PeerInfo/AffiliateProgramSetupScreen/Sources/JoinAffiliateProgramScreen.swift b/submodules/TelegramUI/Components/PeerInfo/AffiliateProgramSetupScreen/Sources/JoinAffiliateProgramScreen.swift index f9cc7f1364..a9ed9eff37 100644 --- a/submodules/TelegramUI/Components/PeerInfo/AffiliateProgramSetupScreen/Sources/JoinAffiliateProgramScreen.swift +++ b/submodules/TelegramUI/Components/PeerInfo/AffiliateProgramSetupScreen/Sources/JoinAffiliateProgramScreen.swift @@ -833,7 +833,6 @@ private final class JoinAffiliateProgramScreenComponent: Component { self.navigationBackgroundView.update(size: navigationBackgroundFrame.size, cornerRadius: 10.0, maskedCorners: [.layerMinXMinYCorner, .layerMaxXMinYCorner], transition: transition.containedViewLayoutTransition) transition.setFrame(layer: self.navigationBarSeparator, frame: CGRect(origin: CGPoint(x: 0.0, y: 54.0), size: CGSize(width: availableSize.width, height: UIScreenPixel))) - //TODO:localize var openBotComponents: [AnyComponentWithIdentity] = [] var openBotLeftInset: CGFloat = 12.0 if case .active = component.mode { @@ -847,7 +846,7 @@ private final class JoinAffiliateProgramScreenComponent: Component { translation: CGPoint(x: 0.0, y: 1.0))))) } openBotComponents.append(AnyComponentWithIdentity(id: 1, component: AnyComponent(MultilineTextComponent( - text: .plain(NSAttributedString(string: "View " + component.sourcePeer.compactDisplayTitle, font: Font.medium(15.0), textColor: environment.theme.list.itemInputField.primaryColor)) + text: .plain(NSAttributedString(string: environment.strings.AffiliateProgram_OpenBot(component.sourcePeer.compactDisplayTitle).string, font: Font.medium(15.0), textColor: environment.theme.list.itemInputField.primaryColor)) )))) openBotComponents.append(AnyComponentWithIdentity(id: 2, component: AnyComponent(TransformContents( content: AnyComponent(BundleIconComponent( diff --git a/submodules/TelegramUI/Sources/TelegramRootController.swift b/submodules/TelegramUI/Sources/TelegramRootController.swift index fd77090a73..226229813e 100644 --- a/submodules/TelegramUI/Sources/TelegramRootController.swift +++ b/submodules/TelegramUI/Sources/TelegramRootController.swift @@ -755,7 +755,10 @@ public final class TelegramRootController: NavigationController, TelegramRootCon } public func openAvatars() { - self.accountSettingsController?.openAvatars() + if let accountSettingsController = self.accountSettingsController { + self.rootTabController?.updateControllerLayout(controller: accountSettingsController) + accountSettingsController.openAvatars() + } } }