Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
daedric7 committed Jan 15, 2025
2 parents da3bd13 + 0d63610 commit 05c4c97
Show file tree
Hide file tree
Showing 43 changed files with 467 additions and 292 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ fun SetupBiometricView(
state: SetupBiometricState,
modifier: Modifier = Modifier,
) {
BackHandler(true) {
BackHandler {
state.eventSink(SetupBiometricEvents.UsePin)
}
HeaderFooterPage(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,8 @@ fun QrCodeConfirmationView(
onCancel: () -> Unit,
modifier: Modifier = Modifier,
) {
BackHandler {
onCancel()
}
BackHandler(onBack = onCancel)

val icon = when (step) {
is QrCodeConfirmationStep.DisplayCheckCode -> CompoundIcons.Computer()
is QrCodeConfirmationStep.DisplayVerificationCode -> CompoundIcons.LockSolid()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,14 @@ fun QrCodeErrorView(
onRetry: () -> Unit,
modifier: Modifier = Modifier,
) {
BackHandler {
onRetry()
}
BackHandler(onBack = onRetry)
FlowStepPage(
modifier = modifier,
iconStyle = BigIcon.Style.AlertSolid,
title = titleText(errorScreenType, appName),
subTitle = subtitleText(errorScreenType, appName),
content = { Content(errorScreenType) },
buttons = { Buttons(onRetry) }
buttons = { Buttons(onRetry) },
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

package io.element.android.features.preferences.impl.notifications

import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.progressSemantics
import androidx.compose.runtime.Composable
Expand All @@ -20,7 +21,8 @@ import io.element.android.compound.tokens.generated.CompoundIcons
import io.element.android.features.preferences.impl.R
import io.element.android.libraries.androidutils.system.startNotificationSettingsIntent
import io.element.android.libraries.architecture.AsyncData
import io.element.android.libraries.designsystem.atomic.molecules.DialogLikeBannerMolecule
import io.element.android.libraries.designsystem.components.Announcement
import io.element.android.libraries.designsystem.components.AnnouncementType
import io.element.android.libraries.designsystem.components.async.AsyncActionView
import io.element.android.libraries.designsystem.components.dialogs.ErrorDialog
import io.element.android.libraries.designsystem.components.dialogs.ListOption
Expand Down Expand Up @@ -132,7 +134,7 @@ private fun NotificationSettingsContentView(
PreferenceText(
icon = CompoundIcons.VoiceCall(),
title = stringResource(id = R.string.full_screen_intent_banner_title),
subtitle = stringResource(R.string.full_screen_intent_banner_message,),
subtitle = stringResource(R.string.full_screen_intent_banner_message),
onClick = {
state.fullScreenIntentPermissionsState.openFullScreenIntentSettings()
}
Expand Down Expand Up @@ -247,12 +249,17 @@ private fun InvalidNotificationSettingsView(
showError: Boolean,
onContinueClick: () -> Unit,
onDismissError: () -> Unit,
modifier: Modifier = Modifier,
) {
DialogLikeBannerMolecule(
Announcement(
title = stringResource(R.string.screen_notification_settings_configuration_mismatch),
content = stringResource(R.string.screen_notification_settings_configuration_mismatch_description),
onSubmitClick = onContinueClick,
onDismissClick = null,
description = stringResource(R.string.screen_notification_settings_configuration_mismatch_description),
type = AnnouncementType.Actionable(
onActionClick = onContinueClick,
actionText = stringResource(CommonStrings.action_continue),
onDismissClick = null,
),
modifier = modifier.padding(horizontal = 16.dp, vertical = 8.dp),
)

if (showError) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* Copyright 2025 New Vector Ltd.
*
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
* Please see LICENSE files in the repository root for full details.
*/

package io.element.android.features.roomlist.impl.components

import androidx.compose.foundation.layout.padding
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp

/**
* Common padding for RoomList banners.
*/
internal fun Modifier.roomListBannerPadding() = padding(horizontal = 16.dp, vertical = 8.dp)
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,27 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import io.element.android.features.roomlist.impl.R
import io.element.android.libraries.designsystem.atomic.molecules.DialogLikeBannerMolecule
import io.element.android.libraries.designsystem.components.Announcement
import io.element.android.libraries.designsystem.components.AnnouncementType
import io.element.android.libraries.designsystem.preview.ElementPreview
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
import io.element.android.libraries.ui.strings.CommonStrings

@Composable
internal fun ConfirmRecoveryKeyBanner(
onContinueClick: () -> Unit,
onDismissClick: () -> Unit,
modifier: Modifier = Modifier,
) {
DialogLikeBannerMolecule(
modifier = modifier,
Announcement(
modifier = modifier.roomListBannerPadding(),
title = stringResource(R.string.confirm_recovery_key_banner_title),
content = stringResource(R.string.confirm_recovery_key_banner_message),
onSubmitClick = onContinueClick,
onDismissClick = onDismissClick,
description = stringResource(R.string.confirm_recovery_key_banner_message),
type = AnnouncementType.Actionable(
actionText = stringResource(CommonStrings.action_continue),
onActionClick = onContinueClick,
onDismissClick = onDismissClick,
),
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,31 @@
package io.element.android.features.roomlist.impl.components

import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import io.element.android.features.roomlist.impl.R
import io.element.android.libraries.designsystem.atomic.molecules.DialogLikeBannerMolecule
import io.element.android.libraries.designsystem.components.Announcement
import io.element.android.libraries.designsystem.components.AnnouncementType
import io.element.android.libraries.designsystem.preview.ElementPreview
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
import io.element.android.libraries.fullscreenintent.api.FullScreenIntentPermissionsState
import io.element.android.libraries.fullscreenintent.api.aFullScreenIntentPermissionsState
import io.element.android.libraries.ui.strings.CommonStrings

@Composable
fun FullScreenIntentPermissionBanner(state: FullScreenIntentPermissionsState) {
DialogLikeBannerMolecule(
fun FullScreenIntentPermissionBanner(
state: FullScreenIntentPermissionsState,
modifier: Modifier = Modifier
) {
Announcement(
title = stringResource(R.string.full_screen_intent_banner_title),
content = stringResource(R.string.full_screen_intent_banner_message),
onDismissClick = state.dismissFullScreenIntentBanner,
onSubmitClick = state.openFullScreenIntentSettings,
description = stringResource(R.string.full_screen_intent_banner_message),
type = AnnouncementType.Actionable(
actionText = stringResource(CommonStrings.action_continue),
onDismissClick = state.dismissFullScreenIntentBanner,
onActionClick = state.openFullScreenIntentSettings,
),
modifier = modifier.roomListBannerPadding(),
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import io.element.android.features.roomlist.impl.R
import io.element.android.libraries.designsystem.atomic.molecules.DialogLikeBannerMolecule
import io.element.android.libraries.designsystem.components.Announcement
import io.element.android.libraries.designsystem.components.AnnouncementType
import io.element.android.libraries.designsystem.preview.ElementPreview
import io.element.android.libraries.designsystem.preview.PreviewsDayNight

Expand All @@ -21,13 +22,15 @@ internal fun NativeSlidingSyncMigrationBanner(
onDismissClick: () -> Unit,
modifier: Modifier = Modifier,
) {
DialogLikeBannerMolecule(
modifier = modifier,
Announcement(
modifier = modifier.roomListBannerPadding(),
title = stringResource(R.string.banner_migrate_to_native_sliding_sync_title),
content = stringResource(R.string.banner_migrate_to_native_sliding_sync_description),
actionText = stringResource(R.string.banner_migrate_to_native_sliding_sync_action),
onSubmitClick = onContinueClick,
onDismissClick = onDismissClick,
description = stringResource(R.string.banner_migrate_to_native_sliding_sync_description),
type = AnnouncementType.Actionable(
actionText = stringResource(R.string.banner_migrate_to_native_sliding_sync_action),
onActionClick = onContinueClick,
onDismissClick = onDismissClick,
)
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,13 @@ private fun EmptyView(
SecurityBannerState.SetUpRecovery -> {
SetUpRecoveryKeyBanner(
onContinueClick = onSetUpRecoveryClick,
onDismissClick = { eventSink(RoomListEvents.DismissBanner) }
onDismissClick = { eventSink(RoomListEvents.DismissBanner) },
)
}
SecurityBannerState.RecoveryKeyConfirmation -> {
ConfirmRecoveryKeyBanner(
onContinueClick = onConfirmRecoveryKeyClick,
onDismissClick = { eventSink(RoomListEvents.DismissBanner) }
onDismissClick = { eventSink(RoomListEvents.DismissBanner) },
)
}
else -> Unit
Expand Down Expand Up @@ -217,23 +217,23 @@ private fun RoomsViewList(
item {
SetUpRecoveryKeyBanner(
onContinueClick = onSetUpRecoveryClick,
onDismissClick = { updatedEventSink(RoomListEvents.DismissBanner) }
onDismissClick = { updatedEventSink(RoomListEvents.DismissBanner) },
)
}
}
SecurityBannerState.RecoveryKeyConfirmation -> {
item {
ConfirmRecoveryKeyBanner(
onContinueClick = onConfirmRecoveryKeyClick,
onDismissClick = { updatedEventSink(RoomListEvents.DismissBanner) }
onDismissClick = { updatedEventSink(RoomListEvents.DismissBanner) },
)
}
}
SecurityBannerState.NeedsNativeSlidingSyncMigration -> {
item {
NativeSlidingSyncMigrationBanner(
onContinueClick = onMigrateToNativeSlidingSyncClick,
onDismissClick = { updatedEventSink(RoomListEvents.DismissBanner) }
onDismissClick = { updatedEventSink(RoomListEvents.DismissBanner) },
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import io.element.android.features.roomlist.impl.R
import io.element.android.libraries.designsystem.atomic.molecules.DialogLikeBannerMolecule
import io.element.android.libraries.designsystem.components.Announcement
import io.element.android.libraries.designsystem.components.AnnouncementType
import io.element.android.libraries.designsystem.preview.ElementPreview
import io.element.android.libraries.designsystem.preview.PreviewsDayNight

Expand All @@ -21,13 +22,15 @@ internal fun SetUpRecoveryKeyBanner(
onDismissClick: () -> Unit,
modifier: Modifier = Modifier,
) {
DialogLikeBannerMolecule(
modifier = modifier,
Announcement(
modifier = modifier.roomListBannerPadding(),
title = stringResource(R.string.banner_set_up_recovery_title),
content = stringResource(R.string.banner_set_up_recovery_content),
actionText = stringResource(R.string.banner_set_up_recovery_submit),
onSubmitClick = onContinueClick,
onDismissClick = onDismissClick,
description = stringResource(R.string.banner_set_up_recovery_content),
type = AnnouncementType.Actionable(
actionText = stringResource(R.string.banner_set_up_recovery_submit),
onActionClick = onContinueClick,
onDismissClick = onDismissClick,
),
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

package io.element.android.features.userprofile.shared

import androidx.activity.compose.BackHandler
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.consumeWindowInsets
Expand Down Expand Up @@ -51,7 +50,6 @@ fun UserProfileView(
openAvatarPreview: (username: String, url: String) -> Unit,
modifier: Modifier = Modifier,
) {
BackHandler { goBack() }
Scaffold(
modifier = modifier,
topBar = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import io.element.android.tests.testutils.ensureCalledOnce
import io.element.android.tests.testutils.ensureCalledOnceWithParam
import io.element.android.tests.testutils.ensureCalledOnceWithTwoParams
import io.element.android.tests.testutils.pressBack
import io.element.android.tests.testutils.pressBackKey
import kotlinx.coroutines.test.runTest
import org.junit.Rule
import org.junit.Test
Expand All @@ -46,16 +45,6 @@ import org.robolectric.annotation.Config
class UserProfileViewTest {
@get:Rule val rule = createAndroidComposeRule<ComponentActivity>()

@Test
fun `on back key press - the expected callback is called`() = runTest {
ensureCalledOnce { callback ->
rule.setUserProfileView(
goBack = callback,
)
rule.pressBackKey()
}
}

@Test
fun `on back button click - the expected callback is called`() = runTest {
ensureCalledOnce { callback ->
Expand Down
10 changes: 5 additions & 5 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ test_core = "1.6.1"

# Jetbrain
datetime = "0.6.1"
serialization_json = "1.7.3"
serialization_json = "1.8.0"

#other
coil = "2.7.0"
showkase = "1.0.3"
appyx = "1.6.0"
sqldelight = "2.0.2"
wysiwyg = "2.37.14"
wysiwyg = "2.38.0"
telephoto = "0.14.0"

# Dependency analysis
Expand All @@ -61,7 +61,7 @@ autoservice = "1.1.1"

# quality
androidx-test-ext-junit = "1.2.1"
kover = "0.9.0"
kover = "0.9.1"

[libraries]
# Project
Expand Down Expand Up @@ -195,7 +195,7 @@ zxing_cpp = "io.github.zxing-cpp:android:2.2.0"

# Analytics
posthog = "com.posthog:posthog-android:3.10.0"
sentry = "io.sentry:sentry-android:7.19.1"
sentry = "io.sentry:sentry-android:7.20.0"
# main branch can be tested replacing the version with main-SNAPSHOT
matrix_analytics_events = "com.github.matrix-org:matrix-analytics-events:0.28.0"

Expand Down Expand Up @@ -235,7 +235,7 @@ anvil = { id = "dev.zacsweers.anvil", version.ref = "anvil" }
detekt = "io.gitlab.arturbosch.detekt:1.23.7"
ktlint = "org.jlleitschuh.gradle.ktlint:12.1.2"
dependencygraph = "com.savvasdalkitsis.module-dependency-graph:0.12"
dependencycheck = "org.owasp.dependencycheck:11.1.1"
dependencycheck = "org.owasp.dependencycheck:12.0.0"
dependencyanalysis = { id = "com.autonomousapps.dependency-analysis", version.ref = "dependencyAnalysis" }
paparazzi = "app.cash.paparazzi:1.3.5"
sqldelight = { id = "app.cash.sqldelight", version.ref = "sqldelight" }
Expand Down
Loading

0 comments on commit 05c4c97

Please sign in to comment.