enable analytics by default on nightly

This commit is contained in:
valere 2022-12-02 12:39:13 +01:00
parent 17b8d3c97b
commit e6444fe9c0
4 changed files with 27 additions and 2 deletions

View File

@ -32,6 +32,7 @@ import androidx.core.provider.FontsContractCompat
import androidx.lifecycle.DefaultLifecycleObserver import androidx.lifecycle.DefaultLifecycleObserver
import androidx.lifecycle.LifecycleOwner import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.ProcessLifecycleOwner import androidx.lifecycle.ProcessLifecycleOwner
import androidx.lifecycle.coroutineScope
import androidx.multidex.MultiDex import androidx.multidex.MultiDex
import androidx.recyclerview.widget.SnapHelper import androidx.recyclerview.widget.SnapHelper
import com.airbnb.epoxy.Carousel import com.airbnb.epoxy.Carousel
@ -68,6 +69,7 @@ import im.vector.app.features.settings.VectorPreferences
import im.vector.app.features.themes.ThemeUtils import im.vector.app.features.themes.ThemeUtils
import im.vector.app.features.version.VersionProvider import im.vector.app.features.version.VersionProvider
import im.vector.application.R import im.vector.application.R
import kotlinx.coroutines.launch
import org.jitsi.meet.sdk.log.JitsiMeetDefaultLogHandler import org.jitsi.meet.sdk.log.JitsiMeetDefaultLogHandler
import org.matrix.android.sdk.api.Matrix import org.matrix.android.sdk.api.Matrix
import org.matrix.android.sdk.api.auth.AuthenticationService import org.matrix.android.sdk.api.auth.AuthenticationService
@ -135,6 +137,13 @@ class VectorApplication :
autoRageShaker.initialize() autoRageShaker.initialize()
vectorUncaughtExceptionHandler.activate() vectorUncaughtExceptionHandler.activate()
if (BuildConfig.FLAVOR == "rustCrypto") {
ProcessLifecycleOwner.get().lifecycle.coroutineScope.launch {
vectorAnalytics.setUserConsent(true)
}
vectorPreferences.setLabsAutoReportUISI(true)
}
// Remove Log handler statically added by Jitsi // Remove Log handler statically added by Jitsi
Timber.forest() Timber.forest()
.filterIsInstance(JitsiMeetDefaultLogHandler::class.java) .filterIsInstance(JitsiMeetDefaultLogHandler::class.java)

View File

@ -93,4 +93,6 @@ object Config {
* Can be disabled by providing Analytics.Disabled * Can be disabled by providing Analytics.Disabled
*/ */
val NIGHTLY_ANALYTICS_CONFIG = RELEASE_ANALYTICS_CONFIG.copy(sentryEnvironment = "NIGHTLY") val NIGHTLY_ANALYTICS_CONFIG = RELEASE_ANALYTICS_CONFIG.copy(sentryEnvironment = "NIGHTLY")
val ER_NIGHTLY_ANALYTICS_CONFIG = RELEASE_ANALYTICS_CONFIG.copy(sentryEnvironment = "element-r")
val ER_DEBUG_ANALYTICS_CONFIG = DEBUG_ANALYTICS_CONFIG.copy(sentryEnvironment = "element-r")
} }

View File

@ -38,8 +38,16 @@ object ConfigurationModule {
@Provides @Provides
fun providesAnalyticsConfig(): AnalyticsConfig { fun providesAnalyticsConfig(): AnalyticsConfig {
val config: Analytics = when (BuildConfig.BUILD_TYPE) { val config: Analytics = when (BuildConfig.BUILD_TYPE) {
"debug" -> Config.DEBUG_ANALYTICS_CONFIG "debug" -> if (BuildConfig.FLAVOR == "rustCrypto") {
"nightly" -> Config.NIGHTLY_ANALYTICS_CONFIG Config.ER_DEBUG_ANALYTICS_CONFIG
} else {
Config.DEBUG_ANALYTICS_CONFIG
}
"nightly" -> if (BuildConfig.FLAVOR == "rustCrypto") {
Config.ER_NIGHTLY_ANALYTICS_CONFIG
} else {
Config.NIGHTLY_ANALYTICS_CONFIG
}
"release" -> Config.RELEASE_ANALYTICS_CONFIG "release" -> Config.RELEASE_ANALYTICS_CONFIG
else -> throw IllegalStateException("Unhandled build type: ${BuildConfig.BUILD_TYPE}") else -> throw IllegalStateException("Unhandled build type: ${BuildConfig.BUILD_TYPE}")
} }

View File

@ -1092,6 +1092,12 @@ class VectorPreferences @Inject constructor(
return defaultPrefs.getBoolean(SETTINGS_LABS_AUTO_REPORT_UISI, false) return defaultPrefs.getBoolean(SETTINGS_LABS_AUTO_REPORT_UISI, false)
} }
fun setLabsAutoReportUISI(enabled: Boolean) {
return defaultPrefs.edit {
putBoolean(SETTINGS_LABS_AUTO_REPORT_UISI, enabled)
}
}
fun prefSpacesShowAllRoomInHome(): Boolean { fun prefSpacesShowAllRoomInHome(): Boolean {
return defaultPrefs.getBoolean(SETTINGS_PREF_SPACE_SHOW_ALL_ROOM_IN_HOME, false) return defaultPrefs.getBoolean(SETTINGS_PREF_SPACE_SHOW_ALL_ROOM_IN_HOME, false)
} }