Skip to content

Commit

Permalink
Merge branch 'develop' into feat/last-message-markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
Garzas committed Apr 15, 2024
2 parents a2604ab + e4c4b46 commit 8baca22
Show file tree
Hide file tree
Showing 42 changed files with 1,164 additions and 239 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codestyle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
distribution: 'temurin'
cache: gradle
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@699bb18358f12c5b78b37bb0111d3a0e2276e0e2
uses: gradle/wrapper-validation-action@b231772637bb498f11fdbc86052b6e8a8dc9fc92
- name: Run Detekt
run: |
./gradlew detektAll
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gradle-run-ui-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
cache: gradle

- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@699bb18358f12c5b78b37bb0111d3a0e2276e0e2
uses: gradle/wrapper-validation-action@b231772637bb498f11fdbc86052b6e8a8dc9fc92

- name: AVD cache
uses: buildjet/cache@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gradle-run-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
cache: gradle

- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@699bb18358f12c5b78b37bb0111d3a0e2276e0e2
uses: gradle/wrapper-validation-action@b231772637bb498f11fdbc86052b6e8a8dc9fc92

- name: Test Build Logic
run: |
Expand Down
2 changes: 1 addition & 1 deletion AR-builder.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pipeline {
string(name: 'SOURCE_BRANCH', description: 'Branch or PR name to')
string(name: 'CHANGE_BRANCH', description: 'Change branch name to build only used to checkout the correct branch if you need the branch name use SOURCE_BRANCH')
choice(name: 'BUILD_TYPE', choices: ['Compatrelease', 'Debug', 'Release', 'Compat'], description: 'Build Type for the Client')
choice(name: 'FLAVOR', choices: ['Prod', 'Dev', 'Staging', 'Internal', 'Beta'], description: 'Product Flavor to build')
choice(name: 'FLAVOR', choices: ['Prod', 'Fdroid', 'Dev', 'Staging', 'Internal', 'Beta'], description: 'Product Flavor to build')
booleanParam(name: 'UPLOAD_TO_S3', defaultValue: false, description: 'Boolean Flag to define if the build should be uploaded to S3')
booleanParam(name: 'UPLOAD_TO_PLAYSTORE_ENABLED', defaultValue: false, description: 'Boolean Flag to define if the build should be uploaded to Playstore')
booleanParam(name: 'RUN_UNIT_TEST', defaultValue: true, description: 'Boolean Flag to define if the unit tests should be run')
Expand Down
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ List<String> defineFlavor() {
} else if (branchName == "develop") {
return ['Staging', 'Dev']
} else if (branchName == "prod") {
return ['Prod']
return ['Prod', 'Fdroid']
} else if (branchName == "internal") {
return ['Internal']
}
Expand Down
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
60 changes: 54 additions & 6 deletions app/src/main/kotlin/com/wire/android/ui/debug/DebugDataOptions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,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 @@ -103,7 +104,8 @@ class DebugDataOptionsViewModel
private val updateApiVersions: UpdateApiVersionsScheduler,
private val mlsKeyPackageCountUseCase: MLSKeyPackageCountUseCase,
private val restartSlowSyncProcessForRecovery: RestartSlowSyncProcessForRecoveryUseCase,
private val disableEventProcessingUseCase: DisableEventProcessingUseCase
private val disableEventProcessingUseCase: DisableEventProcessingUseCase,
private val checkCrlRevocationListUseCase: CheckCrlRevocationListUseCase
) : ViewModel() {

var state by mutableStateOf(
Expand Down Expand Up @@ -138,6 +140,14 @@ class DebugDataOptionsViewModel
}
}

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

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

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

Expand Down Expand Up @@ -327,6 +339,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 @@ -377,7 +399,8 @@ fun DebugDataOptionsContent(
onDisableEventProcessingChange = onDisableEventProcessingChange,
onRestartSlowSyncForRecovery = onRestartSlowSyncForRecovery,
onForceUpdateApiVersions = onForceUpdateApiVersions,
dependenciesMap = state.dependencies
dependenciesMap = state.dependencies,
checkCrlRevocationList = checkCrlRevocationList
)
}

Expand Down Expand Up @@ -546,7 +569,8 @@ private fun DebugToolsOptions(
onDisableEventProcessingChange: (Boolean) -> Unit,
onRestartSlowSyncForRecovery: () -> Unit,
onForceUpdateApiVersions: () -> Unit,
dependenciesMap: ImmutableMap<String, String?>
dependenciesMap: ImmutableMap<String, String?>,
checkCrlRevocationList: () -> Unit
) {
FolderHeader(stringResource(R.string.label_debug_tools_title))
Column {
Expand Down Expand Up @@ -574,6 +598,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 @@ -670,6 +717,7 @@ fun PreviewOtherDebugOptions() {
onManualMigrationPressed = {},
enrollE2EICertificate = {},
handleE2EIEnrollmentResult = {},
dismissCertificateDialog = {}
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
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ import com.wire.android.ui.common.topappbar.WireCenterAlignedTopAppBar
import com.wire.android.ui.common.visbility.rememberVisibilityState
import com.wire.android.ui.destinations.E2eiCertificateDetailsScreenDestination
import com.wire.android.ui.destinations.InitialSyncScreenDestination
import com.wire.android.ui.home.E2EIErrorNoSnoozeDialog
import com.wire.android.ui.home.E2EIEnrollmentErrorWithDismissDialog
import com.wire.android.ui.home.E2EISuccessDialog
import com.wire.android.ui.markdown.MarkdownConstants
import com.wire.android.ui.theme.WireTheme
Expand Down Expand Up @@ -190,12 +190,10 @@ private fun E2EIEnrollmentScreenContent(
}

if (state.isCertificateEnrollError) {
E2EIErrorNoSnoozeDialog(
E2EIEnrollmentErrorWithDismissDialog(
isE2EILoading = state.isLoading,
updateCertificate = {
dismissErrorDialog()
enrollE2EICertificate()
}
onClick = enrollE2EICertificate,
onDismiss = dismissErrorDialog
)
}

Expand Down
38 changes: 35 additions & 3 deletions app/src/main/kotlin/com/wire/android/ui/home/E2EIDialogs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,46 @@ fun E2EISuccessDialog(
}

@Composable
fun E2EIErrorWithDismissDialog(
fun E2EIUpdateErrorWithDismissDialog(
isE2EILoading: Boolean,
updateCertificate: () -> Unit,
onDismiss: () -> Unit
) {
WireDialog(
E2EIErrorWithDismissDialog(
title = stringResource(id = R.string.end_to_end_identity_renew_error_dialog_title),
text = stringResource(id = R.string.end_to_end_identity_renew_error_dialog_text),
isE2EILoading = isE2EILoading,
updateCertificate = updateCertificate,
onDismiss = onDismiss
)
}

@Composable
fun E2EIEnrollmentErrorWithDismissDialog(
isE2EILoading: Boolean,
onClick: () -> Unit,
onDismiss: () -> Unit
) {
E2EIErrorWithDismissDialog(
title = stringResource(id = R.string.end_to_end_identity_enrollment_error_dialog_title),
text = stringResource(id = R.string.end_to_end_identity_enrollment_error_dialog_text),
isE2EILoading = isE2EILoading,
updateCertificate = onClick,
onDismiss = onDismiss
)
}

@Composable
private fun E2EIErrorWithDismissDialog(
title: String,
text: String,
isE2EILoading: Boolean,
updateCertificate: () -> Unit,
onDismiss: () -> Unit
) {
WireDialog(
title = title,
text = text,
onDismiss = onDismiss,
optionButton1Properties = WireDialogButtonProperties(
onClick = updateCertificate,
Expand Down Expand Up @@ -247,7 +279,7 @@ private fun E2EIErrorWithSnoozeDialog(
}

@Composable
fun E2EIErrorNoSnoozeDialog(
private fun E2EIErrorNoSnoozeDialog(
isE2EILoading: Boolean,
updateCertificate: () -> Unit
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import com.wire.kalium.util.DateTimeUtil
object AuthorHeaderHelper {

@VisibleForTesting
internal const val AGGREGATION_TIME_WINDOW: Int = 30_000 // millis
internal const val AGGREGATION_TIME_WINDOW: Int = 30_000 // in millis

private fun LazyPagingItems<UIMessage>.peekOrNull(index: Int) =
if (index in 0 until this.itemCount) this.peek(index) else null
Expand Down
Loading

0 comments on commit 8baca22

Please sign in to comment.