Skip to content

Commit b5baf6c

Browse files
authored
Merge release 24.2 changes w/out ß to send strings to GlotPress (#22566)
2 parents c9c0312 + c660a7a commit b5baf6c

17 files changed

Lines changed: 113 additions & 53 deletions

RELEASE-NOTES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
24.2
66
-----
7+
* [*] [Jetpack-only] Fixed a UI bug where the Dynamic Dashboard Card would slightly jump on first launch.
78
* [**] Prevent images from temporarily disappearing when uploading media [https://github.com/WordPress/gutenberg/pull/57869]
89
* [*] [Jetpack-only] Site Monitoring: Add Metrics, PHP Logs, and Web Server Logs under Site Monitoring [#22475, #22499, #22504, #22500]
910
* [***] [Jetpack-only] Reader: introduced new UI/UX for content navigation and filtering [#22536]

WordPress/Classes/ViewRelated/Blog/Blog Dashboard/Cards/BlogDashboardDynamicCardCell.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,12 @@ private extension DynamicDashboardCard {
120120
return .init(title: title, callback: callback)
121121
}()
122122

123-
let input = Input(featureImageURL: featureImageURL, rows: rows, action: action)
123+
let input = Input(
124+
featureImageURL: featureImageURL,
125+
featureImageWidthToHeightRatio: payload.featuredImageSize?.widthToHeightRatio ?? 2,
126+
rows: rows,
127+
action: action
128+
)
124129
self.init(input: input)
125130
}
126131
}

WordPress/Classes/ViewRelated/Blog/Blog Dashboard/Cards/Dynamic/DynamicDashboardCard.swift

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ struct DynamicDashboardCard: View {
2121
}
2222

2323
let featureImageURL: URL?
24+
let featureImageWidthToHeightRatio: CGFloat
2425
let rows: [Row]
2526
let action: Action?
2627
}
@@ -39,30 +40,27 @@ struct DynamicDashboardCard: View {
3940
}
4041
.padding(.bottom, Length.Padding.single)
4142
.padding(.horizontal, Length.Padding.double)
42-
.fixedSize(horizontal: false, vertical: true)
4343
}
4444

4545
@ViewBuilder
4646
var featureImage: some View {
4747
if let featureImageURL = input.featureImageURL {
4848
AsyncImage(url: featureImageURL) { phase in
49-
Group {
50-
if let image = phase.image {
51-
image
52-
.resizable()
53-
.aspectRatio(contentMode: .fit)
54-
} else {
55-
Color.DS.Background.secondary
56-
.frame(maxWidth: .infinity)
57-
.frame(height: 150)
58-
}
49+
switch phase {
50+
case .success(let image):
51+
image
52+
.resizable()
53+
.aspectRatio(input.featureImageWidthToHeightRatio, contentMode: .fit)
54+
default:
55+
Color.DS.Background.secondary
56+
.aspectRatio(input.featureImageWidthToHeightRatio, contentMode: .fit)
5957
}
60-
.clipShape(
61-
RoundedRectangle(
62-
cornerRadius: Length.Radius.small
63-
)
64-
)
6558
}
59+
.clipShape(
60+
RoundedRectangle(
61+
cornerRadius: Length.Radius.small
62+
)
63+
)
6664
}
6765
}
6866

@@ -141,6 +139,7 @@ struct DynamicDashboardCard_Previews: PreviewProvider {
141139
DynamicDashboardCard(
142140
input: .init(
143141
featureImageURL: URL(string: "https://i.pickadummy.com/index.php?imgsize=400x200")!,
142+
featureImageWidthToHeightRatio: 2,
144143
rows: [
145144
.init(
146145
title: "Title first",

WordPress/Classes/ViewRelated/Blog/Blog Dashboard/Service/BlogDashboardRemoteEntity.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ extension BlogDashboardRemoteEntity {
5959
let id: String
6060
let title: String?
6161
let featuredImage: String?
62+
let featuredImageSize: ImageSize?
6263
let url: String?
6364
let action: String?
6465
let order: Order?
@@ -75,10 +76,23 @@ extension BlogDashboardRemoteEntity {
7576
let icon: String?
7677
}
7778

79+
struct ImageSize: Decodable, Hashable {
80+
let width: Int?
81+
let height: Int?
82+
83+
var widthToHeightRatio: CGFloat? {
84+
guard let width, let height else {
85+
return nil
86+
}
87+
return CGFloat(width) / CGFloat(height)
88+
}
89+
}
90+
7891
private enum CodingKeys: String, CodingKey {
7992
case id
8093
case title
8194
case featuredImage = "featured_image"
95+
case featuredImageSize = "featured_image_size"
8296
case url
8397
case action
8498
case order

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ typedef NS_ENUM(NSInteger, QuickStartTourElement) {
6969
QuickStartTourElementSharing = 8,
7070
QuickStartTourElementConnections = 9,
7171
QuickStartTourElementReaderTab = 10,
72-
QuickStartTourElementReaderDiscoverSettings = 12,
72+
QuickStartTourElementReaderDiscoverSubscriptions = 12,
7373
QuickStartTourElementTourCompleted = 13,
7474
QuickStartTourElementCongratulations = 14,
7575
QuickStartTourElementSiteIcon = 15,

WordPress/Classes/ViewRelated/Blog/QuickStartTourGuide.swift

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@ open class QuickStartTourGuide: NSObject {
4242
return tourState.tour.mustBeShownInBlogDetails
4343
}
4444

45+
private var shouldAutoComplete: Bool {
46+
guard let element = currentElement() else {
47+
return false
48+
}
49+
return element.autoCompleteDelay != .never
50+
}
51+
4552
@objc static let shared = QuickStartTourGuide()
4653

4754
private override init() {}
@@ -292,7 +299,7 @@ open class QuickStartTourGuide: NSObject {
292299
}
293300
if element != currentElement {
294301
let blogDetailEvents: [QuickStartTourElement] = [.blogDetailNavigation, .checklist, .themes, .viewSite, .sharing, .siteMenu]
295-
let readerElements: [QuickStartTourElement] = [.readerTab, .readerDiscoverSettings]
302+
let readerElements: [QuickStartTourElement] = [.readerTab, .readerDiscoverSubscriptions]
296303

297304
if blogDetailEvents.contains(element) {
298305
endCurrentTour()
@@ -442,6 +449,15 @@ private extension QuickStartTourGuide {
442449
showStepNotice(waypoint.description)
443450
}
444451

452+
if shouldAutoComplete {
453+
let element = waypoint.element
454+
DispatchQueue.main.asyncAfter(deadline: .now() + element.autoCompleteDelay) {
455+
if element == self.currentElement() {
456+
self.visited(element)
457+
}
458+
}
459+
}
460+
445461
let userInfo: [String: Any] = [
446462
QuickStartTourGuide.notificationElementKey: waypoint.element,
447463
QuickStartTourGuide.notificationDescriptionKey: waypoint.description
@@ -527,3 +543,18 @@ private struct TourState {
527543
var blog: Blog
528544
var step: Int
529545
}
546+
547+
extension QuickStartTourElement {
548+
549+
/// The delay to wait before auto completing the tour step. A value of `.never` means it will
550+
/// not auto complete.
551+
var autoCompleteDelay: DispatchTimeInterval {
552+
switch self {
553+
case .readerDiscoverSubscriptions:
554+
return .seconds(5)
555+
default:
556+
return .never
557+
}
558+
}
559+
560+
}

WordPress/Classes/ViewRelated/Blog/QuickStartTours.swift

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -176,21 +176,35 @@ struct QuickStartFollowTour: QuickStartTour {
176176
var waypoints: [WayPoint] = {
177177
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.")
178178
let step1DescriptionTarget = NSLocalizedString("Reader", comment: "The menu item to select during a guided tour.")
179-
let step1: WayPoint = (element: .readerTab, description: step1DescriptionBase.highlighting(phrase: step1DescriptionTarget, icon: .gridicon(.reader)))
179+
let step1: WayPoint = (element: .readerTab,
180+
description: step1DescriptionBase.highlighting(phrase: step1DescriptionTarget,
181+
icon: UIImage(named: "tab-bar-reader-selected")))
180182

181183
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.")
182184
let step2DiscoverDescriptionTarget = NSLocalizedString("Discover", comment: "The menu item to select during a guided tour.")
183185
let step2DiscoverDescription = step2DiscoverDescriptionBase.highlighting(phrase: step2DiscoverDescriptionTarget, icon: nil)
184186

185-
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.")
186-
let step2SettingsDescriptionTarget = NSLocalizedString("Settings", comment: "The menu item to select during a guided tour.")
187-
let step2SettingsDescription = step2SettingsDescriptionBase.highlighting(phrase: step2SettingsDescriptionTarget, icon: .gridicon(.cog))
187+
let step2SubscriptionDescriptionBase = NSLocalizedString(
188+
"quick.start.reader.2.subscriptions.base",
189+
value: "Try selecting %@ to view subscribed content and manage your subscriptions.",
190+
comment: "A step in a guided tour for quick start. %@ will be a bolded Subscriptions text."
191+
)
192+
let step2SubscriptionDescriptionTarget = NSLocalizedString(
193+
"quick.start.reader.2.subscriptions.target",
194+
value: "Subscriptions",
195+
comment: "The bolded Subscriptions text in the Reader step 2 description for the quick start tour."
196+
)
197+
let step2SubscriptionDescription = step2SubscriptionDescriptionBase.highlighting(
198+
phrase: step2SubscriptionDescriptionTarget,
199+
icon: nil
200+
)
188201

189202
/// Combined description for step 2
190203
let step2Format = NSAttributedString(string: "%@ %@")
191-
let step2Description = NSAttributedString(format: step2Format, args: step2DiscoverDescription, step2SettingsDescription)
204+
let step2Description = NSAttributedString(format: step2Format,
205+
args: step2DiscoverDescription, step2SubscriptionDescription)
192206

193-
let step2: WayPoint = (element: .readerDiscoverSettings, description: step2Description)
207+
let step2: WayPoint = (element: .readerDiscoverSubscriptions, description: step2Description)
194208

195209
return [step1, step2]
196210
}()

WordPress/Classes/ViewRelated/Reader/Filter/FilterProvider.swift

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,6 @@ extension FilterProvider: Equatable {
100100

101101
extension FilterProvider {
102102

103-
func showAdd(on presenterViewController: UIViewController, sceneDelegate: ScenePresenterDelegate?) {
104-
let presenter = ReaderManageScenePresenter(selected: section, sceneDelegate: sceneDelegate)
105-
presenter.present(on: presenterViewController, animated: true, completion: nil)
106-
}
107-
108103
static func filterItems(_ items: [TableDataItem], siteType: SiteOrganizationType?) -> [TableDataItem] {
109104
// If a site type is specified, filter items by it.
110105
// Otherwise, just return all items.
@@ -366,7 +361,7 @@ extension ReaderTagTopic {
366361
)
367362

368363
static let pluralFilterTitle = NSLocalizedString(
369-
"reader.navigation.filter.blog.plural",
364+
"reader.navigation.filter.tag.plural",
370365
value: "%1$d Tags",
371366
comment: """
372367
Plural button title to filter the Reader stream by tag.

WordPress/Classes/ViewRelated/Reader/Filter/FilterSheetViewController.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,8 @@ private extension FilterSheetViewController {
249249
present(navController, animated: true)
250250
break
251251
case .tag:
252-
filterProvider.showAdd(on: self, sceneDelegate: self)
252+
// Go to the Filter management view
253+
didTapEditButton()
253254
}
254255
}
255256

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ class ReaderManageScenePresenter {
7070
presentedViewController = navigationController
7171
viewController.present(navigationController, animated: true, completion: nil)
7272

73-
QuickStartTourGuide.shared.visited(.readerDiscoverSettings)
7473
WPAnalytics.track(.readerManageViewDisplayed)
7574
}
7675
}

0 commit comments

Comments
 (0)