Various fixes

This commit is contained in:
Ilya Laktyushin
2022-11-18 21:20:54 +04:00
parent 09e79fc38c
commit bc9f917e10
7 changed files with 147 additions and 58 deletions

View File

@@ -224,6 +224,8 @@ final class ChatMessageInteractiveFileNode: ASDisplayNode {
}
private var isWaitingForCollapse: Bool = false
private var hapticFeedback: HapticFeedback?
override init() {
self.titleNode = TextNode()
self.titleNode.displaysAsynchronously = false
@@ -355,11 +357,23 @@ final class ChatMessageInteractiveFileNode: ASDisplayNode {
}
guard arguments.associatedData.isPremium else {
if self.hapticFeedback == nil {
self.hapticFeedback = HapticFeedback()
}
self.hapticFeedback?.impact(.medium)
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
let tipController = UndoOverlayController(presentationData: presentationData, content: .universal(animation: "anim_voiceToText", scale: 0.065, colors: [:], title: nil, text: presentationData.strings.Message_AudioTranscription_SubscribeToPremium, customUndoText: presentationData.strings.Message_AudioTranscription_SubscribeToPremiumAction), elevatedLayout: false, position: .top, animateInAsReplacement: false, action: { action in
if case .undo = action {
let introController = context.sharedContext.makePremiumIntroController(context: context, source: .settings)
arguments.controllerInteraction.navigationController()?.pushViewController(introController, animated: true)
var replaceImpl: ((ViewController) -> Void)?
let controller = context.sharedContext.makePremiumDemoController(context: context, subject: .voiceToText, action: {
let controller = context.sharedContext.makePremiumIntroController(context: context, source: .settings)
replaceImpl?(controller)
})
replaceImpl = { [weak controller] c in
controller?.replace(with: c)
}
arguments.controllerInteraction.navigationController()?.pushViewController(controller, animated: true)
let _ = ApplicationSpecificNotice.incrementAudioTranscriptionSuggestion(accountManager: context.sharedContext.accountManager).start()
}