Skip to content

Commit

Permalink
feat: Improve editor session events (#23955)
Browse files Browse the repository at this point in the history
* feat: Introduce `gutenberg_kit` editor session event property value

Denote sessions utilizing the GutenbergKit editor.

* feat: Track editor session start event

Enable more robust editor session analysis.

* build: Update GutenbergKit ref

* build: Update GutenbergKit ref
  • Loading branch information
dcalhoun authored Jan 8, 2025
1 parent 8415756 commit 0ea3205
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Modules/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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: "v0.0.3"),
.package(url: "https://github.com/wordpress-mobile/GutenbergKit", revision: "4476d597b271778d001a26c50d74e527b54ebfef"),
.package(url: "https://github.com/Automattic/color-studio", branch: "trunk"),
],
targets: XcodeSupport.targets + [
Expand Down
5 changes: 2 additions & 3 deletions WordPress.xcworkspace/xcshareddata/swiftpm/Package.resolved
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"originHash" : "e67326cf4e0b967f85976c160b6e3742a401276eabf3e18b25fce8bb219e1350",
"originHash" : "8a87409582dec4bc7c7f6ee5d6a6761cead545bd116f82237fc9e6a881e7c3fb",
"pins" : [
{
"identity" : "alamofire",
Expand Down Expand Up @@ -150,8 +150,7 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/wordpress-mobile/GutenbergKit",
"state" : {
"branch" : "v0.0.3",
"revision" : "84edec43cc8639d5d8a66a07758902e33f0d2d94"
"revision" : "4476d597b271778d001a26c50d74e527b54ebfef"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class NewGutenbergViewController: UIViewController, PostEditor, PublishingEditor
self.post = post

self.replaceEditor = replaceEditor
self.editorSession = PostEditorAnalyticsSession(editor: .gutenberg, post: post)
self.editorSession = PostEditorAnalyticsSession(editor: .gutenbergKit, post: post)
self.navigationBarManager = navigationBarManager ?? PostEditorNavigationBarManager()

let networkClient = NewGutenbergNetworkClient(blog: post.blog)
Expand Down Expand Up @@ -315,6 +315,16 @@ class NewGutenbergViewController: UIViewController, PostEditor, PublishingEditor
}

extension NewGutenbergViewController: GutenbergKit.EditorViewControllerDelegate {
func editorDidLoad(_ viewContoller: GutenbergKit.EditorViewController) {
if !editorSession.started {
// Note that this method is also used to track startup performance
// It assumes this is being called when the editor has finished loading
// If you need to refactor this, please ensure that the startup_time_ms property
// is still reflecting the actual startup time of the editor
editorSession.start()
}
}

func editor(_ viewContoller: GutenbergKit.EditorViewController, didDisplayInitialContent content: String) {
// Do nothing
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ private extension PostEditorAnalyticsSession {
extension PostEditorAnalyticsSession {
enum Editor: String {
case gutenberg
case gutenbergKit = "gutenberg_kit"
case classic
case html
}
Expand Down

0 comments on commit 0ea3205

Please sign in to comment.