Skip to content

Commit e972e06

Browse files
wpmobilebotkeandcalhouncrazytonyli
authored
Merge release/26.4 into trunk (#24933)
* Enable New Stats for fresh install (#24921) * Fix Reader insets on ipad (#24922) * Enable Intelligence FF for Jetpack (#24923) * feat: Disable header navigation when GutenbergKit opens dialogs (#24917) * feat: Disable header navigation when GutenbergKit opens dialogs Disabling the native header navigation respects GutenbergKit's web-based modal dialogs, where focus should remain on the dialog to mitigate confusion from surrounding UI elements. * build: Update GutenbergKit version * Revert "build: Update GutenbergKit version" This reverts commit 3f758ad. * build: Update GutenbergKit version * fix: GutenbergKit allows empty editor settings (#24924) Sites without GutenbergKit plugin do not have the editor settings REST API endpoint. For these sites or missing settings due to other reasons, we should allow the editor to open with empty editor settings. This approach aligns with the original implementation: ac3ad4c#diff-985e4813fea24c7bfb37425f15af08cda2f4ace0da805b3eecc249862fdca2d5L362-L367 * Revert "Remove a few applicationIconBadgeNumber API calls" (#24928) This reverts commit 25c1ed7. * Fully release WP.com web based login * Update app translations – `Localizable.strings` * Update WordPress metadata translations * Update Jetpack metadata translations * Bump version number * Fix Xcode warning (#24926) * Fix robocop warning ``` fastlane/lanes/screenshots.rb#L14: Layout/TrailingWhitespace: Trailing whitespace detected. ``` --------- Co-authored-by: Alex Grebenyuk <alex.grebenyuk@automattic.com> Co-authored-by: David Calhoun <github@davidcalhoun.me> Co-authored-by: Tony Li <tony.li@automattic.com>
1 parent 6cfda58 commit e972e06

File tree

82 files changed

+3501
-759
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+3501
-759
lines changed

Modules/Package.resolved

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ let package = Package(
5353
.package(url: "https://github.com/zendesk/support_sdk_ios", from: "8.0.3"),
5454
// We can't use wordpress-rs branches nor commits here. Only tags work.
5555
.package(url: "https://github.com/Automattic/wordpress-rs", revision: "alpha-20250926"),
56-
.package(url: "https://github.com/wordpress-mobile/GutenbergKit", from: "0.8.1-alpha.2"),
56+
.package(url: "https://github.com/wordpress-mobile/GutenbergKit", from: "0.9.0"),
5757
.package(
5858
url: "https://github.com/Automattic/color-studio",
5959
revision: "bf141adc75e2769eb469a3e095bdc93dc30be8de"

Tests/KeystoneTests/Tests/Features/Notifications/NotificationsViewControllerTests.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import XCTest
22
import WordPressData
3-
import UserNotifications
43
@testable import WordPress
54

65
final class NotificationsViewControllerTests: XCTestCase {
@@ -47,7 +46,7 @@ final class NotificationsViewControllerTests: XCTestCase {
4746
func testResetApplicationBadgeWhenAccountChange() throws {
4847
// Give
4948
let newUnreadCount = 1
50-
UNUserNotificationCenter.current().setBadgeCount(0)
49+
UIApplication.shared.applicationIconBadgeNumber = 0
5150
ZendeskUtils.unreadNotificationsCount = newUnreadCount
5251

5352
// When

WordPress/Classes/Stores/RemoteFeatureFlagStore.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ class RemoteFeatureFlagStore {
2727
return deviceID
2828
}
2929

30+
/// Returns `true` if the store hasn't been updated yet. It uses the
31+
/// presence of `deviceID` as an indicator of the previous install.
32+
public var isFreshInstall: Bool {
33+
persistenceStore.string(forKey: Constants.DeviceIdKey) == nil
34+
}
35+
3036
init(persistenceStore: UserPersistentRepository = UserDefaults.standard) {
3137
self.persistenceStore = persistenceStore
3238
}

WordPress/Classes/System/Root View/WordPressAuthenticatorProtocol.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ extension WordPressAuthenticator: WordPressAuthenticatorProtocol {
2828
return false
2929
}
3030

31-
return RemoteFeatureFlag.dotComWebLogin.enabled()
31+
return true
3232
}
3333

3434
private static func continueWithDotCom(_ viewController: UIViewController) -> Bool {

WordPress/Classes/System/WordPressAppDelegate.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,11 @@ extension WordPressAppDelegate {
533533
FeatureFlagOverrideStore().override(RemoteFeatureFlag.dotComWebLogin, withValue: true)
534534
}
535535

536+
/// - warning: must be called before the `update(using:then:)`.
537+
if remoteFeatureFlagStore.isFreshInstall {
538+
FeatureFlagOverrideStore().override(FeatureFlag.newStats, withValue: true)
539+
}
540+
536541
var api: WordPressComRestApi
537542
if let authToken {
538543
api = WordPressComRestApi.defaultV2Api(authToken: authToken)

WordPress/Classes/Utility/Notifications/PushNotificationsManager.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public final class PushNotificationsManager: NSObject {
7575
sharedApplication.registerForRemoteNotifications()
7676
}
7777
sharedApplication.unregisterForRemoteNotifications()
78-
UNUserNotificationCenter.current().setBadgeCount(0)
78+
sharedApplication.applicationIconBadgeNumber = 0
7979
didRegisterForRemoteNotifications = false
8080
}
8181

@@ -187,7 +187,7 @@ public final class PushNotificationsManager: NSObject {
187187

188188
// Badge: Update
189189
if let badgeCountNumber = userInfo.number(forKeyPath: Notification.badgePath)?.intValue {
190-
UNUserNotificationCenter.current().setBadgeCount(badgeCountNumber)
190+
sharedApplication.applicationIconBadgeNumber = badgeCountNumber
191191
}
192192

193193
// Badge: Reset

WordPress/Classes/Utility/ZendeskUtils.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ class ZendeskUtils: NSObject, ZendeskUtilsProtocol {
307307
/// - post an NSNotification so the various indicators can be cleared.
308308
///
309309
static func pushNotificationRead() {
310-
UNUserNotificationCenter.current().setBadgeCount(UIApplication.shared.applicationIconBadgeNumber - unreadNotificationsCount)
310+
UIApplication.shared.applicationIconBadgeNumber -= unreadNotificationsCount
311311
unreadNotificationsCount = 0
312312
saveUnreadCount()
313313
postNotificationRead()

WordPress/Classes/ViewRelated/Comments/Controllers/Editor/CommentGutenbergEditorViewController.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,12 @@ extension CommentGutenbergEditorViewController: GutenbergKit.EditorViewControlle
9696
func editor(_ viewController: GutenbergKit.EditorViewController, didTriggerAutocompleter type: String) {
9797
// Do nothing
9898
}
99+
100+
func editor(_ viewController: GutenbergKit.EditorViewController, didOpenModalDialog dialogType: String) {
101+
// Do nothing
102+
}
103+
104+
func editor(_ viewController: GutenbergKit.EditorViewController, didCloseModalDialog dialogType: String) {
105+
// Do nothing
106+
}
99107
}

WordPress/Classes/ViewRelated/NewGutenberg/NewGutenbergViewController.swift

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class NewGutenbergViewController: UIViewController, PostEditor, PublishingEditor
5151
}
5252

5353
struct EditorDependencies {
54-
let settings: String
54+
let settings: String?
5555
let didLoadCookies: Bool
5656
}
5757

@@ -111,6 +111,7 @@ class NewGutenbergViewController: UIViewController, PostEditor, PublishingEditor
111111
private var editorViewController: GutenbergKit.EditorViewController
112112
private var activityIndicator: UIActivityIndicatorView?
113113
private var hasEditorStarted = false
114+
private var isModalDialogOpen = false
114115

115116
lazy var autosaver = Autosaver() {
116117
self.performAutoSave()
@@ -383,13 +384,13 @@ class NewGutenbergViewController: UIViewController, PostEditor, PublishingEditor
383384
}
384385

385386
@MainActor
386-
func startEditor(settings: String) async throws {
387+
func startEditor(settings: String?) async throws {
387388
guard case .dependenciesReady = self.editorState else {
388389
preconditionFailure("`startEditor` should only be called when the editor is in the `.dependenciesReady` state.")
389390
}
390391

391392
let updatedConfiguration = self.editorViewController.configuration.toBuilder()
392-
.setEditorSettings(settings)
393+
.apply(settings) { $0.setEditorSettings($1) }
393394
.setTitle(post.postTitle ?? "")
394395
.setContent(post.content ?? "")
395396
.build()
@@ -469,7 +470,14 @@ class NewGutenbergViewController: UIViewController, PostEditor, PublishingEditor
469470

470471
// MARK: - Editor Setup
471472
private func fetchEditorDependencies() async throws -> EditorDependencies {
472-
let settings = try await blockEditorSettingsService.getSettingsString(allowingCachedResponse: true)
473+
let settings: String?
474+
do {
475+
settings = try await blockEditorSettingsService.getSettingsString(allowingCachedResponse: true)
476+
} catch {
477+
DDLogError("Failed to fetch editor settings: \(error)")
478+
settings = nil
479+
}
480+
473481
let loaded = await loadAuthenticationCookiesAsync()
474482

475483
return EditorDependencies(settings: settings, didLoadCookies: loaded)
@@ -496,6 +504,14 @@ class NewGutenbergViewController: UIViewController, PostEditor, PublishingEditor
496504
}
497505
}
498506
}
507+
508+
private func setNavigationItemsEnabled(_ enabled: Bool) {
509+
navigationBarManager.closeButton.isEnabled = enabled
510+
navigationBarManager.moreButton.isEnabled = enabled
511+
navigationBarManager.publishButton.isEnabled = enabled
512+
navigationBarManager.undoButton.isEnabled = enabled
513+
navigationBarManager.redoButton.isEnabled = enabled
514+
}
499515
}
500516

501517
extension NewGutenbergViewController: GutenbergKit.EditorViewControllerDelegate {
@@ -608,6 +624,16 @@ extension NewGutenbergViewController: GutenbergKit.EditorViewControllerDelegate
608624
}
609625
}
610626

627+
func editor(_ viewController: GutenbergKit.EditorViewController, didOpenModalDialog dialogType: String) {
628+
isModalDialogOpen = true
629+
setNavigationItemsEnabled(false)
630+
}
631+
632+
func editor(_ viewController: GutenbergKit.EditorViewController, didCloseModalDialog dialogType: String) {
633+
isModalDialogOpen = false
634+
setNavigationItemsEnabled(true)
635+
}
636+
611637
private func convertMediaInfoArrayToJSONString(_ mediaInfoArray: [MediaInfo]) -> String? {
612638
do {
613639
let jsonData = try JSONEncoder().encode(mediaInfoArray)

0 commit comments

Comments
 (0)