diff --git a/Telegram/Telegram-iOS/en.lproj/Localizable.strings b/Telegram/Telegram-iOS/en.lproj/Localizable.strings index 9690eab09b..2f3ea5fe2b 100644 --- a/Telegram/Telegram-iOS/en.lproj/Localizable.strings +++ b/Telegram/Telegram-iOS/en.lproj/Localizable.strings @@ -9868,3 +9868,5 @@ Sorry for the inconvenience."; "Story.Privacy.PostStoryAsHeader" = "POST STORY AS"; "Story.Privacy.KeepOnChannelPage" = "Post to Channel Profile"; "Story.Privacy.KeepOnChannelPageInfo" = "Keep this story on channel profile even after it expires in %@."; + +"Story.Editor.TooltipPremiumReaction" = "Subscribe to [Telegram Premium]() to use this reaction."; diff --git a/submodules/DrawingUI/Sources/DrawingEntitiesView.swift b/submodules/DrawingUI/Sources/DrawingEntitiesView.swift index 505d0748bb..c16940bbef 100644 --- a/submodules/DrawingUI/Sources/DrawingEntitiesView.swift +++ b/submodules/DrawingUI/Sources/DrawingEntitiesView.swift @@ -75,6 +75,8 @@ public final class DrawingEntitiesView: UIView, TGPhotoDrawingEntitiesView { public var getEntityAdditionalScale: () -> CGFloat = { return 1.0 } public var getAvailableReactions: () -> [ReactionItem] = { return [] } + public var present: (ViewController) -> Void = { _ in } + public var push: (ViewController) -> Void = { _ in } public var hasSelectionChanged: (Bool) -> Void = { _ in } var selectionChanged: (DrawingEntity?) -> Void = { _ in } diff --git a/submodules/DrawingUI/Sources/DrawingStickerEntity.swift b/submodules/DrawingUI/Sources/DrawingStickerEntity.swift index 813fb79951..c31b1e5969 100644 --- a/submodules/DrawingUI/Sources/DrawingStickerEntity.swift +++ b/submodules/DrawingUI/Sources/DrawingStickerEntity.swift @@ -541,50 +541,21 @@ public final class DrawingStickerEntityView: DrawingEntityView { } reactionContextNode.premiumReactionsSelected = { [weak self] file in - let _ = self - let _ = file -// guard let self, let component = self.component else { -// return -// } -// -// guard let file else { -// let context = component.context -// var replaceImpl: ((ViewController) -> Void)? -// let controller = PremiumDemoScreen(context: context, subject: .uniqueReactions, forceDark: true, action: { -// let controller = PremiumIntroScreen(context: context, source: .reactions) -// replaceImpl?(controller) -// }) -// controller.disposed = { [weak self] in -// self?.updateIsProgressPaused() -// } -// replaceImpl = { [weak controller] c in -// controller?.replace(with: c) -// } -// component.controller()?.push(controller) -// return -// } -// -// let presentationData = component.context.sharedContext.currentPresentationData.with { $0 } -// let undoController = UndoOverlayController(presentationData: presentationData, content: .sticker(context: component.context, file: file, loop: true, title: nil, text: presentationData.strings.Chat_PremiumReactionToastTitle, undoText: presentationData.strings.Chat_PremiumReactionToastAction, customAction: { [weak self] in -// guard let self, let component = self.component else { -// return -// } -// -// let context = component.context -// var replaceImpl: ((ViewController) -> Void)? -// let controller = PremiumDemoScreen(context: context, subject: .uniqueReactions, forceDark: true, action: { -// let controller = PremiumIntroScreen(context: context, source: .reactions) -// replaceImpl?(controller) -// }) -// controller.disposed = { [weak self] in -// self?.updateIsProgressPaused() -// } -// replaceImpl = { [weak controller] c in -// controller?.replace(with: c) -// } -// component.controller()?.push(controller) -// }), elevatedLayout: false, animateInAsReplacement: false, blurred: true, action: { _ in true }) -// component.controller()?.present(undoController, in: .current) + guard let self, let file else { + return + } + + let context = self.context + let presentationData = context.sharedContext.currentPresentationData.with { $0 } + + let controller = UndoOverlayController(presentationData: presentationData, content: .sticker(context: context, file: file, loop: true, title: nil, text: presentationData.strings.Story_Editor_TooltipPremiumReaction, undoText: nil, customAction: nil), elevatedLayout: true, animateInAsReplacement: false, blurred: true, action: { [weak self] action in + if case .info = action, let self { + let controller = context.sharedContext.makePremiumIntroController(context: context, source: .storiesExpirationDurations, forceDark: true, dismissed: nil) + self.containerView?.push(controller) + } + return false + }) + self.containerView?.present(controller) } let anchorRect = self.convert(self.bounds, to: superview).offsetBy(dx: 0.0, dy: -20.0) diff --git a/submodules/TelegramUI/Components/MediaEditorScreen/Sources/MediaEditorScreen.swift b/submodules/TelegramUI/Components/MediaEditorScreen/Sources/MediaEditorScreen.swift index f14ec8c66e..629d467a2a 100644 --- a/submodules/TelegramUI/Components/MediaEditorScreen/Sources/MediaEditorScreen.swift +++ b/submodules/TelegramUI/Components/MediaEditorScreen/Sources/MediaEditorScreen.swift @@ -1950,6 +1950,17 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate self.entitiesView.getAvailableReactions = { [weak self] in return self?.availableReactions ?? [] } + self.entitiesView.present = { [weak self] c in + if let self { + self.controller?.dismissAllTooltips() + self.controller?.present(c, in: .current) + } + } + self.entitiesView.push = { [weak self] c in + if let self { + self.controller?.push(c) + } + } self.availableReactionsDisposable = (allowedStoryReactions(context: controller.context) |> deliverOnMainQueue).start(next: { [weak self] reactions in @@ -3959,8 +3970,8 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate let controller = context.sharedContext.makePremiumIntroController(context: context, source: .storiesExpirationDurations, forceDark: true, dismissed: nil) self.push(controller) } - return false } - ) + return false + }) self.present(controller, in: .current) } @@ -3980,8 +3991,8 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate }) self.push(controller) } - return false } - ) + return false + }) self.present(controller, in: .current) } diff --git a/submodules/UndoUI/Sources/UndoOverlayControllerNode.swift b/submodules/UndoUI/Sources/UndoOverlayControllerNode.swift index 3b3df76ba3..656409d491 100644 --- a/submodules/UndoUI/Sources/UndoOverlayControllerNode.swift +++ b/submodules/UndoUI/Sources/UndoOverlayControllerNode.swift @@ -766,7 +766,7 @@ final class UndoOverlayControllerNode: ViewControllerTracingNode { let body = MarkdownAttributeSet(font: Font.regular(14.0), textColor: .white) let bold = MarkdownAttributeSet(font: Font.semibold(14.0), textColor: .white) - let link = MarkdownAttributeSet(font: Font.regular(14.0), textColor: undoTextColor) + let link = MarkdownAttributeSet(font: Font.semibold(14.0), textColor: undoTextColor) let attributedText = parseMarkdownIntoAttributedString(text, attributes: MarkdownAttributes(body: body, bold: bold, link: link, linkAttribute: { contents in return ("URL", contents) }), textAlignment: .natural)