Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes an issue with the tour guide not initializing some values in time. #12051

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions WordPress/Classes/ViewRelated/Blog/BlogDetailHeaderView.m
Expand Up @@ -99,6 +99,12 @@ - (void)refreshIconImage
self.blavatarImageView.image = [UIImage siteIconPlaceholder];
}

[self refreshSpotlight];
}

- (void)refreshSpotlight {
[self removeQuickStartSpotlight];

if ([[QuickStartTourGuide find] isCurrentElement:QuickStartTourElementSiteIcon]) {
[self addQuickStartSpotlight];
}
Expand Down
Expand Up @@ -92,13 +92,18 @@ class QuickStartChecklistViewController: UITableViewController {
dataManager = QuickStartChecklistManager(blog: blog,
tours: configuration.tours,
didSelectTour: { [weak self] tour in
DispatchQueue.main.async {
DispatchQueue.main.async { [weak self] in
WPAnalytics.track(.quickStartChecklistItemTapped, withProperties: ["task_name": tour.analyticsKey])
self?.dismiss(animated: true) {
if let blog = self?.blog,
let tourGuide = QuickStartTourGuide.find() {
tourGuide.start(tour: tour, for: blog)
}

guard let self = self else {
return
}

let tourGuide = QuickStartTourGuide.find()
tourGuide?.prepare(tour: tour, for: self.blog)

self.dismiss(animated: true) {
tourGuide?.begin()
}
}
}, didTapHeader: { [unowned self] expand in
Expand Down
24 changes: 21 additions & 3 deletions WordPress/Classes/ViewRelated/Blog/QuickStartTourGuide.swift
Expand Up @@ -101,7 +101,8 @@ open class QuickStartTourGuide: NSObject {
self?.currentSuggestion = nil

if accepted {
self?.start(tour: tour, for: blog)
self?.prepare(tour: tour, for: blog)
self?.begin()
cancelTimer(false)
WPAnalytics.track(.quickStartSuggestionButtonTapped, withProperties: ["type": "positive"])
} else {
Expand All @@ -116,7 +117,13 @@ open class QuickStartTourGuide: NSObject {
WPAnalytics.track(.quickStartSuggestionViewed)
}

func start(tour: QuickStartTour, for blog: Blog) {
/// Prepares to begin the specified tour.
///
/// - Parameters:
/// - tour: the tour to prepare for running.
/// - blog: the blog in which the tour will take place.
///
func prepare(tour: QuickStartTour, for blog: Blog) {
endCurrentTour()
dismissSuggestion()

Expand All @@ -126,10 +133,21 @@ open class QuickStartTourGuide: NSObject {
fallthrough
default:
currentTourState = TourState(tour: tour, blog: blog, step: 0)
showCurrentStep()
}
}

/// Begins the prepared tour. Should only be called after `prepare(tour:for:)`.
///
func begin() {
guard let state = currentTourState,
state.step == 0 else {

return
}

showCurrentStep()
}

func complete(tour: QuickStartTour, for blog: Blog, postNotification: Bool = true) {
completed(tour: tour, for: blog, postNotification: postNotification)
}
Expand Down