Prompt users to backup during quick restore.

This commit is contained in:
Greyson Parrelli
2026-01-14 10:51:29 -05:00
committed by Alex Hart
parent 4921198cd8
commit 9012a2afc0
26 changed files with 1049 additions and 245 deletions

View File

@@ -28,6 +28,8 @@ dependencies {
api(libs.androidx.compose.material3.adaptive)
api(libs.androidx.compose.material3.adaptive.layout)
api(libs.androidx.compose.material3.adaptive.navigation)
implementation(libs.androidx.navigation3.ui)
implementation(libs.androidx.navigation3.runtime)
api(libs.androidx.compose.ui.tooling.preview)
api(libs.androidx.activity.compose)
debugApi(libs.androidx.compose.ui.tooling.core)

View File

@@ -5,6 +5,7 @@
package org.signal.core.ui.compose
import androidx.annotation.DrawableRes
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.RowScope
@@ -32,6 +33,49 @@ import org.signal.core.ui.compose.theme.SignalTheme
@OptIn(ExperimentalMaterial3Api::class)
object Scaffolds {
/**
* Simple scaffold with a TopAppBar containing a navigation icon and optional title.
*
* @param onNavigationClick Callback when navigation icon is clicked.
* @param navigationIconRes Drawable resource for the navigation icon.
* @param navigationContentDescription Content description for the navigation icon.
* @param title Optional title text for the app bar.
* @param modifier Modifier for the scaffold.
* @param content Content to display in the scaffold.
*/
@Composable
fun Default(
onNavigationClick: () -> Unit,
@DrawableRes navigationIconRes: Int,
navigationContentDescription: String? = null,
title: String? = null,
modifier: Modifier = Modifier,
content: @Composable (PaddingValues) -> Unit
) {
Scaffold(
modifier = modifier,
topBar = {
TopAppBar(
title = {
if (title != null) {
Text(text = title)
}
},
navigationIcon = {
IconButton(onClick = onNavigationClick) {
Icon(
painter = painterResource(navigationIconRes),
tint = MaterialTheme.colorScheme.onSurface,
contentDescription = navigationContentDescription
)
}
}
)
},
content = content
)
}
/**
* Settings scaffold that takes an icon as an ImageVector.
*

View File

@@ -0,0 +1,74 @@
/*
* Copyright 2026 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/
package org.signal.core.ui.navigation
import androidx.compose.animation.AnimatedContentTransitionScope
import androidx.compose.animation.ContentTransform
import androidx.compose.animation.core.tween
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.animation.slideInHorizontally
import androidx.compose.animation.slideOutHorizontally
import androidx.compose.animation.togetherWith
import androidx.navigation3.runtime.NavKey
import androidx.navigation3.scene.Scene
import androidx.navigationevent.NavigationEvent
/**
* A collection of [TransitionSpecs] for setting up nav3 navigation.
*/
object TransitionSpecs {
/**
* Screens slide in from the right and slide out from the left.
*/
object HorizontalSlide {
val transitionSpec: AnimatedContentTransitionScope<Scene<NavKey>>.() -> ContentTransform = {
(
slideInHorizontally(
initialOffsetX = { it },
animationSpec = tween(200)
) + fadeIn(animationSpec = tween(200))
) togetherWith
(
slideOutHorizontally(
targetOffsetX = { -it },
animationSpec = tween(200)
) + fadeOut(animationSpec = tween(200))
)
}
val popTransitionSpec: AnimatedContentTransitionScope<Scene<NavKey>>.() -> ContentTransform = {
(
slideInHorizontally(
initialOffsetX = { -it },
animationSpec = tween(200)
) + fadeIn(animationSpec = tween(200))
) togetherWith
(
slideOutHorizontally(
targetOffsetX = { it },
animationSpec = tween(200)
) + fadeOut(animationSpec = tween(200))
)
}
val predictivePopTransitonSpec: AnimatedContentTransitionScope<Scene<NavKey>>.(@NavigationEvent.SwipeEdge Int) -> ContentTransform = {
(
slideInHorizontally(
initialOffsetX = { -it },
animationSpec = tween(200)
) + fadeIn(animationSpec = tween(200))
) togetherWith
(
slideOutHorizontally(
targetOffsetX = { it },
animationSpec = tween(200)
) + fadeOut(animationSpec = tween(200))
)
}
}
}