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

Commit d6d763fd authored by Sayantan Roychowdhury's avatar Sayantan Roychowdhury
Browse files

code restructure. End sentry session in trackTelemetryOptionChange()

parent 38eca053
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -31,10 +31,12 @@ object Telemetry {
        this.enableOsTag = enableOsTag

        this.isTelemetryEnabled = checkTelemetryDeveloperOption()
        if (isTelemetryEnabled) {
        val sentryDsn =
            if (isTelemetryEnabled) identifier
            else String()

        SentryAndroid.init(application) { options ->
                options.dsn = identifier
            }
            options.dsn = sentryDsn
        }

        Sentry.configureScope {
@@ -65,10 +67,8 @@ object Telemetry {
                     * telemetry from developer options is turned off.
                     * In this case, disable telemetry.
                     */
                    SentryAndroid.init(application) { options ->
                        options.dsn = ""
                    }
                    isTelemetryEnabled = false
                    Sentry.endSession()
                    init(identifier, application, enableOsTag)

                } else if (!isTelemetryEnabled && checkTelemetryDeveloperOption()) {
                    println("Testingggg: enable")
@@ -76,6 +76,7 @@ object Telemetry {
                     * Just the opposite of the above case.
                     * Re-initialise to auto enable.
                     */
                    Sentry.endSession()
                    init(identifier, application, enableOsTag)
                }