diff --git a/Telegram/Telegram-iOS/en.lproj/Localizable.strings b/Telegram/Telegram-iOS/en.lproj/Localizable.strings index b364f3e1f6..31f2ad8641 100644 --- a/Telegram/Telegram-iOS/en.lproj/Localizable.strings +++ b/Telegram/Telegram-iOS/en.lproj/Localizable.strings @@ -11149,3 +11149,36 @@ Sorry for the inconvenience."; "Contacts.SelectedContacts_any" = "%@ Selected"; "Emoji.GroupEmoji" = "GROUP EMOJI"; + +"Channel.Appearance.BoostInfo" = "Subscribers of your channel can **boost** it so that it levels up and unlocks these features."; +"Group.Appearance.BoostInfo" = "Members of your group can **boost** it so that it levels up and unlocks these features."; + +"Group.Appearance.ProfileFooter" = "Choose a color and a logo for the group's profile."; + +"Group.Appearance.GroupEmoji" = "Group Emoji Pack"; +"Group.Appearance.GroupEmojiFooter" = "Choose an emoji pack that will be available to all members within the group."; + +"Group.Appearance.Status" = "Group Emoji Status"; +"Group.Appearance.StatusFooter" = "Choose a status that will be shown next to the group's name."; + +"Group.Appearance.Wallpaper" = "Group Wallpaper"; +"Group.Appearance.WallpaperFooter" = "Set a wallpaper that will be visible for everyone in your group."; + +"PeerInfo.Group.Boost" = "Boost Group"; + +"BoostGift.Groups.PrivateGroup.Title" = "Group is Private"; +"BoostGift.Groups.PrivateGroup.Text" = "Are you sure you want to add a private group? Users won't be able to join it without an invite link."; + +"BoostGift.ChannelsOrGroups.Title" = "Add Channels or Groups"; +"BoostGift.ChannelsOrGroups.Subtitle" = "select up to %@ channels or groups"; +"BoostGift.ChannelsOrGroups.SectionTitle" = "CHANNELS AND GROUPS"; +"BoostGift.ChannelsOrGroups.Search" = "Search Channels and Groups"; +"BoostGift.ChannelsOrGroups.MaximumReached" = "You can select maximum %@ channels and groups."; +"BoostGift.ChannelsOrGroups.Save" = "Save Channels and Groups"; + +"BoostGift.GroupsOrChannels.Title" = "Add Groups or Channels"; +"BoostGift.GroupsOrChannels.Subtitle" = "select up to %@ groups or channels"; +"BoostGift.GroupsOrChannels.SectionTitle" = "GROUPS AND CHANNELS"; +"BoostGift.GroupsOrChannels.Search" = "Search Groups and Channels"; +"BoostGift.GroupsOrChannels.MaximumReached" = "You can select maximum %@ groups and channels."; +"BoostGift.GroupsOrChannels.Save" = "Save Groups and Channels"; diff --git a/submodules/ItemListUI/Sources/ItemListControllerNode.swift b/submodules/ItemListUI/Sources/ItemListControllerNode.swift index b8dcdcf313..32654583a9 100644 --- a/submodules/ItemListUI/Sources/ItemListControllerNode.swift +++ b/submodules/ItemListUI/Sources/ItemListControllerNode.swift @@ -991,7 +991,7 @@ open class ItemListControllerNode: ASDisplayNode { if updateSearchItem { self.requestLayout?(.animated(duration: 0.3, curve: .spring)) } else if updateToolbarItem || updateHeaderItem || updateFooterItem, let (layout, navigationBarHeight, additionalInsets) = self.validLayout { - self.containerLayoutUpdated(layout, navigationBarHeight: navigationBarHeight, transition: .animated(duration: 0.3, curve: .spring), additionalInsets: additionalInsets) + self.containerLayoutUpdated(layout, navigationBarHeight: navigationBarHeight, transition: updateHeaderItem ? .immediate : .animated(duration: 0.3, curve: .spring), additionalInsets: additionalInsets) } } } diff --git a/submodules/PremiumUI/Sources/CreateGiveawayController.swift b/submodules/PremiumUI/Sources/CreateGiveawayController.swift index d3e9787af2..0e4ddc0885 100644 --- a/submodules/PremiumUI/Sources/CreateGiveawayController.swift +++ b/submodules/PremiumUI/Sources/CreateGiveawayController.swift @@ -832,7 +832,7 @@ public enum CreateGiveawaySubject { case prepaid(PrepaidGiveaway) } -public func createGiveawayController(context: AccountContext, updatedPresentationData: (initial: PresentationData, signal: Signal)? = nil, peerId: EnginePeer.Id, subject: CreateGiveawaySubject, completion: (() -> Void)? = nil) -> ViewController { +public func createGiveawayController(context: AccountContext, updatedPresentationData: (initial: PresentationData, signal: Signal)? = nil, peerId: EnginePeer.Id, subject: CreateGiveawaySubject, completion: (() -> Void)? = nil) -> ViewController { let actionsDisposable = DisposableSet() let initialSubscriptions: Int32 @@ -865,6 +865,8 @@ public func createGiveawayController(context: AccountContext, updatedPresentatio statePromise.set(stateValue.modify { f($0) }) } + let isGroupValue = Atomic(value: false) + let productsValue = Atomic<[PremiumGiftProduct]?>(value: nil) var buyActionImpl: (() -> Void)? @@ -967,6 +969,7 @@ public func createGiveawayController(context: AccountContext, updatedPresentatio if let peer = peersMap[peerId], case let .channel(channel) = peer, case .group = channel.info { isGroup = true } + let _ = isGroupValue.swap(isGroup) let headerItem = CreateGiveawayHeaderItem(theme: presentationData.theme, strings: presentationData.strings, title: presentationData.strings.BoostGift_Title, text: isGroup ? presentationData.strings.BoostGift_Group_Description : presentationData.strings.BoostGift_Description, cancel: { dismissImpl?() @@ -1258,11 +1261,11 @@ public func createGiveawayController(context: AccountContext, updatedPresentatio } openChannelsSelectionImpl = { + let isGroup = isGroupValue.with { $0 } let state = stateValue.with { $0 } - let stateContext = ShareWithPeersScreen.StateContext( context: context, - subject: .channels(exclude: Set([peerId]), searchQuery: nil), + subject: .channels(isGroup: isGroup, exclude: Set([peerId]), searchQuery: nil), initialPeerIds: Set(state.channels.filter { $0 != peerId }) ) let _ = (stateContext.ready |> filter { $0 } |> take(1) |> deliverOnMainQueue).startStandalone(next: { _ in diff --git a/submodules/PremiumUI/Sources/GiveawayInfoController.swift b/submodules/PremiumUI/Sources/GiveawayInfoController.swift index 0fdedc54e2..b27fe0dd90 100644 --- a/submodules/PremiumUI/Sources/GiveawayInfoController.swift +++ b/submodules/PremiumUI/Sources/GiveawayInfoController.swift @@ -35,14 +35,14 @@ public func presentGiveawayInfoController( let giveaway = message.media.first(where: { $0 is TelegramMediaGiveaway }) as? TelegramMediaGiveaway let giveawayResults = message.media.first(where: { $0 is TelegramMediaGiveawayResults }) as? TelegramMediaGiveawayResults - var channelPeerId: EnginePeer.Id? - if let giveaway { - if let peerId = giveaway.channelPeerIds.first { - channelPeerId = peerId - } - } else if let _ = giveawayResults { - channelPeerId = message.author?.id - } +// var channelPeerId: EnginePeer.Id? +// if let giveaway { +// if let peerId = giveaway.channelPeerIds.first { +// channelPeerId = peerId +// } +// } else if let _ = giveawayResults { +// channelPeerId = message.author?.id +// } var quantity: Int32 = 0 if let giveaway { @@ -88,9 +88,15 @@ public func presentGiveawayInfoController( let presentationData = context.sharedContext.currentPresentationData.with { $0 } + let author = message.forwardInfo?.author ?? message.author?._asPeer() + var isGroup = false + if let channel = author as? TelegramChannel, case .group = channel.info { + isGroup = true + } + var peerName = "" - if let peerId = channelPeerId, let peer = message.peers[peerId] { - peerName = EnginePeer(peer).compactDisplayTitle + if let channel = author as? TelegramChannel { + peerName = EnginePeer(channel).compactDisplayTitle } let timeZone = TimeZone.current @@ -111,8 +117,6 @@ public func presentGiveawayInfoController( additionalPrizes = "\n\n" + presentationData.strings.Chat_Giveaway_Info_AdditionalPrizes(peerName, "\(quantity) \(prizeDescription)").string } - let isGroup = "".isEmpty - switch giveawayInfo { case let .ongoing(start, status): let startDate = presentationData.strings.Chat_Giveaway_Info_FullDate( diff --git a/submodules/StatisticsUI/Sources/BoostHeaderItem.swift b/submodules/StatisticsUI/Sources/BoostHeaderItem.swift index cf15172bd6..91568d444a 100644 --- a/submodules/StatisticsUI/Sources/BoostHeaderItem.swift +++ b/submodules/StatisticsUI/Sources/BoostHeaderItem.swift @@ -26,8 +26,9 @@ final class BoostHeaderItem: ItemListControllerHeaderItem { let createGiveaway: () -> Void let openFeatures: () -> Void let back: () -> Void + let updateStatusBar: (StatusBarStyle) -> Void - init(context: AccountContext, theme: PresentationTheme, strings: PresentationStrings, status: ChannelBoostStatus, title: String, text: String, openBoost: @escaping () -> Void, createGiveaway: @escaping () -> Void, openFeatures: @escaping () -> Void, back: @escaping () -> Void) { + init(context: AccountContext, theme: PresentationTheme, strings: PresentationStrings, status: ChannelBoostStatus, title: String, text: String, openBoost: @escaping () -> Void, createGiveaway: @escaping () -> Void, openFeatures: @escaping () -> Void, back: @escaping () -> Void, updateStatusBar: @escaping (StatusBarStyle) -> Void) { self.context = context self.theme = theme self.strings = strings @@ -38,6 +39,7 @@ final class BoostHeaderItem: ItemListControllerHeaderItem { self.createGiveaway = createGiveaway self.openFeatures = openFeatures self.back = back + self.updateStatusBar = updateStatusBar } func isEqual(to: ItemListControllerHeaderItem) -> Bool { @@ -164,6 +166,12 @@ final class BoostHeaderItemNode: ItemListControllerHeaderItemNode { let scrolledUp = topPanelAlpha < 0.5 self.backButton.updateContentsColor(backgroundColor: scrolledUp ? UIColor(white: 1.0, alpha: 0.2) : .clear, contentsColor: scrolledUp ? .white : self.item.theme.rootController.navigationBar.accentTextColor, canBeExpanded: !scrolledUp, transition: .animated(duration: 0.2, curve: .easeInOut)) + if scrolledUp { + self.item.updateStatusBar(.White) + } else { + self.item.updateStatusBar(.Ignore) + } + if let hostView = self.hostView { hostView.center = CGPoint(x: layout.size.width / 2.0, y: hostView.frame.height / 2.0 - contentOffset) } diff --git a/submodules/StatisticsUI/Sources/ChannelStatsController.swift b/submodules/StatisticsUI/Sources/ChannelStatsController.swift index a6634ad10a..3ea0eefe0f 100644 --- a/submodules/StatisticsUI/Sources/ChannelStatsController.swift +++ b/submodules/StatisticsUI/Sources/ChannelStatsController.swift @@ -1103,6 +1103,7 @@ public func channelStatsController(context: AccountContext, updatedPresentationD var navigateToChatImpl: ((EnginePeer) -> Void)? var navigateToMessageImpl: ((EngineMessage.Id) -> Void)? var openBoostImpl: ((Bool) -> Void)? + var updateStatusBarImpl: ((StatusBarStyle) -> Void)? let arguments = ChannelStatsControllerArguments(context: context, loadDetailedGraph: { graph, x -> Signal in return statsContext.loadDetailedGraph(graph, x: x) @@ -1317,6 +1318,8 @@ public func channelStatsController(context: AccountContext, updatedPresentationD openBoostImpl?(true) }, back: { dismissImpl?() + }, updateStatusBar: { style in + updateStatusBarImpl?(style) }) leftNavigationButton = ItemListNavigationButton(content: .none, style: .regular, enabled: false, action: {}) boostsOnly = true @@ -1517,6 +1520,9 @@ public func channelStatsController(context: AccountContext, updatedPresentationD }) } } + updateStatusBarImpl = { [weak controller] style in + controller?.setStatusBarStyle(style, animated: true) + } return controller } diff --git a/submodules/TelegramUI/Components/Chat/ChatMessageGiveawayBubbleContentNode/Sources/ChatMessageGiveawayBubbleContentNode.swift b/submodules/TelegramUI/Components/Chat/ChatMessageGiveawayBubbleContentNode/Sources/ChatMessageGiveawayBubbleContentNode.swift index d04b61be2e..51fa4fc306 100644 --- a/submodules/TelegramUI/Components/Chat/ChatMessageGiveawayBubbleContentNode/Sources/ChatMessageGiveawayBubbleContentNode.swift +++ b/submodules/TelegramUI/Components/Chat/ChatMessageGiveawayBubbleContentNode/Sources/ChatMessageGiveawayBubbleContentNode.swift @@ -362,7 +362,11 @@ public class ChatMessageGiveawayBubbleContentNode: ChatMessageBubbleContentNode, let participantsText: String let countriesText: String - let isGroup = "".isEmpty + let author = item.message.forwardInfo?.author ?? item.message.author + var isGroup = false + if let channel = author as? TelegramChannel, case .group = channel.info { + isGroup = true + } if let giveaway { if giveaway.flags.contains(.onlyNewSubscribers) { diff --git a/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoScreen.swift b/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoScreen.swift index 310be1dcc6..7556a3c249 100644 --- a/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoScreen.swift +++ b/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoScreen.swift @@ -5733,8 +5733,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro } else if let channel = peer as? TelegramChannel { if let cachedData = strongSelf.data?.cachedData as? CachedChannelData { if case .group = channel.info { - //TODO:localized - items.append(.action(ContextMenuActionItem(text: "Boost Group", badge: ContextMenuActionBadge(value: "NEW", color: .accent, style: .label), icon: { theme in + items.append(.action(ContextMenuActionItem(text: presentationData.strings.PeerInfo_Group_Boost, badge: ContextMenuActionBadge(value: presentationData.strings.Settings_New, color: .accent, style: .label), icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Boost"), color: theme.contextMenu.primaryColor) }, action: { [weak self] _, f in f(.dismissWithoutContent) diff --git a/submodules/TelegramUI/Components/Settings/PeerNameColorScreen/BUILD b/submodules/TelegramUI/Components/Settings/PeerNameColorScreen/BUILD index 17f4fe21d2..e07e58d229 100644 --- a/submodules/TelegramUI/Components/Settings/PeerNameColorScreen/BUILD +++ b/submodules/TelegramUI/Components/Settings/PeerNameColorScreen/BUILD @@ -49,6 +49,7 @@ swift_library( "//submodules/TelegramUI/Components/Settings/BoostLevelIconComponent", "//submodules/Markdown", "//submodules/TelegramUI/Components/GroupStickerPackSetupController", + "//submodules/TelegramUI/Components/Chat/ChatMessageItemImpl", ], visibility = [ "//visibility:public", diff --git a/submodules/TelegramUI/Components/Settings/PeerNameColorScreen/Sources/ChannelAppearanceScreen.swift b/submodules/TelegramUI/Components/Settings/PeerNameColorScreen/Sources/ChannelAppearanceScreen.swift index 11ed2f1869..345bc56a0e 100644 --- a/submodules/TelegramUI/Components/Settings/PeerNameColorScreen/Sources/ChannelAppearanceScreen.swift +++ b/submodules/TelegramUI/Components/Settings/PeerNameColorScreen/Sources/ChannelAppearanceScreen.swift @@ -774,11 +774,11 @@ final class ChannelAppearanceScreenComponent: Component { if let result { self.cachedIconFiles[result.fileId.id] = result } - switch subject { - case .status: - self.updatedPeerStatus = (result?.fileId.id).flatMap { PeerEmojiStatus(fileId: $0, expirationDate: timestamp) } - default: - break + + if let result { + self.updatedPeerStatus = PeerEmojiStatus(fileId: result.fileId.id, expirationDate: timestamp) + } else { + self.updatedPeerStatus = .some(nil) } self.state?.updated(transition: .spring(duration: 0.4)) }) @@ -792,11 +792,19 @@ final class ChannelAppearanceScreenComponent: Component { } switch subject { case .reply: - self.updatedPeerNameEmoji = (result?.fileId.id) + if let result { + self.updatedPeerNameEmoji = result.fileId.id + } else { + self.updatedPeerNameEmoji = .some(nil) + } case .profile: - self.updatedPeerProfileEmoji = (result?.fileId.id) - case .status: - self.updatedPeerStatus = (result?.fileId.id).flatMap { PeerEmojiStatus(fileId: $0, expirationDate: nil) } + if let result { + self.updatedPeerProfileEmoji = result.fileId.id + } else { + self.updatedPeerProfileEmoji = .some(nil) + } + default: + break } self.state?.updated(transition: .spring(duration: 0.4)) }) @@ -1066,11 +1074,10 @@ final class ChannelAppearanceScreenComponent: Component { } } - //TODO:localize let navigationTitleSize = self.navigationTitle.update( transition: transition, component: AnyComponent(MultilineTextComponent( - text: .plain(NSAttributedString(string: "Appearance", font: Font.semibold(17.0), textColor: environment.theme.rootController.navigationBar.primaryTextColor)), + text: .plain(NSAttributedString(string: environment.strings.Channel_Appearance_Title, font: Font.semibold(17.0), textColor: environment.theme.rootController.navigationBar.primaryTextColor)), horizontalAlignment: .center )), environment: {}, @@ -1137,7 +1144,6 @@ final class ChannelAppearanceScreenComponent: Component { contentHeight += previewSectionSize.height contentHeight += sectionSpacing - 15.0 - //TODO:localize var boostContents: [AnyComponentWithIdentity] = [] boostContents.append(AnyComponentWithIdentity(id: 0, component: AnyComponent(BundleIconComponent( name: "Premium/Boost", @@ -1145,7 +1151,7 @@ final class ChannelAppearanceScreenComponent: Component { )))) boostContents.append(AnyComponentWithIdentity(id: 1, component: AnyComponent(MultilineTextComponent( text: .markdown( - text: isGroup ? "Members of your group can **boost** it so that it levels up and unlocks these features." : "Subscribers of your channel can **boost** it so that it levels up and unlocks these features.", + text: isGroup ? environment.strings.Group_Appearance_BoostInfo : environment.strings.Channel_Appearance_BoostInfo, attributes: MarkdownAttributes( body: MarkdownAttributeSet(font: Font.regular(presentationData.listsFontSize.baseDisplaySize / 17.0 * 14.0), textColor: environment.theme.list.itemPrimaryTextColor), bold: MarkdownAttributeSet(font: Font.semibold(presentationData.listsFontSize.baseDisplaySize / 17.0 * 14.0), textColor: environment.theme.list.itemPrimaryTextColor), @@ -1211,7 +1217,7 @@ final class ChannelAppearanceScreenComponent: Component { header: nil, footer: AnyComponent(MultilineTextComponent( text: .plain(NSAttributedString( - string: isGroup ? "Choose a color and a logo for the group's profile." : environment.strings.Channel_Appearance_ProfileFooter, + string: isGroup ? environment.strings.Group_Appearance_ProfileFooter : environment.strings.Channel_Appearance_ProfileFooter, font: Font.regular(presentationData.listsFontSize.itemListBaseHeaderFontSize), textColor: environment.theme.list.freeTextColor )), @@ -1324,11 +1330,10 @@ final class ChannelAppearanceScreenComponent: Component { } if isGroup { - //TODO:localize var emojiPackContents: [AnyComponentWithIdentity] = [] emojiPackContents.append(AnyComponentWithIdentity(id: 0, component: AnyComponent(MultilineTextComponent( text: .plain(NSAttributedString( - string: "Group Emoji Pack", + string: environment.strings.Group_Appearance_GroupEmoji, font: Font.regular(presentationData.listsFontSize.baseDisplaySize), textColor: environment.theme.list.itemPrimaryTextColor )), @@ -1354,7 +1359,7 @@ final class ChannelAppearanceScreenComponent: Component { header: nil, footer: AnyComponent(MultilineTextComponent( text: .plain(NSAttributedString( - string: "Choose an emoji pack that will be available to all members within the group.", + string: environment.strings.Group_Appearance_GroupEmojiFooter, font: Font.regular(presentationData.listsFontSize.itemListBaseHeaderFontSize), textColor: environment.theme.list.freeTextColor )), @@ -1397,7 +1402,7 @@ final class ChannelAppearanceScreenComponent: Component { var emojiStatusContents: [AnyComponentWithIdentity] = [] emojiStatusContents.append(AnyComponentWithIdentity(id: 0, component: AnyComponent(MultilineTextComponent( text: .plain(NSAttributedString( - string: isGroup ? "Group Emoji Status" : environment.strings.Channel_Appearance_Status, + string: isGroup ? environment.strings.Group_Appearance_Status : environment.strings.Channel_Appearance_Status, font: Font.regular(presentationData.listsFontSize.baseDisplaySize), textColor: environment.theme.list.itemPrimaryTextColor )), @@ -1416,7 +1421,7 @@ final class ChannelAppearanceScreenComponent: Component { header: nil, footer: AnyComponent(MultilineTextComponent( text: .plain(NSAttributedString( - string: isGroup ? "Choose a status that will be shown next to the group's name." : environment.strings.Channel_Appearance_StatusFooter, + string: isGroup ? environment.strings.Group_Appearance_StatusFooter : environment.strings.Channel_Appearance_StatusFooter, font: Font.regular(presentationData.listsFontSize.itemListBaseHeaderFontSize), textColor: environment.theme.list.freeTextColor )), @@ -1582,7 +1587,7 @@ final class ChannelAppearanceScreenComponent: Component { var wallpaperLogoContents: [AnyComponentWithIdentity] = [] wallpaperLogoContents.append(AnyComponentWithIdentity(id: 0, component: AnyComponent(MultilineTextComponent( text: .plain(NSAttributedString( - string: isGroup ? "Group Wallpaper" : environment.strings.Channel_Appearance_Wallpaper, + string: isGroup ? environment.strings.Group_Appearance_Wallpaper : environment.strings.Channel_Appearance_Wallpaper, font: Font.regular(presentationData.listsFontSize.baseDisplaySize), textColor: environment.theme.list.itemPrimaryTextColor )), @@ -1610,7 +1615,7 @@ final class ChannelAppearanceScreenComponent: Component { peerId: EnginePeer.Id(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(0)), author: peer.compactDisplayTitle, photo: peer.profileImageRepresentations, - nameColor: .blue, + nameColor: .red, backgroundEmojiId: nil, reply: (environment.strings.Appearance_PreviewReplyAuthor, environment.strings.Appearance_PreviewReplyText), linkPreview: nil, @@ -1704,7 +1709,7 @@ final class ChannelAppearanceScreenComponent: Component { header: nil, footer: AnyComponent(MultilineTextComponent( text: .plain(NSAttributedString( - string: isGroup ? "Set a wallpaper that will be visible for everyone in your group." : environment.strings.Channel_Appearance_WallpaperFooter, + string: isGroup ? environment.strings.Group_Appearance_WallpaperFooter : environment.strings.Channel_Appearance_WallpaperFooter, font: Font.regular(presentationData.listsFontSize.itemListBaseHeaderFontSize), textColor: environment.theme.list.freeTextColor )), @@ -1849,7 +1854,7 @@ public class ChannelAppearanceScreen: ViewControllerComponentContainer { ), navigationBarAppearance: .default, theme: .default, updatedPresentationData: updatedPresentationData) let presentationData = context.sharedContext.currentPresentationData.with { $0 } - self.title = "" //presentationData.strings.Channel_Appearance_Title + self.title = "" self.navigationItem.backBarButtonItem = UIBarButtonItem(title: presentationData.strings.Common_Back, style: .plain, target: nil, action: nil) self.navigationItem.leftBarButtonItem = UIBarButtonItem(customView: UIView()) diff --git a/submodules/TelegramUI/Components/Settings/PeerNameColorScreen/Sources/PeerNameColorChatPreviewItem.swift b/submodules/TelegramUI/Components/Settings/PeerNameColorScreen/Sources/PeerNameColorChatPreviewItem.swift index 4053e2464c..e175921398 100644 --- a/submodules/TelegramUI/Components/Settings/PeerNameColorScreen/Sources/PeerNameColorChatPreviewItem.swift +++ b/submodules/TelegramUI/Components/Settings/PeerNameColorScreen/Sources/PeerNameColorChatPreviewItem.swift @@ -12,6 +12,7 @@ import PresentationDataUtils import AccountContext import WallpaperBackgroundNode import ListItemComponentAdaptor +import ChatMessageItemImpl final class PeerNameColorChatPreviewItem: ListViewItem, ItemListItem, ListItemComponentAdaptor.ItemGenerator { struct MessageItem: Equatable { @@ -318,8 +319,8 @@ final class PeerNameColorChatPreviewItemNode: ListViewItemNode { node.updateFrame(CGRect(origin: CGPoint(x: 0.0, y: topOffset), size: node.frame.size), within: layoutSize) topOffset += node.frame.size.height - if let header = node.headers()?.last { - let headerFrame = CGRect(origin: CGPoint(x: 0.0, y: 7.0), size: CGSize(width: layoutSize.width, height: header.height)) + if let header = node.headers()?.first(where: { $0 is ChatMessageAvatarHeader }) { + let headerFrame = CGRect(origin: CGPoint(x: 0.0, y: 3.0 + node.frame.minY), size: CGSize(width: layoutSize.width, height: header.height)) let stickLocationDistanceFactor: CGFloat = 0.0 let id = header.id diff --git a/submodules/TelegramUI/Components/ShareWithPeersScreen/Sources/ShareWithPeersScreen.swift b/submodules/TelegramUI/Components/ShareWithPeersScreen/Sources/ShareWithPeersScreen.swift index 6906d2abfd..6528b0fefa 100644 --- a/submodules/TelegramUI/Components/ShareWithPeersScreen/Sources/ShareWithPeersScreen.swift +++ b/submodules/TelegramUI/Components/ShareWithPeersScreen/Sources/ShareWithPeersScreen.swift @@ -1469,9 +1469,8 @@ final class ShareWithPeersScreenComponent: Component { title = environment.strings.BoostGift_Channels_PrivateChannel_Title text = environment.strings.BoostGift_Channels_PrivateChannel_Text case .group: - //TODO:localize - title = "Group is Private" - text = "Are you sure you want to add a private group? Users won't be able to join it without an invite link." + title = environment.strings.BoostGift_Groups_PrivateGroup_Title + text = environment.strings.BoostGift_Groups_PrivateGroup_Text } let alertController = textAlertController( @@ -1704,7 +1703,7 @@ final class ShareWithPeersScreenComponent: Component { searchQuery = query } else if case let .members(_, query) = searchStateContext.subject { searchQuery = query - } else if case let .channels(_, query) = searchStateContext.subject { + } else if case let .channels(_, _, query) = searchStateContext.subject { searchQuery = query } searchResultsAreEmpty = value.peers.isEmpty @@ -2089,8 +2088,8 @@ final class ShareWithPeersScreenComponent: Component { let searchSubject: ShareWithPeersScreen.StateContext.Subject switch component.stateContext.subject { - case let .channels(exclude, _): - searchSubject = .channels(exclude: exclude, searchQuery: searchQuery) + case let .channels(isGroup, exclude, _): + searchSubject = .channels(isGroup: isGroup, exclude: exclude, searchQuery: searchQuery) case let .members(peerId, _): searchSubject = .members(peerId: peerId, searchQuery: searchQuery) default: @@ -2394,11 +2393,10 @@ final class ShareWithPeersScreenComponent: Component { title = environment.strings.BoostGift_Subscribers_Title subtitle = environment.strings.BoostGift_Subscribers_Subtitle("\(10)").string actionButtonTitle = environment.strings.BoostGift_Subscribers_Save - case .channels: - //TODO:localize - title = "Add Groups or Channels"// environment.strings.BoostGift_Channels_Title - subtitle = "select up to \(component.context.userLimits.maxGiveawayChannelsCount) groups or channels" //environment.strings.BoostGift_Channels_Subtitle("\(component.context.userLimits.maxGiveawayChannelsCount)").string - actionButtonTitle = "Save Groups and Channels" // environment.strings.BoostGift_Channels_Save + case let .channels(isGroup, _, _): + title = isGroup ? environment.strings.BoostGift_GroupsOrChannels_Title : environment.strings.BoostGift_ChannelsOrGroups_Title + subtitle = isGroup ? environment.strings.BoostGift_GroupsOrChannels_Subtitle("\(component.context.userLimits.maxGiveawayChannelsCount)").string : environment.strings.BoostGift_ChannelsOrGroups_Subtitle("\(component.context.userLimits.maxGiveawayChannelsCount)").string + actionButtonTitle = isGroup ? environment.strings.BoostGift_GroupsOrChannels_Save : environment.strings.BoostGift_ChannelsOrGroups_Save } let titleComponent: AnyComponent diff --git a/submodules/TelegramUI/Components/ShareWithPeersScreen/Sources/ShareWithPeersScreenState.swift b/submodules/TelegramUI/Components/ShareWithPeersScreen/Sources/ShareWithPeersScreenState.swift index 715bad782b..e84c619727 100644 --- a/submodules/TelegramUI/Components/ShareWithPeersScreen/Sources/ShareWithPeersScreenState.swift +++ b/submodules/TelegramUI/Components/ShareWithPeersScreen/Sources/ShareWithPeersScreenState.swift @@ -49,7 +49,7 @@ public extension ShareWithPeersScreen { case contacts(base: EngineStoryPrivacy.Base) case contactsSearch(query: String, onlyContacts: Bool) case members(peerId: EnginePeer.Id, searchQuery: String?) - case channels(exclude: Set, searchQuery: String?) + case channels(isGroup: Bool, exclude: Set, searchQuery: String?) } var stateValue: State? @@ -590,7 +590,7 @@ public extension ShareWithPeersScreen { self.stateDisposable = combinedDisposable self.listControl = disposableAndLoadMoreControl.1 - case let .channels(excludePeerIds, searchQuery): + case let .channels(_, excludePeerIds, searchQuery): self.stateDisposable = (combineLatest( context.engine.messages.chatList(group: .root, count: 500) |> take(1), searchQuery.flatMap { context.engine.contacts.searchLocalPeers(query: $0) } ?? .single([]), diff --git a/submodules/TelegramUI/Sources/ChatController.swift b/submodules/TelegramUI/Sources/ChatController.swift index b5a9a95f58..0214fafc08 100644 --- a/submodules/TelegramUI/Sources/ChatController.swift +++ b/submodules/TelegramUI/Sources/ChatController.swift @@ -15687,27 +15687,11 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G location: .point(rect.offsetBy(dx: 0.0, dy: -3.0), .bottom), displayDuration: .default, cornerRadius: 10.0, - shouldDismissOnTouch: { point, _ in + shouldDismissOnTouch: { _, _ in return .ignore } ) self.present(tooltipScreen, in: .current) - - -// self.emojiTooltipController?.dismiss() -// let tooltipController = TooltipController(content: .attributedText(text), baseFontSize: self.presentationData.listsFontSize.baseDisplaySize, timeout: 3.0, dismissByTapOutside: true, dismissImmediatelyOnLayoutUpdate: true, padding: 8.0) -// self.emojiTooltipController = tooltipController -// tooltipController.dismissed = { [weak self, weak tooltipController] _ in -// if let strongSelf = self, let tooltipController = tooltipController, strongSelf.emojiTooltipController === tooltipController { -// strongSelf.emojiTooltipController = nil -// } -// } -// self.present(tooltipController, in: .window(.root), with: TooltipControllerPresentationArguments(sourceNodeAndRect: { [weak self] in -// if let strongSelf = self { -// return (strongSelf.chatDisplayNode, rect.offsetBy(dx: 0.0, dy: -3.0)) -// } -// return nil -// })) }) }