Skip to content

Commit 605692d

Browse files
authored
Merge pull request #18450 from wordpress-mobile/task/18387-qs-reader
Quick Start for Existing Users: Update Reader task
2 parents 3097c99 + 248ece3 commit 605692d

7 files changed

Lines changed: 57 additions & 24 deletions

File tree

RELEASE-NOTES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* [**] Self hosted sites are not restricted by video length during media uploads [https://github.com/wordpress-mobile/WordPress-iOS/pull/18414]
44
* [*] [internal] My Site Dashboard: Made some changes to the code architecture of the dashboard. The majority of the changes are related to the posts cards. It should have no visible changes but could cause regressions. Please test it by creating/trashing drafts and scheduled posts and testing that they appear correctly on the dashboard. [#18405]
55
* [*] Quick Start: Updated the Stats tour. The tour can now be accessed from either the dashboard or the menu tab. [#18413]
6+
* [*] Quick Start: Updated the Reader tour. The tour now highlights the Discover tab and guides users to follow topics via the Settings screen. [#18450]
67
* [*] [internal] Quick Start: Refactored some code related to the tasks displayed in the Quick Start Card and the Quick Start modal. It should have no visible changes but could cause regressions. [#18395]
78

89
19.7

WordPress/Classes/ViewRelated/Blog/Blog Details/BlogDetailsViewController.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ typedef NS_ENUM(NSInteger, QuickStartTourElement) {
6060
QuickStartTourElementSharing = 8,
6161
QuickStartTourElementConnections = 9,
6262
QuickStartTourElementReaderTab = 10,
63-
QuickStartTourElementReaderSearch = 12,
63+
QuickStartTourElementReaderDiscoverSettings = 12,
6464
QuickStartTourElementTourCompleted = 13,
6565
QuickStartTourElementCongratulations = 14,
6666
QuickStartTourElementSiteIcon = 15,

WordPress/Classes/ViewRelated/Blog/QuickStartTourGuide.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ open class QuickStartTourGuide: NSObject {
253253
}
254254
if element != currentElement {
255255
let blogDetailEvents: [QuickStartTourElement] = [.blogDetailNavigation, .checklist, .themes, .viewSite, .sharing, .siteMenu]
256-
let readerElements: [QuickStartTourElement] = [.readerTab, .readerSearch]
256+
let readerElements: [QuickStartTourElement] = [.readerTab, .readerDiscoverSettings]
257257

258258
if blogDetailEvents.contains(element) {
259259
endCurrentTour()

WordPress/Classes/ViewRelated/Blog/QuickStartTours.swift

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -191,22 +191,32 @@ struct QuickStartPublishTour: QuickStartTour {
191191
struct QuickStartFollowTour: QuickStartTour {
192192
let key = "quick-start-follow-tour"
193193
let analyticsKey = "follow_site"
194-
let title = NSLocalizedString("Follow other sites", comment: "Title of a Quick Start Tour")
195-
let titleMarkedCompleted = NSLocalizedString("Completed: Follow other sites", comment: "The Quick Start Tour title after the user finished the step.")
196-
let description = NSLocalizedString("Find sites that speak to you, and follow them to get updates when they publish.", comment: "Description of a Quick Start Tour")
194+
let title = NSLocalizedString("Connect with other sites", comment: "Title of a Quick Start Tour")
195+
let titleMarkedCompleted = NSLocalizedString("Completed: Connect with other sites", comment: "The Quick Start Tour title after the user finished the step.")
196+
let description = NSLocalizedString("Discover and follow sites that inspire you.", comment: "Description of a Quick Start Tour")
197197
let icon = UIImage.gridicon(.readerFollow)
198198
let suggestionNoText = Strings.notNow
199199
let suggestionYesText = Strings.yesShowMe
200200
let possibleEntryPoints: Set<QuickStartTourEntryPoint> = [.blogDetails, .blogDashboard]
201201

202202
var waypoints: [WayPoint] = {
203-
let step1DescriptionBase = NSLocalizedString("Select %@ to continue", comment: "A step in a guided tour for quick start. %@ will be the name of the item to select.")
203+
let step1DescriptionBase = NSLocalizedString("Select %@ to find other sites.", comment: "A step in a guided tour for quick start. %@ will be the name of the item to select.")
204204
let step1DescriptionTarget = NSLocalizedString("Reader", comment: "The menu item to select during a guided tour.")
205205
let step1: WayPoint = (element: .readerTab, description: step1DescriptionBase.highlighting(phrase: step1DescriptionTarget, icon: .gridicon(.reader)))
206206

207-
let step2DescriptionBase = NSLocalizedString("Select %@ to look for sites with similar interests", comment: "A step in a guided tour for quick start. %@ will be the name of the item to select.")
208-
let step2DescriptionTarget = NSLocalizedString("Search", comment: "The menu item to select during a guided tour.")
209-
let step2: WayPoint = (element: .readerSearch, description: step2DescriptionBase.highlighting(phrase: step2DescriptionTarget, icon: .gridicon(.search)))
207+
let step2DiscoverDescriptionBase = NSLocalizedString("Use %@ to find sites and tags.", comment: "A step in a guided tour for quick start. %@ will be the name of the item to select.")
208+
let step2DiscoverDescriptionTarget = NSLocalizedString("Discover", comment: "The menu item to select during a guided tour.")
209+
let step2DiscoverDescription = step2DiscoverDescriptionBase.highlighting(phrase: step2DiscoverDescriptionTarget, icon: nil)
210+
211+
let step2SettingsDescriptionBase = NSLocalizedString("Try selecting %@ to add topics you like.", comment: "A step in a guided tour for quick start. %@ will be the name of the item to select.")
212+
let step2SettingsDescriptionTarget = NSLocalizedString("Settings", comment: "The menu item to select during a guided tour.")
213+
let step2SettingsDescription = step2SettingsDescriptionBase.highlighting(phrase: step2SettingsDescriptionTarget, icon: .gridicon(.cog))
214+
215+
/// Combined description for step 2
216+
let step2Format = NSAttributedString(string: "%@ %@")
217+
let step2Description = NSAttributedString(format: step2Format, args: step2DiscoverDescription, step2SettingsDescription)
218+
219+
let step2: WayPoint = (element: .readerDiscoverSettings, description: step2Description)
210220

211221
return [step1, step2]
212222
}()
@@ -456,3 +466,15 @@ private extension String {
456466
}
457467
}
458468
}
469+
470+
private extension NSAttributedString {
471+
convenience init(format: NSAttributedString, args: NSAttributedString...) {
472+
let mutableNSAttributedString = NSMutableAttributedString(attributedString: format)
473+
474+
args.forEach { (attributedString) in
475+
let range = NSString(string: mutableNSAttributedString.string).range(of: "%@")
476+
mutableNSAttributedString.replaceCharacters(in: range, with: attributedString)
477+
}
478+
self.init(attributedString: mutableNSAttributedString)
479+
}
480+
}

WordPress/Classes/ViewRelated/Reader/Manage/ReaderManageScenePresenter.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ class ReaderManageScenePresenter: ScenePresenter {
5353
presentedViewController = navigationController
5454
viewController.present(navigationController, animated: true, completion: nil)
5555

56+
QuickStartTourGuide.shared.visited(.readerDiscoverSettings)
5657
WPAnalytics.track(.readerManageViewDisplayed)
5758
}
5859
}

WordPress/Classes/ViewRelated/Reader/Tab Navigation/ReaderTabViewController.swift

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class ReaderTabViewController: UIViewController {
1111
return makeReaderTabView(viewModel)
1212
}()
1313

14-
private let searchButton: SpotlightableButton = SpotlightableButton(type: .custom)
14+
private let settingsButton: SpotlightableButton = SpotlightableButton(type: .custom)
1515

1616
init(viewModel: ReaderTabViewModel, readerTabViewFactory: @escaping (ReaderTabViewModel) -> ReaderTabView) {
1717
self.viewModel = viewModel
@@ -61,7 +61,16 @@ class ReaderTabViewController: UIViewController {
6161
}
6262

6363
override func viewWillAppear(_ animated: Bool) {
64-
searchButton.shouldShowSpotlight = QuickStartTourGuide.shared.isCurrentElement(.readerSearch)
64+
super.viewWillAppear(animated)
65+
66+
if QuickStartTourGuide.shared.isCurrentElement(.readerDiscoverSettings) {
67+
68+
if viewModel.selectedIndex != ReaderTabConstants.discoverIndex {
69+
viewModel.showTab(at: ReaderTabConstants.discoverIndex)
70+
}
71+
72+
settingsButton.shouldShowSpotlight = true
73+
}
6574
}
6675

6776
override func viewWillDisappear(_ animated: Bool) {
@@ -71,22 +80,21 @@ class ReaderTabViewController: UIViewController {
7180
}
7281

7382
func setupNavigationButtons() {
74-
// Settings Button
75-
let settingsButton = UIBarButtonItem(image: UIImage.gridicon(.cog),
76-
style: .plain,
77-
target: self,
78-
action: #selector(didTapSettingsButton))
79-
settingsButton.accessibilityIdentifier = ReaderTabConstants.settingsButtonIdentifier
80-
8183
// Search Button
82-
searchButton.spotlightOffset = UIOffset(horizontal: 20, vertical: -10)
83-
searchButton.setImage(.gridicon(.search), for: .normal)
84-
searchButton.addTarget(self, action: #selector(didTapSearchButton), for: .touchUpInside)
84+
let searchButton = UIBarButtonItem(image: UIImage.gridicon(.search),
85+
style: .plain,
86+
target: self,
87+
action: #selector(didTapSearchButton))
8588
searchButton.accessibilityIdentifier = ReaderTabConstants.searchButtonAccessibilityIdentifier
8689

87-
let searchBarButton = UIBarButtonItem(customView: searchButton)
90+
// Settings Button
91+
settingsButton.spotlightOffset = ReaderTabConstants.spotlightOffset
92+
settingsButton.setImage(.gridicon(.cog), for: .normal)
93+
settingsButton.addTarget(self, action: #selector(didTapSettingsButton), for: .touchUpInside)
94+
settingsButton.accessibilityIdentifier = ReaderTabConstants.settingsButtonIdentifier
95+
let settingsButton = UIBarButtonItem(customView: settingsButton)
8896

89-
navigationItem.rightBarButtonItems = [searchBarButton, settingsButton]
97+
navigationItem.rightBarButtonItems = [searchButton, settingsButton]
9098
}
9199

92100
override func loadView() {
@@ -115,6 +123,7 @@ class ReaderTabViewController: UIViewController {
115123
// MARK: - Navigation Buttons
116124
extension ReaderTabViewController {
117125
@objc private func didTapSettingsButton() {
126+
settingsButton.shouldShowSpotlight = false
118127
viewModel.presentManage(from: self)
119128
}
120129

@@ -172,5 +181,6 @@ extension ReaderTabViewController {
172181
static let restorationIdentifier = "WPReaderTabControllerRestorationID"
173182
static let encodedIndexKey = "WPReaderTabControllerIndexRestorationKey"
174183
static let discoverIndex = 1
184+
static let spotlightOffset = UIOffset(horizontal: 20, vertical: -10)
175185
}
176186
}

WordPress/Classes/ViewRelated/Reader/Tab Navigation/WPTabBarController+ReaderTabNavigation.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ extension WPTabBarController {
6464
func navigateToReaderSearch() {
6565
let searchController = ReaderSearchViewController.controller()
6666
navigateToReader(searchController)
67-
QuickStartTourGuide.shared.visited(.readerSearch)
6867
}
6968

7069
func navigateToReaderSite(_ topic: ReaderSiteTopic) {

0 commit comments

Comments
 (0)