This repository has been archived by the owner on Feb 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
For #8172: Add a new 'E_Fennec_To_Fenix_Migrated' Leanplum event
This new event will be sent when the user has successfully migrated from Fennec to Fenix. This event will only be sent to Leanplum and not to the other telemetry services like Glean or Adjust. Co-authored-by: ValentinTimisica <valentin.timisica@softvision.ro>
- Loading branch information
1 parent
abd56c5
commit 127169f
Showing
6 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
app/src/main/java/org/mozilla/fenix/migration/MigrationTelemetryListener.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
package org.mozilla.fenix | ||
|
||
import kotlinx.coroutines.ExperimentalCoroutinesApi | ||
import kotlinx.coroutines.flow.collect | ||
import mozilla.components.lib.state.ext.flowScoped | ||
import mozilla.components.support.base.log.logger.Logger | ||
import mozilla.components.support.migration.state.MigrationProgress | ||
import mozilla.components.support.migration.state.MigrationStore | ||
import org.mozilla.fenix.components.metrics.Event | ||
import org.mozilla.fenix.components.metrics.MetricController | ||
|
||
class MigrationTelemetryListener( | ||
private val metrics: MetricController, | ||
private val store: MigrationStore | ||
) { | ||
@UseExperimental(ExperimentalCoroutinesApi::class) | ||
fun start() { | ||
// Observe for migration completed. | ||
store.flowScoped { flow -> | ||
flow.collect { state -> | ||
Logger("MigrationTelemetryListener").debug("Migration state: ${state.progress}") | ||
if (state.progress == MigrationProgress.COMPLETED) { | ||
metrics.track(Event.FennecToFenixMigrated) | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters