Skip to content

Commit

Permalink
chore: remove encrypted proteus storage flag [WPB-15409]
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamadJaara committed Jan 20, 2025
1 parent 318f3a4 commit 0ddec09
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 70 deletions.
2 changes: 1 addition & 1 deletion app/src/main/kotlin/com/wire/android/WireApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ class WireApplication : BaseApp() {

private suspend fun initializeApplicationLoggingFrameworks() {
// 1. Datadog should be initialized first
ExternalLoggerManager.initDatadogLogger(applicationContext, globalDataStore.get())
ExternalLoggerManager.initDatadogLogger(applicationContext)
// 2. Initialize our internal logging framework
val isLoggingEnabled = globalDataStore.get().isLoggingEnabled().first()
val config = if (isLoggingEnabled) {
Expand Down
12 changes: 0 additions & 12 deletions app/src/main/kotlin/com/wire/android/datastore/GlobalDataStore.kt
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ class GlobalDataStore @Inject constructor(@ApplicationContext private val contex
private val MIGRATION_COMPLETED = booleanPreferencesKey("migration_completed")
private val WELCOME_SCREEN_PRESENTED = booleanPreferencesKey("welcome_screen_presented")
private val IS_LOGGING_ENABLED = booleanPreferencesKey("is_logging_enabled")
private val IS_ENCRYPTED_PROTEUS_STORAGE_ENABLED =
booleanPreferencesKey("is_encrypted_proteus_storage_enabled")
private val APP_LOCK_PASSCODE = stringPreferencesKey("app_lock_passcode")
private val APP_LOCK_SOURCE = intPreferencesKey("app_lock_source")

Expand Down Expand Up @@ -104,16 +102,6 @@ class GlobalDataStore @Inject constructor(@ApplicationContext private val contex
context.dataStore.edit { it[RECORD_AUDIO_EFFECTS_CHECKBOX] = enabled }
}

fun isEncryptedProteusStorageEnabled(): Flow<Boolean> =
getBooleanPreference(
IS_ENCRYPTED_PROTEUS_STORAGE_ENABLED,
BuildConfig.ENCRYPT_PROTEUS_STORAGE
)

suspend fun setEncryptedProteusStorageEnabled(enabled: Boolean) {
context.dataStore.edit { it[IS_ENCRYPTED_PROTEUS_STORAGE_ENABLED] = enabled }
}

suspend fun setMigrationCompleted() {
context.dataStore.edit { it[MIGRATION_COMPLETED] = true }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,13 @@ import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.runBlocking

@Module
@InstallIn(SingletonComponent::class)
class KaliumConfigsModule {

@Provides
fun provideKaliumConfigs(globalDataStore: GlobalDataStore, context: Context): KaliumConfigs {
fun provideKaliumConfigs(context: Context): KaliumConfigs {
val fileRestriction: BuildFileRestrictionState = if (BuildConfig.FILE_RESTRICTION_ENABLED) {
BuildConfig.FILE_RESTRICTION_LIST.split(",").map { it.trim() }.let {
BuildFileRestrictionState.AllowSome(it)
Expand All @@ -55,7 +53,7 @@ class KaliumConfigsModule {
lowerKeyingMaterialsUpdateThreshold = BuildConfig.PRIVATE_BUILD,
developmentApiEnabled = BuildConfig.DEVELOPMENT_API_ENABLED,
ignoreSSLCertificatesForUnboundCalls = BuildConfig.IGNORE_SSL_CERTIFICATES,
encryptProteusStorage = runBlocking { globalDataStore.isEncryptedProteusStorageEnabled().first() },
encryptProteusStorage = true,
guestRoomLink = BuildConfig.ENABLE_GUEST_ROOM_LINK,
selfDeletingMessages = BuildConfig.SELF_DELETING_MESSAGES,
wipeOnCookieInvalid = BuildConfig.WIPE_ON_COOKIE_INVALID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ fun DebugDataOptions(
appVersion = appVersion,
buildVariant = buildVariant,
onCopyText = onCopyText,
onEnableEncryptedProteusStorageChange = viewModel::enableEncryptedProteusStorage,
onRestartSlowSyncForRecovery = viewModel::restartSlowSyncForRecovery,
onForceUpdateApiVersions = viewModel::forceUpdateApiVersions,
onManualMigrationPressed = { onManualMigrationPressed(viewModel.currentAccount()) },
Expand All @@ -89,7 +88,6 @@ fun DebugDataOptionsContent(
appVersion: String,
buildVariant: String,
onCopyText: (String) -> Unit,
onEnableEncryptedProteusStorageChange: (Boolean) -> Unit,
onDisableEventProcessingChange: (Boolean) -> Unit,
onRestartSlowSyncForRecovery: () -> Unit,
onForceUpdateApiVersions: () -> Unit,
Expand Down Expand Up @@ -198,10 +196,7 @@ fun DebugDataOptionsContent(
)
}
}
ProteusOptions(
isEncryptedStorageEnabled = state.isEncryptedProteusStorageEnabled,
onEncryptedStorageEnabledChange = onEnableEncryptedProteusStorageChange
)

if (BuildConfig.DEBUG) {
MLSOptions(
keyPackagesCount = state.keyPackagesCount,
Expand Down Expand Up @@ -337,17 +332,6 @@ private fun MLSOptions(
//endregion

//region Proteus Options
@Composable
private fun ProteusOptions(
isEncryptedStorageEnabled: Boolean,
onEncryptedStorageEnabledChange: (Boolean) -> Unit,
) {
FolderHeader(stringResource(R.string.label_proteus_option_title))
EnableEncryptedProteusStorageSwitch(
isEnabled = isEncryptedStorageEnabled,
onCheckedChange = onEncryptedStorageEnabledChange
)
}

@Composable
private fun EnableEncryptedProteusStorageSwitch(
Expand Down Expand Up @@ -539,15 +523,13 @@ fun PreviewOtherDebugOptions() = WireTheme {
buildVariant = "debug",
onCopyText = {},
state = DebugDataOptionsState(
isEncryptedProteusStorageEnabled = true,
keyPackagesCount = 10,
mslClientId = "clientId",
mlsErrorMessage = "error",
isManualMigrationAllowed = true,
debugId = "debugId",
commitish = "commitish"
),
onEnableEncryptedProteusStorageChange = {},
onForceUpdateApiVersions = {},
onDisableEventProcessingChange = {},
onRestartSlowSyncForRecovery = {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
package com.wire.android.ui.debug

data class DebugDataOptionsState(
val isEncryptedProteusStorageEnabled: Boolean = false,
val isEventProcessingDisabled: Boolean = false,
val keyPackagesCount: Int = 0,
val mslClientId: String = "null",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ interface DebugDataOptionsViewModel {
fun state(): DebugDataOptionsState = DebugDataOptionsState()
fun currentAccount(): UserId = UserId("value", "domain")
fun checkCrlRevocationList() {}
fun enableEncryptedProteusStorage(enabled: Boolean) {}
fun restartSlowSyncForRecovery() {}
fun enrollE2EICertificate() {}
fun handleE2EIEnrollmentResult(result: Either<CoreFailure, E2EIEnrollmentResult>) {}
Expand Down Expand Up @@ -103,7 +102,6 @@ class DebugDataOptionsViewModelImpl
override val infoMessage = _infoMessage.asSharedFlow()

init {
observeEncryptedProteusStorageState()
observeMlsMetadata()
checkIfCanTriggerManualMigration()
setGitHashAndDeviceId()
Expand Down Expand Up @@ -170,14 +168,6 @@ class DebugDataOptionsViewModelImpl
}
}

override fun enableEncryptedProteusStorage(enabled: Boolean) {
if (enabled) {
viewModelScope.launch {
globalDataStore.setEncryptedProteusStorageEnabled(true)
}
}
}

override fun restartSlowSyncForRecovery() {
viewModelScope.launch {
restartSlowSyncProcessForRecovery()
Expand Down Expand Up @@ -257,15 +247,6 @@ class DebugDataOptionsViewModelImpl
}
}

//region Private
private fun observeEncryptedProteusStorageState() {
viewModelScope.launch {
globalDataStore.isEncryptedProteusStorageEnabled().collect {
state = state.copy(isEncryptedProteusStorageEnabled = it)
}
}
}

// If status is NoNeed, it means that the user has already been migrated in and older app version,
// or it is a new install
// this is why we check the existence of the database file
Expand Down
10 changes: 2 additions & 8 deletions app/src/private/kotlin/com/wire/android/ExternalLoggerManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,15 @@ import com.datadog.android.rum.GlobalRum
import com.datadog.android.rum.RumMonitor
import com.datadog.android.rum.tracking.ActivityViewTrackingStrategy
import com.datadog.android.rum.tracking.ComponentPredicate
import com.wire.android.datastore.GlobalDataStore
import com.wire.android.ui.WireActivity
import com.wire.android.util.sha256
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.runBlocking
import com.wire.android.util.getDeviceIdString

private const val LONG_TASK_THRESH_HOLD_MS = 1000L

object ExternalLoggerManager {

fun initDatadogLogger(context: Context, globalDataStore: GlobalDataStore) {
fun initDatadogLogger(context: Context) {

val clientToken = BuildConfig.DATADOG_CLIENT_TOKEN
val applicationId = BuildConfig.DATADOG_APP_ID
Expand Down Expand Up @@ -59,12 +56,9 @@ object ExternalLoggerManager {
.build()

val credentials = Credentials(clientToken, environmentName, appVariantName, applicationId)
val extraInfo = mapOf(
"encrypted_proteus_storage_enabled" to runBlocking { globalDataStore.isEncryptedProteusStorageEnabled().first() }
)

Datadog.initialize(context, credentials, configuration, TrackingConsent.GRANTED)
Datadog.setUserInfo(id = context.getDeviceIdString()?.sha256(), extraInfo = extraInfo)
Datadog.setUserInfo(id = context.getDeviceIdString()?.sha256(), extraInfo = emptyMap())
GlobalRum.registerIfAbsent(RumMonitor.Builder().build())
}
}
6 changes: 0 additions & 6 deletions default.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"application_is_private_build": false,
"development_api_enabled": false,
"paginated_conversation_list_enabled": true,
"encrypt_proteus_storage": true,
"analytics_enabled": true,
"analytics_app_key": "4483f7a58ae3e70b3780319c4ccb5c88a037be49",
"analytics_server_url": "https://countly.wire.com/"
Expand All @@ -30,7 +29,6 @@
"default_backend_url_blacklist": "https://clientblacklist.wire.com/staging",
"default_backend_url_website": "https://wire.com",
"default_backend_title": "wire-staging",
"encrypt_proteus_storage": false,
"analytics_enabled": false,
"picture_in_picture_enabled": true,
"analytics_app_key": "8ffae535f1836ed5f58fd5c8a11c00eca07c5438",
Expand All @@ -53,7 +51,6 @@
"default_backend_url_blacklist": "https://clientblacklist.wire.com/staging",
"default_backend_url_website": "https://wire.com",
"default_backend_title": "wire-staging",
"encrypt_proteus_storage": true,
"analytics_enabled": true,
"picture_in_picture_enabled": true,
"analytics_app_key": "8ffae535f1836ed5f58fd5c8a11c00eca07c5438",
Expand All @@ -65,7 +62,6 @@
"logging_enabled": true,
"application_is_private_build": true,
"development_api_enabled": false,
"encrypt_proteus_storage": true,
"analytics_enabled": true,
"analytics_app_key": "8ffae535f1836ed5f58fd5c8a11c00eca07c5438",
"analytics_server_url": "https://countly.wire.com/"
Expand All @@ -76,7 +72,6 @@
"logging_enabled": true,
"application_is_private_build": true,
"development_api_enabled": false,
"encrypt_proteus_storage": true,
"analytics_enabled": true,
"picture_in_picture_enabled": true,
"analytics_app_key": "8ffae535f1836ed5f58fd5c8a11c00eca07c5438",
Expand Down Expand Up @@ -107,7 +102,6 @@
"force_constant_bitrate_calls": false,
"ignore_ssl_certificates": false,
"lower_keypackage_limit": false,
"encrypt_proteus_storage": false,
"self_deleting_messages": true,
"wipe_on_cookie_invalid": false,
"wipe_on_device_removal": false,
Expand Down

0 comments on commit 0ddec09

Please sign in to comment.