diff --git a/Telegram/Telegram-iOS/en.lproj/Localizable.strings b/Telegram/Telegram-iOS/en.lproj/Localizable.strings index 1bd2b687b6..18d1574745 100644 --- a/Telegram/Telegram-iOS/en.lproj/Localizable.strings +++ b/Telegram/Telegram-iOS/en.lproj/Localizable.strings @@ -11043,7 +11043,7 @@ Sorry for the inconvenience."; "ChannelBoost.Table.Group.Wallpaper_any" = "%@ Group Backgrounds"; "ChannelBoost.Table.Group.CustomWallpaper" = "Custom Group Background"; -"Premium.Group.BoostByGiftDescription" = "Boost your group by gifting your subscribers Telegram Premium. [Get boosts >]()"; +"Premium.Group.BoostByGiftDescription" = "Boost your group by gifting your members Telegram Premium. [Get boosts >]()"; "Conversation.BoostGroup" = "BOOST"; @@ -11307,3 +11307,7 @@ Sorry for the inconvenience."; "Story.GroupCommentingRestrictedPlaceholder" = "Comments restricted. Boost the group to unlock."; "Story.GroupCommentingRestrictedPlaceholderAction" = "Learn More..."; + +"GroupBoost.Table.Group.VoiceToText" = "Voice-to-Text Conversion"; +"GroupBoost.Table.Group.EmojiPack" = "Custom Emojipack"; + diff --git a/submodules/AttachmentUI/Sources/AttachmentPanel.swift b/submodules/AttachmentUI/Sources/AttachmentPanel.swift index 7bbc49b32c..77938c59f7 100644 --- a/submodules/AttachmentUI/Sources/AttachmentPanel.swift +++ b/submodules/AttachmentUI/Sources/AttachmentPanel.swift @@ -983,6 +983,7 @@ final class AttachmentPanel: ASDisplayNode, UIScrollViewDelegate { }, openPremiumGift: { }, openPremiumRequiredForMessaging: { }, openBoostToUnrestrict: { + }, updateVideoTrimRange: { _, _, _, _ in }, updateHistoryFilter: { _ in }, updateDisplayHistoryFilterAsList: { _ in }, requestLayout: { _ in diff --git a/submodules/ChatPresentationInterfaceState/Sources/ChatPanelInterfaceInteraction.swift b/submodules/ChatPresentationInterfaceState/Sources/ChatPanelInterfaceInteraction.swift index efdb69cdfb..02ad1afa74 100644 --- a/submodules/ChatPresentationInterfaceState/Sources/ChatPanelInterfaceInteraction.swift +++ b/submodules/ChatPresentationInterfaceState/Sources/ChatPanelInterfaceInteraction.swift @@ -176,6 +176,7 @@ public final class ChatPanelInterfaceInteraction { public let updateHistoryFilter: ((ChatPresentationInterfaceState.HistoryFilter?) -> ChatPresentationInterfaceState.HistoryFilter?) -> Void public let updateDisplayHistoryFilterAsList: (Bool) -> Void public let openBoostToUnrestrict: () -> Void + public let updateVideoTrimRange: (Double, Double, Bool, Bool) -> Void public let requestLayout: (ContainedViewLayoutTransition) -> Void public let chatController: () -> ViewController? public let statuses: ChatPanelInterfaceInteractionStatuses? @@ -286,6 +287,7 @@ public final class ChatPanelInterfaceInteraction { openPremiumGift: @escaping () -> Void, openPremiumRequiredForMessaging: @escaping () -> Void, openBoostToUnrestrict: @escaping () -> Void, + updateVideoTrimRange: @escaping (Double, Double, Bool, Bool) -> Void, updateHistoryFilter: @escaping ((ChatPresentationInterfaceState.HistoryFilter?) -> ChatPresentationInterfaceState.HistoryFilter?) -> Void, updateDisplayHistoryFilterAsList: @escaping (Bool) -> Void, requestLayout: @escaping (ContainedViewLayoutTransition) -> Void, @@ -397,6 +399,7 @@ public final class ChatPanelInterfaceInteraction { self.openPremiumGift = openPremiumGift self.openPremiumRequiredForMessaging = openPremiumRequiredForMessaging self.openBoostToUnrestrict = openBoostToUnrestrict + self.updateVideoTrimRange = updateVideoTrimRange self.updateHistoryFilter = updateHistoryFilter self.updateDisplayHistoryFilterAsList = updateDisplayHistoryFilterAsList self.requestLayout = requestLayout @@ -516,6 +519,7 @@ public final class ChatPanelInterfaceInteraction { }, openPremiumGift: { }, openPremiumRequiredForMessaging: { }, openBoostToUnrestrict: { + }, updateVideoTrimRange: { _, _, _, _ in }, updateHistoryFilter: { _ in }, updateDisplayHistoryFilterAsList: { _ in }, requestLayout: { _ in diff --git a/submodules/PremiumUI/Sources/PremiumBoostLevelsScreen.swift b/submodules/PremiumUI/Sources/PremiumBoostLevelsScreen.swift index 9102055055..1c97beee06 100644 --- a/submodules/PremiumUI/Sources/PremiumBoostLevelsScreen.swift +++ b/submodules/PremiumUI/Sources/PremiumBoostLevelsScreen.swift @@ -271,9 +271,9 @@ private final class LevelSectionComponent: CombinedComponent { case .customWallpaper: return isGroup ? strings.ChannelBoost_Table_Group_CustomWallpaper : strings.ChannelBoost_Table_CustomWallpaper case .audioTranscription: - return "Voice-to-Text Conversion" + return strings.GroupBoost_Table_Group_VoiceToText case .emojiPack: - return "Custom Emojipack" + return strings.GroupBoost_Table_Group_EmojiPack } } @@ -2234,12 +2234,12 @@ public class PremiumBoostLevelsScreen: ViewController { self.myBoostCount += 1 let _ = (context.engine.peers.applyChannelBoost(peerId: peerId, slots: [availableBoost.slot]) - |> deliverOnMainQueue).startStandalone(completed: { [weak self] in + |> deliverOnMainQueue).startStandalone(next: { [weak self] myBoostStatus in self?.updatedState.set(context.engine.peers.getChannelBoostStatus(peerId: peerId) - |> beforeNext { [weak self] status in - if let self, let status { + |> beforeNext { [weak self] boostStatus in + if let self, let boostStatus, let myBoostStatus { Queue.mainQueue().async { - self.controller?.boostStatusUpdated(status) + self.controller?.boostStatusUpdated(boostStatus, myBoostStatus) } } } @@ -2293,8 +2293,8 @@ public class PremiumBoostLevelsScreen: ViewController { ).startStandalone(next: { boostStatus, myBoostStatus in dismissReplaceImpl?() - if let boostStatus { - boostStatusUpdated(boostStatus) + if let boostStatus, let myBoostStatus { + boostStatusUpdated(boostStatus, myBoostStatus) } let levelsController = PremiumBoostLevelsScreen( @@ -2466,7 +2466,7 @@ public class PremiumBoostLevelsScreen: ViewController { private var currentLayout: ContainerViewLayout? - public var boostStatusUpdated: (ChannelBoostStatus) -> Void = { _ in } + public var boostStatusUpdated: (ChannelBoostStatus, MyBoostStatus) -> Void = { _, _ in } public var disposed: () -> Void = {} public init( diff --git a/submodules/StatisticsUI/Sources/ChannelStatsController.swift b/submodules/StatisticsUI/Sources/ChannelStatsController.swift index 57ca6ab5b5..1e28116b26 100644 --- a/submodules/StatisticsUI/Sources/ChannelStatsController.swift +++ b/submodules/StatisticsUI/Sources/ChannelStatsController.swift @@ -1519,9 +1519,13 @@ public func channelStatsController(context: AccountContext, updatedPresentationD peerId: peerId, mode: .owner(subject: nil), status: boostStatus, - myBoostStatus: myBoostStatus + myBoostStatus: myBoostStatus, + openGift: { [weak controller] in + let giveawayController = createGiveawayController(context: context, peerId: peerId, subject: .generic) + controller?.push(giveawayController) + } ) - boostController.boostStatusUpdated = { boostStatus in + boostController.boostStatusUpdated = { boostStatus, _ in boostDataPromise.set(.single(boostStatus)) } controller?.push(boostController) diff --git a/submodules/TelegramUI/Components/Chat/ChatRecentActionsController/Sources/ChatRecentActionsController.swift b/submodules/TelegramUI/Components/Chat/ChatRecentActionsController/Sources/ChatRecentActionsController.swift index 5ddd2090b0..76bab24066 100644 --- a/submodules/TelegramUI/Components/Chat/ChatRecentActionsController/Sources/ChatRecentActionsController.swift +++ b/submodules/TelegramUI/Components/Chat/ChatRecentActionsController/Sources/ChatRecentActionsController.swift @@ -169,6 +169,7 @@ public final class ChatRecentActionsController: TelegramBaseController { }, openPremiumGift: { }, openPremiumRequiredForMessaging: { }, openBoostToUnrestrict: { + }, updateVideoTrimRange: { _, _, _, _ in }, updateHistoryFilter: { _ in }, updateDisplayHistoryFilterAsList: { _ in }, requestLayout: { _ in diff --git a/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoScreen.swift b/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoScreen.swift index 406865a1bc..15fe1bade6 100644 --- a/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoScreen.swift +++ b/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoScreen.swift @@ -419,6 +419,7 @@ final class PeerInfoSelectionPanelNode: ASDisplayNode { }, openPremiumGift: { }, openPremiumRequiredForMessaging: { }, openBoostToUnrestrict: { + }, updateVideoTrimRange: { _, _, _, _ in }, updateHistoryFilter: { _ in }, updateDisplayHistoryFilterAsList: { _ in }, requestLayout: { _ in @@ -1723,7 +1724,7 @@ private func editingItems(data: PeerInfoScreenData?, state: PeerInfoState, chatL } } - if let cachedData = data.cachedData as? CachedChannelData, cachedData.flags.contains(.canViewStats) { + if let cachedData = data.cachedData as? CachedChannelData, isCreator || cachedData.flags.contains(.canViewStats) { items[.peerAdditionalSettings]!.append(PeerInfoScreenDisclosureItem(id: ItemStats, label: .none, text: presentationData.strings.Channel_Info_Stats, icon: UIImage(bundleImageName: "Chat/Info/StatsIcon"), action: { interaction.openStats(false) })) diff --git a/submodules/TelegramUI/Components/PeerSelectionController/Sources/PeerSelectionControllerNode.swift b/submodules/TelegramUI/Components/PeerSelectionController/Sources/PeerSelectionControllerNode.swift index 6cb9794bee..a062fe259d 100644 --- a/submodules/TelegramUI/Components/PeerSelectionController/Sources/PeerSelectionControllerNode.swift +++ b/submodules/TelegramUI/Components/PeerSelectionController/Sources/PeerSelectionControllerNode.swift @@ -733,6 +733,7 @@ final class PeerSelectionControllerNode: ASDisplayNode { }, openPremiumGift: { }, openPremiumRequiredForMessaging: { }, openBoostToUnrestrict: { + }, updateVideoTrimRange: { _, _, _, _ in }, updateHistoryFilter: { _ in }, updateDisplayHistoryFilterAsList: { _ in }, requestLayout: { _ in diff --git a/submodules/TelegramUI/Components/Settings/PeerNameColorScreen/Sources/ChannelAppearanceScreen.swift b/submodules/TelegramUI/Components/Settings/PeerNameColorScreen/Sources/ChannelAppearanceScreen.swift index 187fa627ab..1d7f49bec2 100644 --- a/submodules/TelegramUI/Components/Settings/PeerNameColorScreen/Sources/ChannelAppearanceScreen.swift +++ b/submodules/TelegramUI/Components/Settings/PeerNameColorScreen/Sources/ChannelAppearanceScreen.swift @@ -304,6 +304,7 @@ final class ChannelAppearanceScreenComponent: Component { private var premiumConfiguration: PremiumConfiguration? private var boostLevel: Int? private var boostStatus: ChannelBoostStatus? + private var myBoostStatus: MyBoostStatus? private var boostStatusDisposable: Disposable? private var isApplyingSettings: Bool = false @@ -656,6 +657,7 @@ final class ChannelAppearanceScreenComponent: Component { peerId: component.peerId, mode: .owner(subject: subject), status: status, + myBoostStatus: myBoostStatus, openStats: { [weak self] in guard let self else { return @@ -670,6 +672,14 @@ final class ChannelAppearanceScreenComponent: Component { self.environment?.controller()?.push(controller) } ) + controller.boostStatusUpdated = { [weak self] boostStatus, myBoostStatus in + if let self { + self.boostStatus = boostStatus + self.boostLevel = boostStatus.level + self.myBoostStatus = myBoostStatus + self.state?.updated(transition: .immediate) + } + } self.environment?.controller()?.push(controller) HapticFeedback().impact(.light) @@ -924,13 +934,16 @@ final class ChannelAppearanceScreenComponent: Component { }) } if self.boostStatusDisposable == nil { - self.boostStatusDisposable = (component.context.engine.peers.getChannelBoostStatus(peerId: component.peerId) - |> deliverOnMainQueue).start(next: { [weak self] boostStatus in + self.boostStatusDisposable = combineLatest(queue: Queue.mainQueue(), + component.context.engine.peers.getChannelBoostStatus(peerId: component.peerId), + component.context.engine.peers.getMyBoostStatus() + ).start(next: { [weak self] boostStatus, myBoostStatus in guard let self else { return } self.boostLevel = boostStatus?.level self.boostStatus = boostStatus + self.myBoostStatus = myBoostStatus if !self.isUpdating { self.state?.updated(transition: .immediate) diff --git a/submodules/TelegramUI/Sources/ChatController.swift b/submodules/TelegramUI/Sources/ChatController.swift index 6ea3fb7ff7..8bb7463ceb 100644 --- a/submodules/TelegramUI/Sources/ChatController.swift +++ b/submodules/TelegramUI/Sources/ChatController.swift @@ -11096,6 +11096,10 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G ) self.push(boostController) }) + }, updateVideoTrimRange: { [weak self] start, end, updatedEnd, apply in + if let videoRecorder = self?.videoRecorderValue { + videoRecorder.updateTrimRange(start: start, end: end, updatedEnd: updatedEnd, apply: apply) + } }, updateHistoryFilter: { [weak self] update in guard let self else { return diff --git a/submodules/TelegramUI/Sources/ChatRecordingPreviewInputPanelNode.swift b/submodules/TelegramUI/Sources/ChatRecordingPreviewInputPanelNode.swift index 3789f17201..6f11af4fe4 100644 --- a/submodules/TelegramUI/Sources/ChatRecordingPreviewInputPanelNode.swift +++ b/submodules/TelegramUI/Sources/ChatRecordingPreviewInputPanelNode.swift @@ -328,8 +328,10 @@ final class ChatRecordingPreviewInputPanelNode: ChatInputPanelNode { ) ], positionUpdated: { _, _ in }, - trackTrimUpdated: { _, start, end, updatedEnd, apply in -// video.control.updateTrimRange(start, end, updatedEnd, apply) + trackTrimUpdated: { [weak self] _, start, end, updatedEnd, apply in + if let self { + self.interfaceInteraction?.updateVideoTrimRange(start, end, updatedEnd, apply) + } }, trackOffsetUpdated: { _, _, _ in }, trackLongPressed: { _, _ in } diff --git a/versions.json b/versions.json index e422f9cd49..e8765ba952 100644 --- a/versions.json +++ b/versions.json @@ -1,5 +1,5 @@ { - "app": "10.8", + "app": "10.8.1", "bazel": "7.0.2", "xcode": "15.2", "macos": "13.0"