Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 378e05c7 authored by Guillaume Jacquart's avatar Guillaume Jacquart
Browse files

Use telemetry lib

parent 3a7ab8ff
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -153,7 +153,7 @@ dependencies {
        Libs.MapBox.sdk,
        Libs.mpAndroidCharts,

        Libs.sentry
        Libs.telemetry
    )

    debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.9.1'
+0 −5
Original line number Diff line number Diff line
@@ -93,11 +93,6 @@
            android:launchMode="singleInstance"
            android:theme="@style/Theme.InvisibleActivity"
            />

        <meta-data
            android:name="io.sentry.auto-init"
            android:value="false"
            />
    </application>

</manifest>
 No newline at end of file
+3 −20
Original line number Diff line number Diff line
/*
 * Copyright (C) 2021 E FOUNDATION, 2022 MURENA SAS
 * Copyright (C) 2021 E FOUNDATION, 2022 - 2023 MURENA SAS
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
@@ -18,9 +18,8 @@
package foundation.e.privacycentralapp

import android.app.Application
import android.provider.Settings
import com.mapbox.mapboxsdk.Mapbox
import io.sentry.android.core.SentryAndroid
import foundation.e.lib.telemetry.Telemetry

class PrivacyCentralApplication : Application() {

@@ -29,25 +28,9 @@ class PrivacyCentralApplication : Application() {

    override fun onCreate() {
        super.onCreate()
        initTelemetry()
        Telemetry.init(BuildConfig.SENTRY_DSN, this)
        Mapbox.getTelemetry()?.setUserTelemetryRequestState(false)

        dependencyContainer.initBackgroundSingletons()
    }

    private fun initTelemetry() {
        val activateTelemetry = kotlin.runCatching {
            Settings.System.getInt(contentResolver, "telemetry") == 1
        }.getOrDefault(false)

        if (activateTelemetry) {
            SentryAndroid.init(this) { options ->
                options.setDsn(BuildConfig.SENTRY_DSN)
                options.setEnvironment(BuildConfig.BUILD_TYPE)
                options.setSampleRate(1.0)
                options.setEnableUserInteractionTracing(true)
                options.setProfilesSampleRate(1.0)
            }
        }
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -119,4 +119,4 @@ libs.MapBox = [

libs.mpAndroidCharts = 'com.github.PhilJay:MPAndroidChart:v3.1.0'

libs.sentry = 'io.sentry:sentry-android:6.10.0'
libs.telemetry = 'foundation.e.lib:telemetry:0.0.3-alpha'