Skip to content

Commit c0ad158

Browse files
Merge branch 'trunk' into task/19810-simplify-ui
# Conflicts: # WordPress/Classes/ViewRelated/Jetpack/Branding/Coordinator/JetpackFeaturesRemovalCoordinator.swift
2 parents b75d847 + 6298d3b commit c0ad158

File tree

11 files changed

+176
-130
lines changed

11 files changed

+176
-130
lines changed

Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def shared_style_pods
9191
end
9292

9393
def gutenberg_pods
94-
gutenberg tag: 'v1.86.0'
94+
gutenberg tag: 'v1.87.0-alpha1'
9595
end
9696

9797
def gutenberg(options)

Podfile.lock

Lines changed: 105 additions & 105 deletions
Large diffs are not rendered by default.

WordPress/Classes/Utility/BuildInformation/RemoteConfig.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,26 @@ struct RemoteConfig {
1717
// MARK: Remote Config Parameters
1818

1919
var jetpackDeadline: RemoteConfigParameter<String> {
20-
RemoteConfigParameter<String>(key: "jp-deadline", defaultValue: nil, store: store)
20+
RemoteConfigParameter<String>(key: "jp_deadline", defaultValue: nil, store: store)
2121
}
2222

2323
var phaseTwoBlogPostUrl: RemoteConfigParameter<String> {
24-
RemoteConfigParameter<String>(key: "phase-two-blog-post", defaultValue: nil, store: store)
24+
RemoteConfigParameter<String>(key: "phase_two_blog_post", defaultValue: nil, store: store)
2525
}
2626

2727
var phaseThreeBlogPostUrl: RemoteConfigParameter<String> {
28-
RemoteConfigParameter<String>(key: "phase-three-blog-post", defaultValue: nil, store: store)
28+
RemoteConfigParameter<String>(key: "phase_three_blog_post", defaultValue: nil, store: store)
2929
}
3030

3131
var phaseFourBlogPostUrl: RemoteConfigParameter<String> {
32-
RemoteConfigParameter<String>(key: "phase-four-blog-post", defaultValue: nil, store: store)
32+
RemoteConfigParameter<String>(key: "phase_four_blog_post", defaultValue: nil, store: store)
3333
}
3434

3535
var phaseNewUsersBlogPostUrl: RemoteConfigParameter<String> {
36-
RemoteConfigParameter<String>(key: "phase-new-users-blog-post", defaultValue: nil, store: store)
36+
RemoteConfigParameter<String>(key: "phase_new_users_blog_post", defaultValue: nil, store: store)
3737
}
3838

3939
var phaseSelfHostedBlogPostUrl: RemoteConfigParameter<String> {
40-
RemoteConfigParameter<String>(key: "phase-self-hosted-blog-post", defaultValue: nil, store: store)
40+
RemoteConfigParameter<String>(key: "phase_self_hosted_blog_post", defaultValue: nil, store: store)
4141
}
4242
}

WordPress/Classes/ViewRelated/Gutenberg/Collapsable Header/CollapsableHeaderViewController.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,9 @@ class CollapsableHeaderViewController: UIViewController, NoResultsViewHost {
304304
// This helps reset the header changes after a rotation.
305305
scrollViewDidScroll(scrollableView)
306306
scrollViewDidEndDecelerating(scrollableView)
307+
} else {
308+
layoutHeader()
309+
snapToHeight(scrollableView)
307310
}
308311
}
309312

WordPress/Classes/ViewRelated/Gutenberg/GutenbergViewController+MoreActions.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ extension GutenbergViewController {
6868
ActionDispatcher.dispatch(NoticeAction.unlock)
6969
}
7070

71-
alert.addDefaultActionWithTitle(MoreSheetAlert.editorHelpTitle) { [weak self] _ in
71+
let helpTitle = JetpackFeaturesRemovalCoordinator.shouldRemoveJetpackFeatures() ? MoreSheetAlert.editorHelpTitle : MoreSheetAlert.editorHelpAndSupportTitle
72+
alert.addDefaultActionWithTitle(helpTitle) { [weak self] _ in
7273
self?.showEditorHelp()
7374
ActionDispatcher.dispatch(NoticeAction.unlock)
7475
}
@@ -123,6 +124,7 @@ extension GutenbergViewController {
123124
static let pageSettingsTitle = NSLocalizedString("Page Settings", comment: "Name of the button to open the page settings")
124125
static let keepEditingTitle = NSLocalizedString("Keep Editing", comment: "Goes back to editing the post.")
125126
static let accessibilityIdentifier = "MoreSheetAccessibilityIdentifier"
126-
static let editorHelpTitle = NSLocalizedString("Help & Support", comment: "Open editor help options")
127+
static let editorHelpAndSupportTitle = NSLocalizedString("Help & Support", comment: "Open editor help options")
128+
static let editorHelpTitle = NSLocalizedString("Help", comment: "Open editor help options")
127129
}
128130
}

WordPress/Classes/ViewRelated/Gutenberg/GutenbergViewController.swift

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1191,6 +1191,30 @@ extension GutenbergViewController: GutenbergBridgeDataSource {
11911191
func gutenbergCapabilities() -> [Capabilities: Bool] {
11921192
let isFreeWPCom = post.blog.isHostedAtWPcom && !post.blog.hasPaidPlan
11931193
let isWPComSite = post.blog.isHostedAtWPcom || post.blog.isAtomic()
1194+
1195+
// Disable Jetpack-powered editor features in WordPress app based on Features Removal coordination
1196+
if JetpackFeaturesRemovalCoordinator.shouldRemoveJetpackFeatures() {
1197+
return [
1198+
.mentions: false,
1199+
.xposts: false,
1200+
.contactInfoBlock: false,
1201+
.layoutGridBlock: false,
1202+
.tiledGalleryBlock: false,
1203+
.unsupportedBlockEditor: false,
1204+
.canEnableUnsupportedBlockEditor: false,
1205+
.isAudioBlockMediaUploadEnabled: false,
1206+
.mediaFilesCollectionBlock: false,
1207+
.reusableBlock: false,
1208+
.shouldUseFastImage: !post.blog.isPrivate(),
1209+
.facebookEmbed: false,
1210+
.instagramEmbed: false,
1211+
.loomEmbed: false,
1212+
.smartframeEmbed: false,
1213+
.supportSection: false,
1214+
.onlyCoreBlocks: true
1215+
]
1216+
}
1217+
11941218
return [
11951219
.mentions: SuggestionService.shared.shouldShowSuggestions(for: post.blog),
11961220
.xposts: SiteSuggestionService.shared.shouldShowSuggestions(for: post.blog),
@@ -1209,7 +1233,8 @@ extension GutenbergViewController: GutenbergBridgeDataSource {
12091233
.facebookEmbed: post.blog.supports(.facebookEmbed),
12101234
.instagramEmbed: post.blog.supports(.instagramEmbed),
12111235
.loomEmbed: post.blog.supports(.loomEmbed),
1212-
.smartframeEmbed: post.blog.supports(.smartframeEmbed)
1236+
.smartframeEmbed: post.blog.supports(.smartframeEmbed),
1237+
.supportSection: true
12131238
]
12141239
}
12151240

WordPress/Classes/ViewRelated/Stats/Insights/StatsBaseCell.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ class StatsBaseCell: UITableViewCell {
117117
showDetailsButton.isHidden = false
118118

119119
switch statSection {
120-
case .insightsViewsVisitors, .insightsLikesTotals, .insightsCommentsTotals:
120+
case .insightsViewsVisitors, .insightsLikesTotals:
121121
showDetailsButton.setTitle(LocalizedText.buttonTitleThisWeek, for: .normal)
122-
case .insightsFollowerTotals:
122+
case .insightsFollowerTotals, .insightsCommentsTotals:
123123
showDetailsButton.setTitle(LocalizedText.buttonTitleViewMore, for: .normal)
124124
default:
125125
showDetailsButton.setTitle("", for: .normal)

WordPress/Classes/ViewRelated/Stats/Insights/StatsTotalInsightsCell.swift

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ struct StatsTotalInsightsData {
2222
public static func createTotalInsightsData(periodSummary: StatsSummaryTimeIntervalData?,
2323
insightsStore: StatsInsightsStore,
2424
statsSummaryType: StatsSummaryType,
25-
guideText: NSAttributedString? = nil,
2625
periodEndDate: Date? = nil) -> StatsTotalInsightsData {
2726

2827
guard let periodSummary = periodSummary else {
@@ -107,15 +106,16 @@ struct StatsTotalInsightsData {
107106
private enum TextContent {
108107
static let likesTotalGuideTextSingular = NSLocalizedString("Your latest post <a href=\"\">%@</a> has received <strong>one</strong> like.", comment: "A hint shown to the user in stats informing the user that one of their posts has received a like. The %@ placeholder will be replaced with the title of a post, and the HTML tags should remain intact.")
109108
static let likesTotalGuideTextPlural = NSLocalizedString("Your latest post <a href=\"\">%@</a> has received <strong>%d</strong> likes.", comment: "A hint shown to the user in stats informing the user how many likes one of their posts has received. The %@ placeholder will be replaced with the title of a post, the %d with the number of likes, and the HTML tags should remain intact.")
110-
static let commentsTotalGuideText = NSLocalizedString("Tap \"Week\" to see your top commenters.", comment: "A hint shown to the user in stats telling them how to navigate to the Comments detail view.")
109+
static let commentsTotalGuideText = NSLocalizedString("Tap \"View more\" to see your top commenters.", comment: "A hint shown to the user in stats telling them how to navigate to the Comments detail view.")
111110
}
112111
}
113112

114113
class StatsTotalInsightsCell: StatsBaseCell {
115114
private weak var siteStatsInsightsDelegate: SiteStatsInsightsDelegate?
116115
private var lastPostInsight: StatsLastPostInsight?
117116
private var statsSummaryType: StatsSummaryType?
118-
private var guideURL: URL? = nil
117+
private var guideURL: URL?
118+
private var guideText: NSAttributedString?
119119

120120
private let outerStackView = UIStackView()
121121
private let topInnerStackView = UIStackView()
@@ -151,7 +151,7 @@ class StatsTotalInsightsCell: StatsBaseCell {
151151
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
152152
super.traitCollectionDidChange(previousTraitCollection)
153153

154-
updateGuideView()
154+
rebuildGuideViewIfNeeded()
155155
}
156156

157157
private func configureView() {
@@ -239,6 +239,7 @@ class StatsTotalInsightsCell: StatsBaseCell {
239239
self.statSection = statSection
240240
self.lastPostInsight = dataRow.lastPostInsight
241241
self.statsSummaryType = dataRow.statsSummaryType
242+
self.guideText = dataRow.guideText
242243
self.siteStatsInsightsDelegate = siteStatsInsightsDelegate
243244
self.siteStatsInsightDetailsDelegate = siteStatsInsightsDelegate
244245

@@ -247,14 +248,13 @@ class StatsTotalInsightsCell: StatsBaseCell {
247248

248249
countLabel.text = dataRow.count.abbreviatedString()
249250

250-
updateGuideView()
251+
updateGuideView(withGuideText: dataRow.guideText)
251252
updateComparisonLabel(withCount: dataRow.count, difference: dataRow.difference, percentage: dataRow.percentage)
252253
}
253254

254-
private func updateGuideView() {
255-
if let statsSummaryType = statsSummaryType,
256-
let guideText = StatsTotalInsightsData.makeTotalInsightsGuideText(lastPostInsight: lastPostInsight, statsSummaryType: statsSummaryType),
257-
guideText.string.isEmpty == false {
255+
private func updateGuideView(withGuideText guideText: NSAttributedString?) {
256+
if let guideText = guideText,
257+
guideText.string.isEmpty == false {
258258
outerStackView.addArrangedSubview(guideView)
259259

260260
guideViewLabel.attributedText = addTipEmojiToGuide(guideText)
@@ -267,6 +267,16 @@ class StatsTotalInsightsCell: StatsBaseCell {
267267
}
268268
}
269269

270+
// Rebuilds guide view for accessibility only if guide view already exists
271+
private func rebuildGuideViewIfNeeded() {
272+
if guideText != nil,
273+
let statsSummaryType = statsSummaryType,
274+
let guideText = StatsTotalInsightsData.makeTotalInsightsGuideText(lastPostInsight: lastPostInsight, statsSummaryType: statsSummaryType) {
275+
self.guideText = guideText
276+
updateGuideView(withGuideText: guideText)
277+
}
278+
}
279+
270280
private func updateComparisonLabel(withCount count: Int, difference: Int?, percentage: Int?) {
271281
guard let difference = difference,
272282
let percentage = percentage,

WordPress/Jetpack/Classes/ViewRelated/WordPress-to-Jetpack Migration/Welcome/MigrationWelcomeViewController.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ final class MigrationWelcomeViewController: UIViewController {
9999
])
100100
}
101101

102-
/// Increases the tableView's bottom inset so it doesn't cover the bottom actions sheet.
102+
/// Increases the tableView's bottom inset so it doesn't get covered by the bottom actions sheet.
103103
private func updateTableViewContentInset() {
104104
let bottomInset = -view.safeAreaInsets.bottom + bottomSheet.bounds.height
105105
self.tableView.contentInset.bottom = bottomInset + Constants.tableViewBottomInsetMargin
@@ -116,7 +116,13 @@ final class MigrationWelcomeViewController: UIViewController {
116116
static let tableViewLeadingMargin = CGFloat(30)
117117

118118
/// Used for the `tableHeaderView` layout guide margins.
119-
static let tableHeaderViewMargins = NSDirectionalEdgeInsets(top: 0, leading: 30, bottom: 30, trailing: 30)
119+
static let tableHeaderViewMargins: NSDirectionalEdgeInsets = {
120+
var insets = NSDirectionalEdgeInsets(top: 20, leading: 30, bottom: 30, trailing: 30)
121+
if #available(iOS 15, *) {
122+
insets.top = 0
123+
}
124+
return insets
125+
}()
120126
}
121127
}
122128

WordPress/WordPressTest/JetpackBrandingMenuCardPresenterTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ private class RemoteConfigStoreMock: RemoteConfigStore {
148148
var phaseThreeBlogPostUrl: String?
149149

150150
override func value(for key: String) -> Any? {
151-
if key == "phase-three-blog-post" {
151+
if key == "phase_three_blog_post" {
152152
return phaseThreeBlogPostUrl
153153
}
154154
return super.value(for: key)

0 commit comments

Comments
 (0)