Premium story reactions info

This commit is contained in:
Ilya Laktyushin 2023-08-30 14:29:49 +04:00
parent 517337de27
commit 9fd6b9369f
5 changed files with 35 additions and 49 deletions

View File

@ -9868,3 +9868,5 @@ Sorry for the inconvenience.";
"Story.Privacy.PostStoryAsHeader" = "POST STORY AS"; "Story.Privacy.PostStoryAsHeader" = "POST STORY AS";
"Story.Privacy.KeepOnChannelPage" = "Post to Channel Profile"; "Story.Privacy.KeepOnChannelPage" = "Post to Channel Profile";
"Story.Privacy.KeepOnChannelPageInfo" = "Keep this story on channel profile even after it expires in %@."; "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.";

View File

@ -75,6 +75,8 @@ public final class DrawingEntitiesView: UIView, TGPhotoDrawingEntitiesView {
public var getEntityAdditionalScale: () -> CGFloat = { return 1.0 } public var getEntityAdditionalScale: () -> CGFloat = { return 1.0 }
public var getAvailableReactions: () -> [ReactionItem] = { return [] } public var getAvailableReactions: () -> [ReactionItem] = { return [] }
public var present: (ViewController) -> Void = { _ in }
public var push: (ViewController) -> Void = { _ in }
public var hasSelectionChanged: (Bool) -> Void = { _ in } public var hasSelectionChanged: (Bool) -> Void = { _ in }
var selectionChanged: (DrawingEntity?) -> Void = { _ in } var selectionChanged: (DrawingEntity?) -> Void = { _ in }

View File

@ -541,50 +541,21 @@ public final class DrawingStickerEntityView: DrawingEntityView {
} }
reactionContextNode.premiumReactionsSelected = { [weak self] file in reactionContextNode.premiumReactionsSelected = { [weak self] file in
let _ = self guard let self, let file else {
let _ = file return
// guard let self, let component = self.component else { }
// return
// } let context = self.context
// let presentationData = context.sharedContext.currentPresentationData.with { $0 }
// guard let file else {
// let context = component.context 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
// var replaceImpl: ((ViewController) -> Void)? if case .info = action, let self {
// let controller = PremiumDemoScreen(context: context, subject: .uniqueReactions, forceDark: true, action: { let controller = context.sharedContext.makePremiumIntroController(context: context, source: .storiesExpirationDurations, forceDark: true, dismissed: nil)
// let controller = PremiumIntroScreen(context: context, source: .reactions) self.containerView?.push(controller)
// replaceImpl?(controller) }
// }) return false
// controller.disposed = { [weak self] in })
// self?.updateIsProgressPaused() self.containerView?.present(controller)
// }
// 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)
} }
let anchorRect = self.convert(self.bounds, to: superview).offsetBy(dx: 0.0, dy: -20.0) let anchorRect = self.convert(self.bounds, to: superview).offsetBy(dx: 0.0, dy: -20.0)

View File

@ -1950,6 +1950,17 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
self.entitiesView.getAvailableReactions = { [weak self] in self.entitiesView.getAvailableReactions = { [weak self] in
return self?.availableReactions ?? [] 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) self.availableReactionsDisposable = (allowedStoryReactions(context: controller.context)
|> deliverOnMainQueue).start(next: { [weak self] reactions in |> 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) let controller = context.sharedContext.makePremiumIntroController(context: context, source: .storiesExpirationDurations, forceDark: true, dismissed: nil)
self.push(controller) self.push(controller)
} }
return false } return false
) })
self.present(controller, in: .current) self.present(controller, in: .current)
} }
@ -3980,8 +3991,8 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
}) })
self.push(controller) self.push(controller)
} }
return false } return false
) })
self.present(controller, in: .current) self.present(controller, in: .current)
} }

View File

@ -766,7 +766,7 @@ final class UndoOverlayControllerNode: ViewControllerTracingNode {
let body = MarkdownAttributeSet(font: Font.regular(14.0), textColor: .white) let body = MarkdownAttributeSet(font: Font.regular(14.0), textColor: .white)
let bold = MarkdownAttributeSet(font: Font.semibold(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 let attributedText = parseMarkdownIntoAttributedString(text, attributes: MarkdownAttributes(body: body, bold: bold, link: link, linkAttribute: { contents in
return ("URL", contents) return ("URL", contents)
}), textAlignment: .natural) }), textAlignment: .natural)