lifting the low privacy build config to the config
This commit is contained in:
parent
811b2e8c75
commit
d42c27bfe0
|
@ -61,6 +61,8 @@ object Config {
|
||||||
*/
|
*/
|
||||||
const val HANDLE_CALL_ASSERTED_IDENTITY_EVENTS = false
|
const val HANDLE_CALL_ASSERTED_IDENTITY_EVENTS = false
|
||||||
|
|
||||||
|
const val LOW_PRIVACY_LOG_ENABLE = false
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The analytics configuration to use for the Debug build type.
|
* The analytics configuration to use for the Debug build type.
|
||||||
* Can be disabled by providing Analytics.Disabled
|
* Can be disabled by providing Analytics.Disabled
|
||||||
|
|
|
@ -237,7 +237,6 @@ android {
|
||||||
resValue "string", "app_name", "Element dbg"
|
resValue "string", "app_name", "Element dbg"
|
||||||
resValue "color", "launcher_background", "#0DBD8B"
|
resValue "color", "launcher_background", "#0DBD8B"
|
||||||
|
|
||||||
buildConfigField "boolean", "LOW_PRIVACY_LOG_ENABLE", "false"
|
|
||||||
// Set to true if you want to enable strict mode in debug
|
// Set to true if you want to enable strict mode in debug
|
||||||
buildConfigField "boolean", "ENABLE_STRICT_MODE_LOGS", "false"
|
buildConfigField "boolean", "ENABLE_STRICT_MODE_LOGS", "false"
|
||||||
|
|
||||||
|
@ -252,7 +251,6 @@ android {
|
||||||
resValue "string", "app_name", "Element"
|
resValue "string", "app_name", "Element"
|
||||||
resValue "color", "launcher_background", "#0DBD8B"
|
resValue "color", "launcher_background", "#0DBD8B"
|
||||||
|
|
||||||
buildConfigField "boolean", "LOW_PRIVACY_LOG_ENABLE", "false"
|
|
||||||
buildConfigField "boolean", "ENABLE_STRICT_MODE_LOGS", "false"
|
buildConfigField "boolean", "ENABLE_STRICT_MODE_LOGS", "false"
|
||||||
|
|
||||||
// When updating this block, please also update the same block in the `nightly` buildType below
|
// When updating this block, please also update the same block in the `nightly` buildType below
|
||||||
|
|
|
@ -32,7 +32,6 @@ import dagger.hilt.components.SingletonComponent
|
||||||
import im.vector.app.BuildConfig
|
import im.vector.app.BuildConfig
|
||||||
import im.vector.app.EmojiCompatWrapper
|
import im.vector.app.EmojiCompatWrapper
|
||||||
import im.vector.app.EmojiSpanify
|
import im.vector.app.EmojiSpanify
|
||||||
import im.vector.app.config.Analytics
|
|
||||||
import im.vector.app.config.Config
|
import im.vector.app.config.Config
|
||||||
import im.vector.app.SpaceStateHandler
|
import im.vector.app.SpaceStateHandler
|
||||||
import im.vector.app.SpaceStateHandlerImpl
|
import im.vector.app.SpaceStateHandlerImpl
|
||||||
|
@ -44,11 +43,9 @@ import im.vector.app.core.time.Clock
|
||||||
import im.vector.app.core.time.DefaultClock
|
import im.vector.app.core.time.DefaultClock
|
||||||
import im.vector.app.core.utils.AndroidSystemSettingsProvider
|
import im.vector.app.core.utils.AndroidSystemSettingsProvider
|
||||||
import im.vector.app.core.utils.SystemSettingsProvider
|
import im.vector.app.core.utils.SystemSettingsProvider
|
||||||
import im.vector.app.features.analytics.AnalyticsConfig
|
|
||||||
import im.vector.app.features.analytics.AnalyticsTracker
|
import im.vector.app.features.analytics.AnalyticsTracker
|
||||||
import im.vector.app.features.analytics.VectorAnalytics
|
import im.vector.app.features.analytics.VectorAnalytics
|
||||||
import im.vector.app.features.analytics.impl.DefaultVectorAnalytics
|
import im.vector.app.features.analytics.impl.DefaultVectorAnalytics
|
||||||
import im.vector.app.features.home.room.detail.composer.voice.VoiceMessageConfig
|
|
||||||
import im.vector.app.features.invite.AutoAcceptInvites
|
import im.vector.app.features.invite.AutoAcceptInvites
|
||||||
import im.vector.app.features.invite.CompileTimeAutoAcceptInvites
|
import im.vector.app.features.invite.CompileTimeAutoAcceptInvites
|
||||||
import im.vector.app.features.navigation.DefaultNavigator
|
import im.vector.app.features.navigation.DefaultNavigator
|
||||||
|
@ -217,6 +214,7 @@ object VectorStaticModule {
|
||||||
isDebug = BuildConfig.DEBUG,
|
isDebug = BuildConfig.DEBUG,
|
||||||
sdkInt = Build.VERSION.SDK_INT,
|
sdkInt = Build.VERSION.SDK_INT,
|
||||||
applicationId = BuildConfig.APPLICATION_ID,
|
applicationId = BuildConfig.APPLICATION_ID,
|
||||||
|
lowPrivacyLoggingEnabled = Config.LOW_PRIVACY_LOG_ENABLE,
|
||||||
)
|
)
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
|
|
|
@ -29,6 +29,7 @@ import im.vector.app.BuildConfig
|
||||||
import im.vector.app.core.di.ActiveSessionHolder
|
import im.vector.app.core.di.ActiveSessionHolder
|
||||||
import im.vector.app.core.network.WifiDetector
|
import im.vector.app.core.network.WifiDetector
|
||||||
import im.vector.app.core.pushers.model.PushData
|
import im.vector.app.core.pushers.model.PushData
|
||||||
|
import im.vector.app.core.resources.BuildMeta
|
||||||
import im.vector.app.core.services.GuardServiceStarter
|
import im.vector.app.core.services.GuardServiceStarter
|
||||||
import im.vector.app.features.notifications.NotifiableEventResolver
|
import im.vector.app.features.notifications.NotifiableEventResolver
|
||||||
import im.vector.app.features.notifications.NotificationActionIds
|
import im.vector.app.features.notifications.NotificationActionIds
|
||||||
|
@ -70,6 +71,7 @@ class VectorMessagingReceiver : MessagingReceiver() {
|
||||||
@Inject lateinit var unifiedPushStore: UnifiedPushStore
|
@Inject lateinit var unifiedPushStore: UnifiedPushStore
|
||||||
@Inject lateinit var pushParser: PushParser
|
@Inject lateinit var pushParser: PushParser
|
||||||
@Inject lateinit var actionIds: NotificationActionIds
|
@Inject lateinit var actionIds: NotificationActionIds
|
||||||
|
@Inject lateinit var buildMeta: BuildMeta
|
||||||
|
|
||||||
private val coroutineScope = CoroutineScope(SupervisorJob())
|
private val coroutineScope = CoroutineScope(SupervisorJob())
|
||||||
|
|
||||||
|
@ -89,7 +91,7 @@ class VectorMessagingReceiver : MessagingReceiver() {
|
||||||
Timber.tag(loggerTag.value).d("## onMessage() received")
|
Timber.tag(loggerTag.value).d("## onMessage() received")
|
||||||
|
|
||||||
val sMessage = String(message)
|
val sMessage = String(message)
|
||||||
if (BuildConfig.LOW_PRIVACY_LOG_ENABLE) {
|
if (buildMeta.lowPrivacyLoggingEnabled) {
|
||||||
Timber.tag(loggerTag.value).d("## onMessage() $sMessage")
|
Timber.tag(loggerTag.value).d("## onMessage() $sMessage")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,7 +175,7 @@ class VectorMessagingReceiver : MessagingReceiver() {
|
||||||
*/
|
*/
|
||||||
private suspend fun onMessageReceivedInternal(pushData: PushData) {
|
private suspend fun onMessageReceivedInternal(pushData: PushData) {
|
||||||
try {
|
try {
|
||||||
if (BuildConfig.LOW_PRIVACY_LOG_ENABLE) {
|
if (buildMeta.lowPrivacyLoggingEnabled) {
|
||||||
Timber.tag(loggerTag.value).d("## onMessageReceivedInternal() : $pushData")
|
Timber.tag(loggerTag.value).d("## onMessageReceivedInternal() : $pushData")
|
||||||
} else {
|
} else {
|
||||||
Timber.tag(loggerTag.value).d("## onMessageReceivedInternal()")
|
Timber.tag(loggerTag.value).d("## onMessageReceivedInternal()")
|
||||||
|
|
|
@ -20,4 +20,5 @@ data class BuildMeta(
|
||||||
val isDebug: Boolean,
|
val isDebug: Boolean,
|
||||||
val sdkInt: Int,
|
val sdkInt: Int,
|
||||||
val applicationId: String,
|
val applicationId: String,
|
||||||
|
val lowPrivacyLoggingEnabled: Boolean,
|
||||||
)
|
)
|
||||||
|
|
|
@ -26,6 +26,7 @@ import androidx.core.content.getSystemService
|
||||||
import androidx.core.location.LocationListenerCompat
|
import androidx.core.location.LocationListenerCompat
|
||||||
import im.vector.app.BuildConfig
|
import im.vector.app.BuildConfig
|
||||||
import im.vector.app.core.di.ActiveSessionHolder
|
import im.vector.app.core.di.ActiveSessionHolder
|
||||||
|
import im.vector.app.core.resources.BuildMeta
|
||||||
import im.vector.app.features.session.coroutineScope
|
import im.vector.app.features.session.coroutineScope
|
||||||
import kotlinx.coroutines.flow.MutableSharedFlow
|
import kotlinx.coroutines.flow.MutableSharedFlow
|
||||||
import kotlinx.coroutines.flow.asSharedFlow
|
import kotlinx.coroutines.flow.asSharedFlow
|
||||||
|
@ -40,7 +41,8 @@ import javax.inject.Singleton
|
||||||
@Singleton
|
@Singleton
|
||||||
class LocationTracker @Inject constructor(
|
class LocationTracker @Inject constructor(
|
||||||
context: Context,
|
context: Context,
|
||||||
private val activeSessionHolder: ActiveSessionHolder
|
private val activeSessionHolder: ActiveSessionHolder,
|
||||||
|
private val buildMeta: BuildMeta,
|
||||||
) : LocationListenerCompat {
|
) : LocationListenerCompat {
|
||||||
|
|
||||||
private val locationManager = context.getSystemService<LocationManager>()
|
private val locationManager = context.getSystemService<LocationManager>()
|
||||||
|
@ -104,7 +106,7 @@ class LocationTracker @Inject constructor(
|
||||||
}
|
}
|
||||||
.maxByOrNull { location -> location.time }
|
.maxByOrNull { location -> location.time }
|
||||||
?.let { latestKnownLocation ->
|
?.let { latestKnownLocation ->
|
||||||
if (BuildConfig.LOW_PRIVACY_LOG_ENABLE) {
|
if (buildMeta.lowPrivacyLoggingEnabled) {
|
||||||
Timber.d("lastKnownLocation: $latestKnownLocation")
|
Timber.d("lastKnownLocation: $latestKnownLocation")
|
||||||
} else {
|
} else {
|
||||||
Timber.d("lastKnownLocation: ${latestKnownLocation.provider}")
|
Timber.d("lastKnownLocation: ${latestKnownLocation.provider}")
|
||||||
|
@ -162,7 +164,7 @@ class LocationTracker @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onLocationChanged(location: Location) {
|
override fun onLocationChanged(location: Location) {
|
||||||
if (BuildConfig.LOW_PRIVACY_LOG_ENABLE) {
|
if (buildMeta.lowPrivacyLoggingEnabled) {
|
||||||
Timber.d("onLocationChanged: $location")
|
Timber.d("onLocationChanged: $location")
|
||||||
} else {
|
} else {
|
||||||
Timber.d("onLocationChanged: ${location.provider}")
|
Timber.d("onLocationChanged: ${location.provider}")
|
||||||
|
@ -196,7 +198,7 @@ class LocationTracker @Inject constructor(
|
||||||
|
|
||||||
private fun notifyLocation(location: Location) {
|
private fun notifyLocation(location: Location) {
|
||||||
activeSessionHolder.getSafeActiveSession()?.coroutineScope?.launch {
|
activeSessionHolder.getSafeActiveSession()?.coroutineScope?.launch {
|
||||||
if (BuildConfig.LOW_PRIVACY_LOG_ENABLE) {
|
if (buildMeta.lowPrivacyLoggingEnabled) {
|
||||||
Timber.d("notify location: $location")
|
Timber.d("notify location: $location")
|
||||||
} else {
|
} else {
|
||||||
Timber.d("notify location: ${location.provider}")
|
Timber.d("notify location: ${location.provider}")
|
||||||
|
|
|
@ -19,6 +19,7 @@ import android.net.Uri
|
||||||
import im.vector.app.BuildConfig
|
import im.vector.app.BuildConfig
|
||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
import im.vector.app.core.extensions.takeAs
|
import im.vector.app.core.extensions.takeAs
|
||||||
|
import im.vector.app.core.resources.BuildMeta
|
||||||
import im.vector.app.core.resources.StringProvider
|
import im.vector.app.core.resources.StringProvider
|
||||||
import im.vector.app.core.time.Clock
|
import im.vector.app.core.time.Clock
|
||||||
import im.vector.app.features.displayname.getBestName
|
import im.vector.app.features.displayname.getBestName
|
||||||
|
@ -62,6 +63,7 @@ class NotifiableEventResolver @Inject constructor(
|
||||||
private val noticeEventFormatter: NoticeEventFormatter,
|
private val noticeEventFormatter: NoticeEventFormatter,
|
||||||
private val displayableEventFormatter: DisplayableEventFormatter,
|
private val displayableEventFormatter: DisplayableEventFormatter,
|
||||||
private val clock: Clock,
|
private val clock: Clock,
|
||||||
|
private val buildMeta: BuildMeta,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
// private val eventDisplay = RiotEventDisplay(context)
|
// private val eventDisplay = RiotEventDisplay(context)
|
||||||
|
@ -264,7 +266,7 @@ class NotifiableEventResolver @Inject constructor(
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
Timber.e("## unsupported notifiable event for eventId [${event.eventId}]")
|
Timber.e("## unsupported notifiable event for eventId [${event.eventId}]")
|
||||||
if (BuildConfig.LOW_PRIVACY_LOG_ENABLE) {
|
if (buildMeta.lowPrivacyLoggingEnabled) {
|
||||||
Timber.e("## unsupported notifiable event for event [$event]")
|
Timber.e("## unsupported notifiable event for event [$event]")
|
||||||
}
|
}
|
||||||
// TODO generic handling?
|
// TODO generic handling?
|
||||||
|
|
|
@ -22,6 +22,7 @@ import androidx.annotation.WorkerThread
|
||||||
import im.vector.app.ActiveSessionDataSource
|
import im.vector.app.ActiveSessionDataSource
|
||||||
import im.vector.app.BuildConfig
|
import im.vector.app.BuildConfig
|
||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
|
import im.vector.app.core.resources.BuildMeta
|
||||||
import im.vector.app.core.utils.FirstThrottler
|
import im.vector.app.core.utils.FirstThrottler
|
||||||
import im.vector.app.features.displayname.getBestName
|
import im.vector.app.features.displayname.getBestName
|
||||||
import im.vector.app.features.settings.VectorPreferences
|
import im.vector.app.features.settings.VectorPreferences
|
||||||
|
@ -46,7 +47,8 @@ class NotificationDrawerManager @Inject constructor(
|
||||||
private val activeSessionDataSource: ActiveSessionDataSource,
|
private val activeSessionDataSource: ActiveSessionDataSource,
|
||||||
private val notifiableEventProcessor: NotifiableEventProcessor,
|
private val notifiableEventProcessor: NotifiableEventProcessor,
|
||||||
private val notificationRenderer: NotificationRenderer,
|
private val notificationRenderer: NotificationRenderer,
|
||||||
private val notificationEventPersistence: NotificationEventPersistence
|
private val notificationEventPersistence: NotificationEventPersistence,
|
||||||
|
private val buildMeta: BuildMeta,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
private val handlerThread: HandlerThread = HandlerThread("NotificationDrawerManager", Thread.MIN_PRIORITY)
|
private val handlerThread: HandlerThread = HandlerThread("NotificationDrawerManager", Thread.MIN_PRIORITY)
|
||||||
|
@ -92,7 +94,7 @@ class NotificationDrawerManager @Inject constructor(
|
||||||
}
|
}
|
||||||
// If we support multi session, event list should be per userId
|
// If we support multi session, event list should be per userId
|
||||||
// Currently only manage single session
|
// Currently only manage single session
|
||||||
if (BuildConfig.LOW_PRIVACY_LOG_ENABLE) {
|
if (buildMeta.lowPrivacyLoggingEnabled) {
|
||||||
Timber.d("onNotifiableEventReceived(): $notifiableEvent")
|
Timber.d("onNotifiableEventReceived(): $notifiableEvent")
|
||||||
} else {
|
} else {
|
||||||
Timber.d("onNotifiableEventReceived(): is push: ${notifiableEvent.canBeReplaced}")
|
Timber.d("onNotifiableEventReceived(): is push: ${notifiableEvent.canBeReplaced}")
|
||||||
|
|
|
@ -23,6 +23,7 @@ import im.vector.app.features.session.coroutineScope
|
||||||
import im.vector.app.test.fakes.FakeActiveSessionHolder
|
import im.vector.app.test.fakes.FakeActiveSessionHolder
|
||||||
import im.vector.app.test.fakes.FakeContext
|
import im.vector.app.test.fakes.FakeContext
|
||||||
import im.vector.app.test.fakes.FakeLocationManager
|
import im.vector.app.test.fakes.FakeLocationManager
|
||||||
|
import im.vector.app.test.fixtures.aBuildMeta
|
||||||
import im.vector.app.test.test
|
import im.vector.app.test.test
|
||||||
import io.mockk.every
|
import io.mockk.every
|
||||||
import io.mockk.just
|
import io.mockk.just
|
||||||
|
@ -56,7 +57,7 @@ class LocationTrackerTest {
|
||||||
@Before
|
@Before
|
||||||
fun setUp() {
|
fun setUp() {
|
||||||
mockkStatic("im.vector.app.features.session.SessionCoroutineScopesKt")
|
mockkStatic("im.vector.app.features.session.SessionCoroutineScopesKt")
|
||||||
locationTracker = LocationTracker(fakeContext.instance, fakeActiveSessionHolder.instance)
|
locationTracker = LocationTracker(fakeContext.instance, fakeActiveSessionHolder.instance, aBuildMeta())
|
||||||
fakeLocationManager.givenRemoveUpdates(locationTracker)
|
fakeLocationManager.givenRemoveUpdates(locationTracker)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,4 +19,9 @@ package im.vector.app.test.fixtures
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import im.vector.app.core.resources.BuildMeta
|
import im.vector.app.core.resources.BuildMeta
|
||||||
|
|
||||||
fun aBuildMeta() = BuildMeta(Build.VERSION_CODES.O)
|
fun aBuildMeta() = BuildMeta(
|
||||||
|
isDebug = false,
|
||||||
|
sdkInt = Build.VERSION_CODES.O,
|
||||||
|
applicationId = "im.vector",
|
||||||
|
lowPrivacyLoggingEnabled = false,
|
||||||
|
)
|
||||||
|
|
Loading…
Reference in New Issue