diff --git a/Modules/Package.swift b/Modules/Package.swift index 032731f1be33..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: "f8c5c417c789c8d052093838e622828ae4ec076f"), + .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 aec1db2194ca..ea94e5a95194 100644 --- a/WordPress.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/WordPress.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "114eb974f44334d6023e80c52968915782f38292095257acdcd8026cfbe347a3", + "originHash" : "5ebdf4185e258d4ee09d79ca86bc6b3cf3875e4b1f4017498da1dc8c489e66cb", "pins" : [ { "identity" : "alamofire", @@ -141,7 +141,7 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/wordpress-mobile/GutenbergKit", "state" : { - "revision" : "f8c5c417c789c8d052093838e622828ae4ec076f" + "revision" : "fb31301ea6a94376237947afb4242f75c074f43c" } }, { diff --git a/WordPress/Classes/ViewRelated/NewGutenberg/NewGutenbergViewController.swift b/WordPress/Classes/ViewRelated/NewGutenberg/NewGutenbergViewController.swift index 466d07ece773..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,6 +337,12 @@ extension NewGutenbergViewController: GutenbergKit.EditorViewControllerDelegate gutenbergDidRequestToggleUndoButton(!state.hasUndo) } + 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 { throw URLError(.unknown) } @@ -807,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 {}