Skip to content
This repository has been archived by the owner on Jul 5, 2021. It is now read-only.

Commit

Permalink
Add Glean SDK. closes #4954
Browse files Browse the repository at this point in the history
  • Loading branch information
cnevinc committed May 6, 2020
1 parent 29bbb08 commit 3367d38
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
8 changes: 8 additions & 0 deletions app/build.gradle
@@ -1,3 +1,7 @@
plugins {
id "com.jetbrains.python.envs" version "0.0.26"
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
Expand Down Expand Up @@ -184,6 +188,9 @@ repositories {
mavenCentral()
}

ext.gleanGenerateMarkdownDocs = true
ext.gleanDocsDirectory = "$rootDir/docs"
apply plugin: "org.mozilla.telemetry.glean-gradle-plugin"

dependencies {
implementation project(':telemetry-annotation')
Expand Down Expand Up @@ -252,6 +259,7 @@ dependencies {
implementation "org.mozilla.components:ui-autocomplete:${Versions.android_components}"
implementation "org.mozilla.components:lib-fetch-httpurlconnection:${Versions.android_components}"
implementation "org.mozilla.components:concept-fetch:${Versions.android_components}"
implementation "org.mozilla.components:service-glean:${Versions.mozilla_android_components}"

implementation "com.adjust.sdk:adjust-android:${Versions.adjust}"
implementation "com.android.installreferrer:installreferrer:${Versions.android_installreferrer}"
Expand Down
Expand Up @@ -16,6 +16,8 @@ import android.preference.PreferenceManager
import android.util.Log
import android.webkit.PermissionRequest
import mozilla.components.lib.fetch.httpurlconnection.HttpURLConnectionClient
import mozilla.components.service.glean.Glean
import mozilla.components.service.glean.config.Configuration
import org.mozilla.focus.BuildConfig
import org.mozilla.focus.R
import org.mozilla.focus.provider.ScreenshotContract
Expand Down Expand Up @@ -399,7 +401,7 @@ object TelemetryWrapper {
ThreadUtils.postToBackgroundThread {
// We want to queue this ping and send asap.
TelemetryWrapper.settingsEvent(key, enabled.toString(), true)

Glean.setUploadEnabled(enabled)
// If there are things already collected, we'll still upload them.
TelemetryHolder.get()
.configuration
Expand All @@ -419,6 +421,9 @@ object TelemetryWrapper {

val trackerTokenPrefKey = resources.getString(R.string.pref_key_s_tracker_token)
val channel = AppConstants.getChannel()

Glean.initialize(context, telemetryEnabled, Configuration(channel = channel))

val configuration = TelemetryConfiguration(context)
.setServerEndpoint("https://incoming.telemetry.mozilla.org")
.setAppName(TELEMETRY_APP_NAME_ZERDA)
Expand Down
4 changes: 4 additions & 0 deletions build.gradle
Expand Up @@ -8,12 +8,16 @@ buildscript {
maven {
url 'https://maven.fabric.io/public'
}
maven {
url "https://maven.mozilla.org/maven2"
}
}
dependencies {
classpath "com.android.tools.build:gradle:${Versions.android_gradle_plugin}"
classpath "com.google.android.gms:oss-licenses-plugin:${Versions.gms_oss_licenses_plugin}"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.kotlin}"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:${Versions.navigation}"
classpath "org.mozilla.components:tooling-glean-gradle:${Versions.mozilla_android_components}"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Expand Down
1 change: 1 addition & 0 deletions buildSrc/src/main/java/Dependencies.kt
Expand Up @@ -33,6 +33,7 @@ object Versions {
const val lottie = "3.4.0"
const val leakcanary = "2.0-beta-3"
const val android_components = "0.52.0"
const val mozilla_android_components = "39.0.1"
const val adjust = "4.20.0"
const val android_installreferrer = "1.1.2"
const val annotation = "1.1.0"
Expand Down

0 comments on commit 3367d38

Please sign in to comment.