1
0
Fork 0

For #981 - mma docs

master
Jeff Boek 2019-06-14 12:16:55 -07:00
parent f323c38be0
commit 45b096c84f
3 changed files with 33 additions and 41 deletions

View File

@ -11,6 +11,7 @@ import com.leanplum.annotations.Parser
import com.leanplum.internal.LeanplumInternal
import org.mozilla.fenix.BuildConfig
import org.mozilla.fenix.utils.Settings
import java.util.*
private val Event.name: String?
get() = when (this) {
@ -57,11 +58,18 @@ class LeanplumMetricsService(private val application: Application) : MetricsServ
Leanplum.setIsTestModeEnabled(false)
Leanplum.setApplicationContext(application)
Leanplum.setDeviceId(UUID.randomUUID().toString())
Parser.parseVariables(application)
LeanplumActivityHelper.enableLifecycleCallbacks(application)
val installedApps = MozillaProductDetector.getInstalledMozillaProducts(application)
Leanplum.start(application, hashMapOf(
"default_browser" to (MozillaProductDetector.getMozillaBrowserDefault(application) ?: "")
"default_browser" to (MozillaProductDetector.getMozillaBrowserDefault(application) ?: ""),
"fennec_installed" to installedApps.contains(MozillaProductDetector.MozillaProducts.FIREFOX.productName),
"focus_installed" to installedApps.contains(MozillaProductDetector.MozillaProducts.FOCUS.productName),
"klar_installed" to installedApps.contains(MozillaProductDetector.MozillaProducts.KLAR.productName)
))
}

View File

@ -20,6 +20,7 @@ object MozillaProductDetector {
REFERENCE_BROWSER_DEBUG("org.mozilla.reference.browser.debug"),
FENIX("org.mozilla.fenix"),
FOCUS("org.mozilla.focus"),
KLAR("org.mozilla.klar"),
// Other products
LOCKWISE("mozilla.lockbox")

File diff suppressed because one or more lines are too long