Skip to content

Commit 0920143

Browse files
Merge pull request #18591 from wordpress-mobile/issue/18563-qs-default-section-update
Quick Start: Refresh Quick Start card location when the default section changes
2 parents 8d5987d + 8edcf5e commit 0920143

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

WordPress/Classes/ViewRelated/Blog/Blog Dashboard/BlogDashboardViewController.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,12 +190,8 @@ final class BlogDashboardViewController: UIViewController {
190190
viewModel.loadCards()
191191
}
192192

193-
/// Load card from cache if view is appearing
193+
/// Load card from cache
194194
@objc private func loadCardsFromCache() {
195-
guard view.superview != nil else {
196-
return
197-
}
198-
199195
viewModel.loadCardsFromCache()
200196
}
201197

WordPress/Classes/ViewRelated/Blog/My Site/MySiteSettings.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ protocol DefaultSectionProvider {
3434

3535
func setDefaultSection(_ tab: MySiteViewController.Section) {
3636
userDefaults.set(tab.rawValue, forKey: Constants.defaultSectionKey)
37+
QuickStartTourGuide.shared.refreshQuickStart()
3738
WPAnalytics.track(.mySiteDefaultTabExperimentVariantAssigned, properties: ["default_tab_experiment": experimentAssignment])
3839
}
3940

WordPress/Classes/ViewRelated/Blog/QuickStartTourGuide.swift

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,7 @@ open class QuickStartTourGuide: NSObject {
6060
NotificationCenter.default.post(name: .QuickStartTourElementChangedNotification, object: self)
6161
WPAnalytics.trackQuickStartEvent(.quickStartStarted, blog: blog)
6262

63-
NotificationCenter.default.post(name: .QuickStartTourElementChangedNotification,
64-
object: self,
65-
userInfo: [QuickStartTourGuide.notificationElementKey: QuickStartTourElement.setupQuickStart])
63+
refreshQuickStart()
6664
}
6765

6866
func setupWithDelay(for blog: Blog, type: QuickStartType, withCompletedSteps steps: [QuickStartTour] = []) {
@@ -181,6 +179,13 @@ open class QuickStartTourGuide: NSObject {
181179
}
182180
}
183181

182+
/// Posts a notification to trigger updates to Quick Start Cards if needed.
183+
func refreshQuickStart() {
184+
NotificationCenter.default.post(name: .QuickStartTourElementChangedNotification,
185+
object: self,
186+
userInfo: [QuickStartTourGuide.notificationElementKey: QuickStartTourElement.setupQuickStart])
187+
}
188+
184189
private func addSiteMenuWayPointIfNeeded(for tour: QuickStartTour) -> QuickStartTour {
185190

186191
if currentEntryPoint == .blogDashboard &&

0 commit comments

Comments
 (0)