@@ -321,48 +321,88 @@ public final class ChatChannelSubscriberInputPanelNode: ChatInputPanelNode {
321321 return self . updateLayout ( width: width, leftInset: leftInset, rightInset: rightInset, bottomInset: bottomInset, additionalSideInsets: additionalSideInsets, maxHeight: maxHeight, isSecondary: isSecondary, transition: transition, interfaceState: interfaceState, metrics: metrics, force: false )
322322 }
323323
324- private var displayedGiftTooltip = false
325- private func presentGiftTooltip ( ) {
326- guard let context = self . context, !self . displayedGiftTooltip , let parentController = self . interfaceInteraction? . chatController ( ) else {
324+ private var displayedGiftOrSuggestTooltip = false
325+ private func presentGiftOrSuggestTooltip ( ) {
326+ guard let context = self . context, !self . displayedGiftOrSuggestTooltip , let parentController = self . interfaceInteraction? . chatController ( ) else {
327327 return
328328 }
329- self . displayedGiftTooltip = true
329+ self . displayedGiftOrSuggestTooltip = true
330330
331- let _ = ( ApplicationSpecificNotice . getChannelSendGiftTooltip ( accountManager: context. sharedContext. accountManager)
332- |> deliverOnMainQueue) . start ( next: { [ weak self] count in
331+ let _ = ( combineLatest ( queue: . mainQueue( ) ,
332+ ApplicationSpecificNotice . getChannelSendGiftTooltip ( accountManager: context. sharedContext. accountManager) ,
333+ ApplicationSpecificNotice . getChannelSuggestTooltip ( accountManager: context. sharedContext. accountManager)
334+ |> deliverOnMainQueue) ) . start ( next: { [ weak self] giftCount, suggestCount in
333335 guard let self else {
334336 return
335337 }
336- guard count < 2 else {
337- return
338- }
339338
340- let _ = ApplicationSpecificNotice . incrementChannelSendGiftTooltip ( accountManager: context. sharedContext. accountManager) . start ( )
339+ /*#if DEBUG
340+ var giftCount = giftCount
341+ var suggestCount = suggestCount
342+ if "".isEmpty {
343+ giftCount = 2
344+ suggestCount = 0
345+ }
346+ #endif*/
341347
342- Queue . mainQueue ( ) . after ( 0.4 , {
343- let absoluteFrame = self . giftButton. view. convert ( self . giftButton. bounds, to: parentController. view)
344- let location = CGRect ( origin: CGPoint ( x: absoluteFrame. midX, y: absoluteFrame. minY + 11.0 ) , size: CGSize ( ) )
348+ if giftCount < 2 && !self . giftButton. isHidden {
349+ let _ = ApplicationSpecificNotice . incrementChannelSendGiftTooltip ( accountManager: context. sharedContext. accountManager) . start ( )
345350
346- let presentationData = context. sharedContext. currentPresentationData. with { $0 }
347- let text : String = presentationData. strings. Chat_SendGiftTooltip
348-
349- let tooltipController = TooltipScreen (
350- account: context. account,
351- sharedContext: context. sharedContext,
352- text: . plain( text: text) ,
353- balancedTextLayout: false ,
354- style: . wide,
355- arrowStyle: . small,
356- icon: nil ,
357- location: . point( location, . bottom) ,
358- displayDuration: . default,
359- inset: 8.0 ,
360- shouldDismissOnTouch: { _, _ in
361- return . ignore
362- }
363- )
364- self . interfaceInteraction? . presentControllerInCurrent ( tooltipController, nil )
365- } )
351+ Queue . mainQueue ( ) . after ( 0.4 , {
352+ let absoluteFrame = self . giftButton. view. convert ( self . giftButton. bounds, to: parentController. view)
353+ let location = CGRect ( origin: CGPoint ( x: absoluteFrame. midX, y: absoluteFrame. minY + 11.0 ) , size: CGSize ( ) )
354+
355+ let presentationData = context. sharedContext. currentPresentationData. with { $0 }
356+ let text : String = presentationData. strings. Chat_SendGiftTooltip
357+
358+ let tooltipController = TooltipScreen (
359+ account: context. account,
360+ sharedContext: context. sharedContext,
361+ text: . plain( text: text) ,
362+ balancedTextLayout: false ,
363+ style: . wide,
364+ arrowStyle: . small,
365+ icon: nil ,
366+ location: . point( location, . bottom) ,
367+ displayDuration: . default,
368+ inset: 8.0 ,
369+ shouldDismissOnTouch: { _, _ in
370+ return . ignore
371+ }
372+ )
373+ self . interfaceInteraction? . presentControllerInCurrent ( tooltipController, nil )
374+ } )
375+ } else if suggestCount < 2 && !self . suggestedPostButton. isHidden {
376+ let _ = ApplicationSpecificNotice . incrementChannelSuggestTooltip ( accountManager: context. sharedContext. accountManager) . start ( )
377+
378+ Queue . mainQueue ( ) . after ( 0.4 , {
379+ let absoluteFrame = self . suggestedPostButton. view. convert ( self . suggestedPostButton. bounds, to: parentController. view)
380+ let location = CGRect ( origin: CGPoint ( x: absoluteFrame. midX, y: absoluteFrame. minY + 11.0 ) , size: CGSize ( ) )
381+
382+ let presentationData = context. sharedContext. currentPresentationData. with { $0 }
383+ let _ = presentationData
384+ //TODO:localize
385+ let text : String = " Tap here to suggest a message "
386+
387+ let tooltipController = TooltipScreen (
388+ account: context. account,
389+ sharedContext: context. sharedContext,
390+ text: . plain( text: text) ,
391+ textBadge: " NEW " ,
392+ balancedTextLayout: false ,
393+ style: . wide,
394+ arrowStyle: . small,
395+ icon: nil ,
396+ location: . point( location, . bottom) ,
397+ displayDuration: . default,
398+ inset: 8.0 ,
399+ shouldDismissOnTouch: { _, _ in
400+ return . ignore
401+ }
402+ )
403+ self . interfaceInteraction? . presentControllerInCurrent ( tooltipController, nil )
404+ } )
405+ }
366406 } )
367407 }
368408
@@ -377,7 +417,7 @@ public final class ChatChannelSubscriberInputPanelNode: ChatInputPanelNode {
377417 if previousState? . theme !== interfaceState. theme {
378418 self . badgeBackground. image = PresentationResourcesChatList . badgeBackgroundActive ( interfaceState. theme, diameter: 20.0 )
379419 self . helpButton. setImage ( generateTintedImage ( image: UIImage ( bundleImageName: " Chat/Input/Accessory Panels/Help " ) , color: interfaceState. theme. chat. inputPanel. panelControlAccentColor) , for: . normal)
380- self . suggestedPostButton. setImage ( generateTintedImage ( image: UIImage ( bundleImageName: " Chat/Input/Accessory Panels/Gift " ) , color: interfaceState. theme. chat. inputPanel. panelControlAccentColor) , for: . normal)
420+ self . suggestedPostButton. setImage ( generateTintedImage ( image: UIImage ( bundleImageName: " Chat/Input/Accessory Panels/SuggestPost " ) , color: interfaceState. theme. chat. inputPanel. panelControlAccentColor) , for: . normal)
381421 self . giftButton. setImage ( generateTintedImage ( image: UIImage ( bundleImageName: " Chat/Input/Accessory Panels/Gift " ) , color: interfaceState. theme. chat. inputPanel. panelControlAccentColor) , for: . normal)
382422 }
383423
@@ -431,11 +471,12 @@ public final class ChatChannelSubscriberInputPanelNode: ChatInputPanelNode {
431471 self . helpButton. isHidden = true
432472 //TODO:release
433473 self . suggestedPostButton. isHidden = false
434- self . presentGiftTooltip ( )
474+ self . presentGiftOrSuggestTooltip ( )
435475 } else if case . broadcast = peer. info {
436476 self . giftButton. isHidden = true
437477 self . helpButton. isHidden = true
438478 self . suggestedPostButton. isHidden = false
479+ self . presentGiftOrSuggestTooltip ( )
439480 } else if peer. flags. contains ( . isGigagroup) , self . action == . muteNotifications || self . action == . unmuteNotifications {
440481 self . giftButton. isHidden = true
441482 self . helpButton. isHidden = false
0 commit comments