@@ -23,6 +23,9 @@ open class QuickStartTourGuide: NSObject {
2323 /// A flag indicating if the user is currently going through a tour or not.
2424 private( set) var tourInProgress = false
2525
26+ /// A flag indidcating whether we should show the congrats notice or not.
27+ private var shouldShowCongratsNotice = false
28+
2629 /// Represents the current entry point.
2730 @objc var currentEntryPoint : QuickStartTourEntryPoint = . unknown
2831
@@ -229,6 +232,22 @@ open class QuickStartTourGuide: NSObject {
229232 completed ( tour: tour, for: blog, postNotification: postNotification)
230233 }
231234
235+ func showCongratsNoticeIfNeeded( for blog: Blog ) {
236+ guard allToursCompleted ( for: blog) , shouldShowCongratsNotice else {
237+ return
238+ }
239+
240+ shouldShowCongratsNotice = false
241+
242+ let noticeStyle = QuickStartNoticeStyle ( attributedMessage: nil , isDismissable: true )
243+ let notice = Notice ( title: Strings . congratulationsTitle,
244+ message: Strings . congratulationsMessage,
245+ style: noticeStyle,
246+ tag: noticeTag)
247+
248+ ActionDispatcher . dispatch ( NoticeAction . post ( notice) )
249+ }
250+
232251 // we have this because poor stupid ObjC doesn't know what the heck an optional is
233252 @objc func currentElementInt( ) -> Int {
234253 return currentWaypoint ( ) ? . element. rawValue ?? NSNotFound
@@ -353,6 +372,7 @@ private extension QuickStartTourGuide {
353372 WPAnalytics . track ( . quickStartAllToursCompleted)
354373 grantCongratulationsAward ( for: blog)
355374 tourInProgress = false
375+ shouldShowCongratsNotice = true
356376 } else {
357377 if let nextTour = tourToSuggest ( for: blog) {
358378 PushNotificationsManager . shared. postNotification ( for: nextTour)
@@ -448,6 +468,11 @@ private extension QuickStartTourGuide {
448468 static let quickStartDelay : DispatchTimeInterval = . milliseconds( 500 )
449469 static let nextStepDelay : DispatchTimeInterval = . milliseconds( 1000 )
450470 }
471+
472+ private enum Strings {
473+ static let congratulationsTitle = NSLocalizedString ( " Congrats! You know your way around " , comment: " Title shown when all tours have been completed. " )
474+ static let congratulationsMessage = NSLocalizedString ( " Doesn't it feel good to cross things off a list? " , comment: " Message shown when all tours have been completed " )
475+ }
451476}
452477
453478internal extension NSNotification . Name {
0 commit comments