Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add a crl revocation list to debug screen #2793

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/src/main/kotlin/com/wire/android/di/CoreLogicModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,11 @@ class UseCaseModule {
@CurrentAccount currentAccount: UserId
) = coreLogic.getSessionScope(currentAccount).getPersistentWebSocketStatus

@ViewModelScoped
@Provides
fun provideCheckCrlRevocationListUseCase(@KaliumCoreLogic coreLogic: CoreLogic, @CurrentAccount currentAccount: UserId) =
coreLogic.getSessionScope(currentAccount).checkCrlRevocationList

@ViewModelScoped
@Provides
fun provideIsMLSEnabledUseCase(@KaliumCoreLogic coreLogic: CoreLogic, @CurrentAccount currentAccount: UserId) =
Expand Down
56 changes: 52 additions & 4 deletions app/src/main/kotlin/com/wire/android/ui/debug/DebugDataOptions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ import com.wire.kalium.logic.CoreFailure
import com.wire.kalium.logic.E2EIFailure
import com.wire.kalium.logic.data.user.UserId
import com.wire.kalium.logic.feature.debug.DisableEventProcessingUseCase
import com.wire.kalium.logic.feature.e2ei.CheckCrlRevocationListUseCase
import com.wire.kalium.logic.feature.e2ei.usecase.E2EIEnrollmentResult
import com.wire.kalium.logic.feature.keypackage.MLSKeyPackageCountResult
import com.wire.kalium.logic.feature.keypackage.MLSKeyPackageCountUseCase
Expand Down Expand Up @@ -98,6 +99,7 @@ class DebugDataOptionsViewModel
private val mlsKeyPackageCountUseCase: MLSKeyPackageCountUseCase,
private val restartSlowSyncProcessForRecovery: RestartSlowSyncProcessForRecoveryUseCase,
private val disableEventProcessingUseCase: DisableEventProcessingUseCase,
private val checkCrlRevocationListUseCase: CheckCrlRevocationListUseCase
) : ViewModel() {

var state by mutableStateOf(
Expand All @@ -114,6 +116,14 @@ class DebugDataOptionsViewModel
)
}

fun checkCrlRevocationList() {
viewModelScope.launch {
checkCrlRevocationListUseCase(
forceUpdate = true
)
}
}

fun enableEncryptedProteusStorage(enabled: Boolean) {
if (enabled) {
viewModelScope.launch {
Expand Down Expand Up @@ -248,7 +258,8 @@ fun DebugDataOptions(
onDisableEventProcessingChange = viewModel::disableEventProcessing,
enrollE2EICertificate = viewModel::enrollE2EICertificate,
handleE2EIEnrollmentResult = viewModel::handleE2EIEnrollmentResult,
dismissCertificateDialog = viewModel::dismissCertificateDialog
dismissCertificateDialog = viewModel::dismissCertificateDialog,
checkCrlRevocationList = viewModel::checkCrlRevocationList
)
}

Expand All @@ -266,7 +277,8 @@ fun DebugDataOptionsContent(
onManualMigrationPressed: () -> Unit,
enrollE2EICertificate: () -> Unit,
handleE2EIEnrollmentResult: (Either<CoreFailure, E2EIEnrollmentResult>) -> Unit,
dismissCertificateDialog: () -> Unit
dismissCertificateDialog: () -> Unit,
checkCrlRevocationList: () -> Unit
) {
Column {

Expand Down Expand Up @@ -303,6 +315,16 @@ fun DebugDataOptionsContent(
)
if (BuildConfig.PRIVATE_BUILD) {

SettingsItem(
title = stringResource(R.string.debug_id),
text = state.debugId,
trailingIcon = R.drawable.ic_copy,
onIconPressed = Clickable(
enabled = true,
onClick = { }
)
)

SettingsItem(
title = stringResource(R.string.debug_id),
text = state.debugId,
Expand Down Expand Up @@ -352,7 +374,8 @@ fun DebugDataOptionsContent(
isEventProcessingEnabled = state.isEventProcessingDisabled,
onDisableEventProcessingChange = onDisableEventProcessingChange,
onRestartSlowSyncForRecovery = onRestartSlowSyncForRecovery,
onForceUpdateApiVersions = onForceUpdateApiVersions
onForceUpdateApiVersions = onForceUpdateApiVersions,
checkCrlRevocationList = checkCrlRevocationList
)
}

Expand Down Expand Up @@ -520,7 +543,8 @@ private fun DebugToolsOptions(
isEventProcessingEnabled: Boolean,
onDisableEventProcessingChange: (Boolean) -> Unit,
onRestartSlowSyncForRecovery: () -> Unit,
onForceUpdateApiVersions: () -> Unit
onForceUpdateApiVersions: () -> Unit,
checkCrlRevocationList: () -> Unit
) {
FolderHeader(stringResource(R.string.label_debug_tools_title))
Column {
Expand Down Expand Up @@ -548,6 +572,29 @@ private fun DebugToolsOptions(
)
}
)

// checkCrlRevocationList
RowItemTemplate(
modifier = Modifier.wrapContentWidth(),
title = {
Text(
style = MaterialTheme.wireTypography.body01,
color = MaterialTheme.wireColorScheme.onBackground,
text = "CRL revocation check",
modifier = Modifier.padding(start = dimensions().spacing8x)
)
},
actions = {
WirePrimaryButton(
minSize = MaterialTheme.wireDimensions.buttonMediumMinSize,
minClickableSize = MaterialTheme.wireDimensions.buttonMinClickableSize,
onClick = checkCrlRevocationList,
text = stringResource(R.string.debug_settings_force_api_versioning_update_button_text),
fillMaxWidth = false
)
}
)

RowItemTemplate(
modifier = Modifier.wrapContentWidth(),
title = {
Expand Down Expand Up @@ -625,5 +672,6 @@ fun PreviewOtherDebugOptions() {
enrollE2EICertificate = {},
handleE2EIEnrollmentResult = {},
dismissCertificateDialog = {},
checkCrlRevocationList = {}
)
}
4 changes: 2 additions & 2 deletions app/src/main/kotlin/com/wire/android/ui/debug/DebugScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ fun DebugScreen(navigator: Navigator) {
private fun UserDebugContent(
onNavigationPressed: () -> Unit,
onManualMigrationPressed: (currentAccount: UserId) -> Unit,
) {
userDebugViewModel: UserDebugViewModel = hiltViewModel(),

val userDebugViewModel: UserDebugViewModel = hiltViewModel()
) {
val debugContentState: DebugContentState = rememberDebugContentState(userDebugViewModel.logPath)

WireScaffold(
Expand Down