From 2be7feabb818ebca8970f2f390f9f7e92f3208ef Mon Sep 17 00:00:00 2001 From: David Calhoun Date: Wed, 22 Jan 2025 12:57:33 -0500 Subject: [PATCH 1/5] feat: Receive logged GutenbergKit error --- .../NewGutenberg/NewGutenbergViewController.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/WordPress/Classes/ViewRelated/NewGutenberg/NewGutenbergViewController.swift b/WordPress/Classes/ViewRelated/NewGutenberg/NewGutenbergViewController.swift index 466d07ece773..3c3598e75c4e 100644 --- a/WordPress/Classes/ViewRelated/NewGutenberg/NewGutenbergViewController.swift +++ b/WordPress/Classes/ViewRelated/NewGutenberg/NewGutenbergViewController.swift @@ -331,6 +331,11 @@ extension NewGutenbergViewController: GutenbergKit.EditorViewControllerDelegate gutenbergDidRequestToggleUndoButton(!state.hasUndo) } + func editor(_ viewController: GutenbergKit.EditorViewController, didLogError error: GutenbergKit.EditorError) { + // TODO: Log error to application montioring service + NSLog(">>>> Gutenberg Error: \(error)") + } + func editor(_ viewController: GutenbergKit.EditorViewController, performRequest: GutenbergKit.EditorNetworkRequest) async throws -> GutenbergKit.EditorNetworkResponse { throw URLError(.unknown) } From 2a457c920b2c6e3f262567cd6e53728cd3d45cb6 Mon Sep 17 00:00:00 2001 From: David Calhoun Date: Fri, 24 Jan 2025 19:25:04 -0500 Subject: [PATCH 2/5] feat: Send GutenbergKit exceptions to crash logger --- .../NewGutenbergViewController.swift | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/WordPress/Classes/ViewRelated/NewGutenberg/NewGutenbergViewController.swift b/WordPress/Classes/ViewRelated/NewGutenberg/NewGutenbergViewController.swift index 3c3598e75c4e..1d8ff3ab9d6a 100644 --- a/WordPress/Classes/ViewRelated/NewGutenberg/NewGutenbergViewController.swift +++ b/WordPress/Classes/ViewRelated/NewGutenberg/NewGutenbergViewController.swift @@ -292,6 +292,12 @@ class NewGutenbergViewController: UIViewController, PostEditor, PublishingEditor func showFeedbackView() { self.present(SubmitFeedbackViewController(source: "gutenberg_kit", feedbackPrefix: "Editor"), animated: true) } + + func logException(_ exception: GutenbergJSException, with callback: @escaping () -> Void) { + DispatchQueue.main.async { + WordPressAppDelegate.crashLogging?.logJavaScriptException(exception, callback: callback) + } + } } extension NewGutenbergViewController: GutenbergKit.EditorViewControllerDelegate { @@ -331,9 +337,10 @@ extension NewGutenbergViewController: GutenbergKit.EditorViewControllerDelegate gutenbergDidRequestToggleUndoButton(!state.hasUndo) } - func editor(_ viewController: GutenbergKit.EditorViewController, didLogError error: GutenbergKit.EditorError) { - // TODO: Log error to application montioring service - NSLog(">>>> Gutenberg Error: \(error)") + func editor(_ viewController: GutenbergKit.EditorViewController, didLogException error: GutenbergKit.GutenbergJSException) { + logException(error) { + // Do nothing + } } func editor(_ viewController: GutenbergKit.EditorViewController, performRequest: GutenbergKit.EditorNetworkRequest) async throws -> GutenbergKit.EditorNetworkResponse { @@ -812,3 +819,7 @@ extension NewGutenbergViewController { }) } } + +// Extend Gutenberg JavaScript exception struct to conform the protocol defined in the Crash Logging service +extension GutenbergJSException.StacktraceLine: @retroactive AutomatticTracks.JSStacktraceLine {} +extension GutenbergJSException: @retroactive AutomatticTracks.JSException {} From e2e67b07a8d00a7ce1cf86cf0a51b6c3bae35d78 Mon Sep 17 00:00:00 2001 From: David Calhoun Date: Mon, 27 Jan 2025 15:41:17 -0500 Subject: [PATCH 3/5] build: Update GutenbergKit ref --- Modules/Package.swift | 2 +- WordPress.xcworkspace/xcshareddata/swiftpm/Package.resolved | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Modules/Package.swift b/Modules/Package.swift index 032731f1be33..3a865ef8b980 100644 --- a/Modules/Package.swift +++ b/Modules/Package.swift @@ -48,7 +48,7 @@ let package = Package( .package(url: "https://github.com/zendesk/support_sdk_ios", from: "8.0.3"), // We can't use wordpress-rs branches nor commits here. Only tags work. .package(url: "https://github.com/Automattic/wordpress-rs", revision: "alpha-20241116"), - .package(url: "https://github.com/wordpress-mobile/GutenbergKit", revision: "f8c5c417c789c8d052093838e622828ae4ec076f"), + .package(url: "https://github.com/wordpress-mobile/GutenbergKit", revision: "ff7e97410c56dd54c145b4511752996d38f49a96"), .package(url: "https://github.com/Automattic/color-studio", branch: "trunk"), ], targets: XcodeSupport.targets + [ diff --git a/WordPress.xcworkspace/xcshareddata/swiftpm/Package.resolved b/WordPress.xcworkspace/xcshareddata/swiftpm/Package.resolved index aec1db2194ca..d87c374b8e18 100644 --- a/WordPress.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/WordPress.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "114eb974f44334d6023e80c52968915782f38292095257acdcd8026cfbe347a3", + "originHash" : "bdd4522467cae8240bb329316f3ab2112ec42c71b43de6901c4c585d28604cc1", "pins" : [ { "identity" : "alamofire", @@ -141,7 +141,7 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/wordpress-mobile/GutenbergKit", "state" : { - "revision" : "f8c5c417c789c8d052093838e622828ae4ec076f" + "revision" : "ff7e97410c56dd54c145b4511752996d38f49a96" } }, { From b3101bc89c11543194376f030e4bb2e5d10549b2 Mon Sep 17 00:00:00 2001 From: David Calhoun Date: Mon, 27 Jan 2025 17:01:06 -0500 Subject: [PATCH 4/5] build: Update GutenbergKit ref --- Modules/Package.swift | 2 +- WordPress.xcworkspace/xcshareddata/swiftpm/Package.resolved | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Modules/Package.swift b/Modules/Package.swift index 3a865ef8b980..9ba3a50d3cc7 100644 --- a/Modules/Package.swift +++ b/Modules/Package.swift @@ -48,7 +48,7 @@ let package = Package( .package(url: "https://github.com/zendesk/support_sdk_ios", from: "8.0.3"), // We can't use wordpress-rs branches nor commits here. Only tags work. .package(url: "https://github.com/Automattic/wordpress-rs", revision: "alpha-20241116"), - .package(url: "https://github.com/wordpress-mobile/GutenbergKit", revision: "ff7e97410c56dd54c145b4511752996d38f49a96"), + .package(url: "https://github.com/wordpress-mobile/GutenbergKit", revision: "7c72b11fd9c4dba754706b4e79325f59b37ea3b6"), .package(url: "https://github.com/Automattic/color-studio", branch: "trunk"), ], targets: XcodeSupport.targets + [ diff --git a/WordPress.xcworkspace/xcshareddata/swiftpm/Package.resolved b/WordPress.xcworkspace/xcshareddata/swiftpm/Package.resolved index d87c374b8e18..19072e32b993 100644 --- a/WordPress.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/WordPress.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "bdd4522467cae8240bb329316f3ab2112ec42c71b43de6901c4c585d28604cc1", + "originHash" : "1f2cbbc585c412b25ab65bc4628c74121f18c47c82152bd8377b23856d8b3bc8", "pins" : [ { "identity" : "alamofire", @@ -141,7 +141,7 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/wordpress-mobile/GutenbergKit", "state" : { - "revision" : "ff7e97410c56dd54c145b4511752996d38f49a96" + "revision" : "7c72b11fd9c4dba754706b4e79325f59b37ea3b6" } }, { From 4c4325dd0a9d88df2f2e650486bc15ef1c25206c Mon Sep 17 00:00:00 2001 From: David Calhoun Date: Tue, 28 Jan 2025 13:18:18 -0500 Subject: [PATCH 5/5] build: Update GutenbergKit ref --- Modules/Package.swift | 2 +- WordPress.xcworkspace/xcshareddata/swiftpm/Package.resolved | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Modules/Package.swift b/Modules/Package.swift index 9ba3a50d3cc7..a3f7ad39fbcb 100644 --- a/Modules/Package.swift +++ b/Modules/Package.swift @@ -48,7 +48,7 @@ let package = Package( .package(url: "https://github.com/zendesk/support_sdk_ios", from: "8.0.3"), // We can't use wordpress-rs branches nor commits here. Only tags work. .package(url: "https://github.com/Automattic/wordpress-rs", revision: "alpha-20241116"), - .package(url: "https://github.com/wordpress-mobile/GutenbergKit", revision: "7c72b11fd9c4dba754706b4e79325f59b37ea3b6"), + .package(url: "https://github.com/wordpress-mobile/GutenbergKit", revision: "fb31301ea6a94376237947afb4242f75c074f43c"), .package(url: "https://github.com/Automattic/color-studio", branch: "trunk"), ], targets: XcodeSupport.targets + [ diff --git a/WordPress.xcworkspace/xcshareddata/swiftpm/Package.resolved b/WordPress.xcworkspace/xcshareddata/swiftpm/Package.resolved index 19072e32b993..ea94e5a95194 100644 --- a/WordPress.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/WordPress.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "1f2cbbc585c412b25ab65bc4628c74121f18c47c82152bd8377b23856d8b3bc8", + "originHash" : "5ebdf4185e258d4ee09d79ca86bc6b3cf3875e4b1f4017498da1dc8c489e66cb", "pins" : [ { "identity" : "alamofire", @@ -141,7 +141,7 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/wordpress-mobile/GutenbergKit", "state" : { - "revision" : "7c72b11fd9c4dba754706b4e79325f59b37ea3b6" + "revision" : "fb31301ea6a94376237947afb4242f75c074f43c" } }, {