diff --git a/app/build.gradle.kts b/app/build.gradle.kts index f59704cf9d..31a7a101b9 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -81,24 +81,26 @@ android { val appId: String? = System.getenv(datadogAppIdKey) ?: project.getLocalProperty(datadogAppIdKey, null) buildConfigField("String", datadogAppIdKey, appId?.let { "\"$it\"" } ?: "null") - // DOMAIN_REMOVAL_KEYS_FOR_REPAIR json format {"domain": "some hex string key"} + // DOMAIN_REMOVAL_KEYS_FOR_REPAIR json format {"domain": ["some hex string key"]} val domainRemovalKeysForRepair = "DOMAIN_REMOVAL_KEYS_FOR_REPAIR" - val domainKeysJson: String? = - System.getenv(domainRemovalKeysForRepair) ?: project.getLocalProperty(domainRemovalKeysForRepair, null) + val domainKeysJson: String? = System.getenv(domainRemovalKeysForRepair) ?: project.getLocalProperty(domainRemovalKeysForRepair, null) val domainKeysHashMap = if (domainKeysJson != null) { try { - val jsonMap = groovy.json.JsonSlurper().parseText(domainKeysJson) as Map - val javaMapEntries = jsonMap.entries.joinToString("") { "put(\"${it.key}\", \"${it.value}\");" } - "new java.util.HashMap(){{$javaMapEntries}}" + val jsonMap = groovy.json.JsonSlurper().parseText(domainKeysJson) as Map> + val javaMapEntries = jsonMap.entries.joinToString("; ") { (domain, keys) -> + val keysList = keys.joinToString("\", \"", "\"", "\"") + "put(\"$domain\", java.util.Arrays.asList($keysList))" + } + "new java.util.HashMap>(){{$javaMapEntries;}}" } catch (e: Exception) { println("Error parsing domain removal keys: ${e.message}") - "new java.util.HashMap()" + "new java.util.HashMap>()" } } else { - "new java.util.HashMap()" + "new java.util.HashMap>()" } buildConfigField( - "java.util.Map", + "java.util.Map>", domainRemovalKeysForRepair, domainKeysHashMap ) diff --git a/app/src/main/kotlin/com/wire/android/di/KaliumConfigsModule.kt b/app/src/main/kotlin/com/wire/android/di/KaliumConfigsModule.kt index 09153f9d86..9136b6e68e 100644 --- a/app/src/main/kotlin/com/wire/android/di/KaliumConfigsModule.kt +++ b/app/src/main/kotlin/com/wire/android/di/KaliumConfigsModule.kt @@ -62,6 +62,7 @@ class KaliumConfigsModule { maxRemoteSearchResultCount = BuildConfig.MAX_REMOTE_SEARCH_RESULT_COUNT, limitTeamMembersFetchDuringSlowSync = BuildConfig.LIMIT_TEAM_MEMBERS_FETCH_DURING_SLOW_SYNC, isMlsResetEnabled = BuildConfig.IS_MLS_RESET_ENABLED, + domainWithFaultyKeysMap = BuildConfig.DOMAIN_REMOVAL_KEYS_FOR_REPAIR ) } } diff --git a/app/src/main/kotlin/com/wire/android/ui/debug/DebugDataOptionsViewModel.kt b/app/src/main/kotlin/com/wire/android/ui/debug/DebugDataOptionsViewModel.kt index 836a06a0ad..8d2f5da647 100644 --- a/app/src/main/kotlin/com/wire/android/ui/debug/DebugDataOptionsViewModel.kt +++ b/app/src/main/kotlin/com/wire/android/ui/debug/DebugDataOptionsViewModel.kt @@ -253,7 +253,7 @@ class DebugDataOptionsViewModelImpl override fun repairFaultRemovalKeys() { viewModelScope.launch { state = state.copy(mlsInfoState = state.mlsInfoState.copy(isLoadingRepair = true)) - val (domain, faultyKey) = DOMAIN_REMOVAL_KEYS_FOR_REPAIR.entries.firstOrNull() + val (domain, faultyKey) = DOMAIN_REMOVAL_KEYS_FOR_REPAIR.entries.firstOrNull { it.key == currentAccount.domain } ?: run { appLogger.w("No faulty removal keys configured for repair") _infoMessage.emit(UIText.DynamicString("No faulty removal keys configured for repair")) @@ -264,7 +264,7 @@ class DebugDataOptionsViewModelImpl val result = repairFaultyRemovalKeys( param = TargetedRepairParam( domain = domain, - faultyKey = faultyKey + faultyKeys = faultyKey ) ) when (result) { @@ -272,8 +272,8 @@ class DebugDataOptionsViewModelImpl RepairResult.NoConversationsToRepair -> appLogger.i("No conversations to repair") RepairResult.RepairNotNeeded -> appLogger.i("Repair not needed") is RepairResult.RepairPerformed -> { - _infoMessage.emit(UIText.DynamicString("Repair finalized")) - appLogger.i("Repair performed: $result") + _infoMessage.emit(UIText.DynamicString("Reset finalized")) + appLogger.i("Repair performed: ${result.toLogString()}") } } state = state.copy(mlsInfoState = state.mlsInfoState.copy(isLoadingRepair = false)) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 7899a9f530..5cc864a61e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1354,7 +1354,7 @@ In group conversations, the group admin can overwrite this setting. Proteus ID Key-packages count MLS Client ID - Repair faulty removal keys + Initiate reset of affected MLS groups Connect with others or create a new group to start collaborating! Select your favorite conversations, and you’ll find them here You are not part of any group conversation yet.\nStart a new conversation! @@ -1795,7 +1795,7 @@ In group conversations, the group admin can overwrite this setting. Force API versioning update ⚠️ Break Session Update - Repair + Reset Feature Flags diff --git a/kalium b/kalium index 2d069db408..4ceb3da5e0 160000 --- a/kalium +++ b/kalium @@ -1 +1 @@ -Subproject commit 2d069db408fc5ec78a29f3c0506847c7d1ce94b4 +Subproject commit 4ceb3da5e0ade289ebae274b441077f7521465db