@@ -247,6 +247,7 @@ public final class WebAppController: ViewController, AttachmentContainable {
247247 Queue . mainQueue ( ) . justDispatch {
248248 if let backgroundColor = botAppSettings. backgroundColor {
249249 self . appBackgroundColor = UIColor ( rgb: UInt32 ( bitPattern: backgroundColor) )
250+ self . placeholderBackgroundColor = self . appBackgroundColor
250251 self . updateBackgroundColor ( transition: . immediate)
251252 }
252253 if let headerColor = botAppSettings. headerColor {
@@ -482,7 +483,7 @@ public final class WebAppController: ViewController, AttachmentContainable {
482483
483484 let foregroundColor : UIColor
484485 let shimmeringColor : UIColor
485- if let backgroundColor = self . appBackgroundColor {
486+ if let backgroundColor = self . placeholderBackgroundColor {
486487 if backgroundColor. lightness > 0.705 {
487488 foregroundColor = backgroundColor. mixedWith ( UIColor ( rgb: 0x000000 ) , alpha: 0.05 )
488489 shimmeringColor = UIColor . white. withAlphaComponent ( 0.2 )
@@ -1438,6 +1439,7 @@ public final class WebAppController: ViewController, AttachmentContainable {
14381439 fileprivate var needDismissConfirmation = false
14391440
14401441 fileprivate var appBackgroundColor : UIColor ?
1442+ fileprivate var placeholderBackgroundColor : UIColor ?
14411443 fileprivate var headerColor : UIColor ?
14421444 fileprivate var headerPrimaryTextColor : UIColor ?
14431445 private var headerColorKey : String ?
@@ -2280,10 +2282,7 @@ public final class WebAppController: ViewController, AttachmentContainable {
22802282 } ,
22812283 completion: { [ weak self] resultUrl, _ in
22822284 if let resultUrl, let self {
2283- if let tooltip = self . fileDownloadTooltip {
2284- tooltip. dismissWithCommitAction ( )
2285- }
2286-
2285+ let tooltipContent : UndoOverlayContent = . actionSucceeded( title: fileName, text: isMedia ? " Saved to Photos " : " Saved to Files " , cancel: nil , destructive: false )
22872286 if isMedia {
22882287 let saveToPhotos : ( URL , Bool ) -> Void = { url, isVideo in
22892288 var fileExtension = ( resultUrl. absoluteString as NSString ) . pathExtension
@@ -2303,18 +2302,26 @@ public final class WebAppController: ViewController, AttachmentContainable {
23032302 }
23042303 let isVideo = fileName. lowercased ( ) . hasSuffix ( " .mp4 " ) || fileName. lowercased ( ) . hasSuffix ( " .mov " )
23052304 saveToPhotos ( resultUrl, isVideo)
2306-
2307- let tooltipController = UndoOverlayController (
2308- presentationData: self . presentationData,
2309- content: . actionSucceeded( title: fileName, text: isMedia ? " Saved to Photos " : " Saved to Files " , cancel: nil , destructive: false ) ,
2310- elevatedLayout: false ,
2311- position: . top,
2312- action: { _ in
2313- return true
2314- }
2315- )
2316- controller. present ( tooltipController, in: . current)
2305+
2306+ if let tooltip = self . fileDownloadTooltip {
2307+ tooltip. content = tooltipContent
2308+ } else {
2309+ let tooltipController = UndoOverlayController (
2310+ presentationData: self . presentationData,
2311+ content: tooltipContent,
2312+ elevatedLayout: false ,
2313+ position: . top,
2314+ action: { _ in
2315+ return true
2316+ }
2317+ )
2318+ controller. present ( tooltipController, in: . current)
2319+ }
23172320 } else {
2321+ if let tooltip = self . fileDownloadTooltip {
2322+ tooltip. dismissWithCommitAction ( )
2323+ }
2324+
23182325 let tempFile = TempBox . shared. file ( path: resultUrl. absoluteString, fileName: fileName)
23192326 let url = URL ( fileURLWithPath: tempFile. path)
23202327 try ? FileManager . default. copyItem ( at: resultUrl, to: url)
@@ -2325,7 +2332,7 @@ public final class WebAppController: ViewController, AttachmentContainable {
23252332 }
23262333 let tooltipController = UndoOverlayController (
23272334 presentationData: self . presentationData,
2328- content: . actionSucceeded ( title : fileName , text : isMedia ? " Saved to Photos " : " Saved to Files " , cancel : nil , destructive : false ) ,
2335+ content: tooltipContent ,
23292336 elevatedLayout: false ,
23302337 position: . top,
23312338 action: { _ in
@@ -2335,11 +2342,6 @@ public final class WebAppController: ViewController, AttachmentContainable {
23352342 controller. present ( tooltipController, in: . current)
23362343 } )
23372344 controller. present ( pickerController, in: . window( . root) )
2338- //
2339- // if let documentsUrl = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first {
2340- // let targetUrl = documentsUrl.appendingPathComponent(fileName)
2341- // try? FileManager.default.copyItem(at: resultUrl, to: targetUrl)
2342- // }
23432345 }
23442346 }
23452347 }
@@ -2404,6 +2406,21 @@ public final class WebAppController: ViewController, AttachmentContainable {
24042406 if result {
24052407 let context = self . context
24062408 let botId = controller. botId
2409+
2410+ if !context. isPremium {
2411+ var replaceImpl : ( ( ViewController ) -> Void ) ?
2412+ let demoController = context. sharedContext. makePremiumDemoController ( context: context, subject: . emojiStatus, forceDark: false , action: {
2413+ let controller = context. sharedContext. makePremiumIntroController ( context: context, source: . animatedEmoji, forceDark: false , dismissed: nil )
2414+ replaceImpl ? ( controller)
2415+ } , dismissed: nil )
2416+ replaceImpl = { [ weak demoController] c in
2417+ demoController? . replace ( with: c)
2418+ }
2419+ controller. parentController ( ) ? . push ( demoController)
2420+ self . webView? . sendEvent ( name: " emoji_status_access_requested " , data: " {status: \" cancelled \" } " )
2421+ return
2422+ }
2423+
24072424 let _ = ( context. engine. peers. toggleBotEmojiStatusAccess ( peerId: botId, enabled: true )
24082425 |> deliverOnMainQueue) . startStandalone ( completed: { [ weak self] in
24092426 self ? . webView? . sendEvent ( name: " emoji_status_access_requested " , data: " {status: \" allowed \" } " )
0 commit comments