@@ -3,13 +3,13 @@ package org.wordpress.android.ui.posts
3
3
import android.content.Context
4
4
import android.content.Intent
5
5
import org.wordpress.android.WordPress.Companion.getContext
6
- import org.wordpress.android.util.AppLog
7
- import org.wordpress.android.util.AppLog.T
8
6
import org.wordpress.android.ui.prefs.experimentalfeatures.ExperimentalFeatures
9
7
import org.wordpress.android.ui.prefs.experimentalfeatures.ExperimentalFeatures.Feature
10
8
import org.wordpress.android.util.config.GutenbergKitFeature
11
9
import org.wordpress.android.util.analytics.AnalyticsUtils
12
10
import org.wordpress.android.WordPress
11
+ import org.wordpress.android.analytics.AnalyticsTracker
12
+ import org.wordpress.android.util.analytics.AnalyticsTrackerWrapper
13
13
import javax.inject.Inject
14
14
import javax.inject.Singleton
15
15
@@ -22,9 +22,9 @@ import javax.inject.Singleton
22
22
@Singleton
23
23
class EditorLauncher @Inject constructor(
24
24
private val gutenbergKitFeature : GutenbergKitFeature ,
25
- private val experimentalFeatures : ExperimentalFeatures
25
+ private val experimentalFeatures : ExperimentalFeatures ,
26
+ private val analyticsTrackerWrapper : AnalyticsTrackerWrapper
26
27
) {
27
-
28
28
companion object {
29
29
/* *
30
30
* Static accessor for use in static utility classes like ActivityLauncher.
@@ -50,20 +50,16 @@ class EditorLauncher @Inject constructor(
50
50
// Will route to EditPostGutenbergKitActivity when it exists
51
51
val targetActivity = EditPostActivity ::class .java
52
52
53
- val editorType = if (shouldUseGutenbergKit) " gutenberg_kit" else " legacy"
54
- val source = getParamsSource(params)
55
-
56
- AppLog .d(T .EDITOR , " EditorLauncher: routing to $editorType editor from $source " )
57
-
58
- // Track launch method for analytics
59
- trackEditorLaunch(editorType, source, " helper" )
53
+ val properties = mapOf (
54
+ " should_use_gutenberg_kit" to shouldUseGutenbergKit
55
+ )
56
+ analyticsTrackerWrapper.track(stat = AnalyticsTracker .Stat .EDITOR_LAUNCHER , properties)
60
57
61
58
return Intent (context, targetActivity).apply {
62
59
addEditorExtras(params)
63
60
}
64
61
}
65
62
66
-
67
63
/* *
68
64
* Determines if GutenbergKit editor should be used based on feature flags.
69
65
*/
@@ -74,25 +70,6 @@ class EditorLauncher @Inject constructor(
74
70
return isGutenbergEnabled && ! isGutenbergDisabled
75
71
}
76
72
77
- /* *
78
- * Identifies the source of the editor launch based on EditorLauncherParams.
79
- */
80
- private fun getParamsSource (params : EditorLauncherParams ): String {
81
- return when {
82
- params.isQuickPress -> " quickpress"
83
- params.reblogPostTitle != null -> " reblog"
84
- params.insertMedia != null -> " media_upload"
85
- params.reblogAction != null -> " reblog_action"
86
- params.isLandingEditor -> " landing_editor"
87
- params.isPromo -> " promo"
88
- params.isPage -> " page"
89
- params.postLocalId != null || params.postRemoteId != null -> " edit_post"
90
- params.source != null -> params.source.toString().lowercase()
91
- else -> " new_post"
92
- }
93
- }
94
-
95
-
96
73
/* *
97
74
* Adds all editor parameters as Intent extras.
98
75
*/
@@ -143,18 +120,4 @@ class EditorLauncher @Inject constructor(
143
120
params.promptId?.let { putExtra(EditPostActivityConstants .EXTRA_PROMPT_ID , it) }
144
121
params.entryPoint?.let { putExtra(EditPostActivityConstants .EXTRA_ENTRY_POINT , it) }
145
122
}
146
-
147
- /* *
148
- * Track editor launch events for analytics.
149
- */
150
- private fun trackEditorLaunch (editorType : String , source : String , launchMethod : String ) {
151
- val properties = mapOf (
152
- " editor_type" to editorType,
153
- " source" to source,
154
- " launch_method" to launchMethod
155
- )
156
-
157
- // Analytics tracking will be implemented with appropriate event name
158
- AppLog .i(T .EDITOR , " Editor launch tracked: $properties " )
159
- }
160
123
}
0 commit comments