-
Notifications
You must be signed in to change notification settings - Fork 8
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
[ABW-4084] Add security shield details screen #1342
Changes from 8 commits
3623216
1eae0d2
5c1d17b
5f11463
97b6b14
d0e4764
d066e36
075fc98
95578f7
f18d98b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
package com.babylon.wallet.android.presentation.common.securityshields | ||
|
||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.border | ||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.ColumnScope | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.Spacer | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.height | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material3.Icon | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.res.painterResource | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.unit.dp | ||
import com.babylon.wallet.android.R | ||
import com.babylon.wallet.android.designsystem.theme.RadixTheme | ||
import com.babylon.wallet.android.presentation.common.title | ||
import com.babylon.wallet.android.presentation.ui.composables.DSR | ||
import com.radixdlt.sargon.Threshold | ||
import com.radixdlt.sargon.TimePeriod | ||
|
||
@Composable | ||
fun ConfirmationDelay( | ||
modifier: Modifier = Modifier, | ||
delay: TimePeriod | ||
) { | ||
Column( | ||
modifier = modifier | ||
.background( | ||
color = RadixTheme.colors.lightRed, | ||
shape = RadixTheme.shapes.roundedRectMedium | ||
) | ||
.padding(RadixTheme.dimensions.paddingDefault), | ||
verticalArrangement = Arrangement.spacedBy(RadixTheme.dimensions.paddingMedium) | ||
) { | ||
Text( | ||
text = stringResource(R.string.transactionReview_updateShield_confirmationDelayMessage), | ||
style = RadixTheme.typography.body1Regular, | ||
color = RadixTheme.colors.gray1 | ||
) | ||
|
||
Row( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.background( | ||
color = RadixTheme.colors.white, | ||
shape = RadixTheme.shapes.roundedRectSmall | ||
) | ||
.border( | ||
width = 1.dp, | ||
color = RadixTheme.colors.gray4, | ||
shape = RadixTheme.shapes.roundedRectSmall | ||
) | ||
.padding( | ||
horizontal = RadixTheme.dimensions.paddingSemiLarge, | ||
vertical = RadixTheme.dimensions.paddingDefault | ||
), | ||
verticalAlignment = Alignment.CenterVertically, | ||
horizontalArrangement = Arrangement.spacedBy(RadixTheme.dimensions.paddingDefault) | ||
) { | ||
Icon( | ||
painter = painterResource(id = DSR.ic_calendar), | ||
contentDescription = null | ||
) | ||
|
||
Text( | ||
text = delay.title(), | ||
style = RadixTheme.typography.body1Header, | ||
color = RadixTheme.colors.gray1 | ||
) | ||
} | ||
} | ||
} | ||
|
||
@Composable | ||
fun Threshold.display(): String = when (this) { | ||
is Threshold.All -> "ALL" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A reminder to add this to crowdin. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this exists in crowdin, although with a different screen name. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, and it's not all caps: |
||
is Threshold.Specific -> "${v1.toInt()}" | ||
} | ||
|
||
@Suppress("ModifierMissing") | ||
@Composable | ||
fun ColumnScope.OrView() { | ||
Spacer(modifier = Modifier.height(RadixTheme.dimensions.paddingSmall)) | ||
|
||
Text( | ||
modifier = Modifier.align(Alignment.CenterHorizontally), | ||
text = stringResource(R.string.transactionReview_updateShield_combinationLabel), | ||
style = RadixTheme.typography.body2Regular, | ||
color = RadixTheme.colors.gray2 | ||
) | ||
|
||
Spacer(modifier = Modifier.height(RadixTheme.dimensions.paddingSmall)) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package com.babylon.wallet.android.presentation.settings.securitycenter.securityshields.shielddetails | ||
|
||
import androidx.compose.animation.AnimatedContentTransitionScope | ||
import androidx.compose.animation.EnterTransition | ||
import androidx.compose.animation.ExitTransition | ||
import androidx.hilt.navigation.compose.hiltViewModel | ||
import androidx.lifecycle.SavedStateHandle | ||
import androidx.navigation.NavController | ||
import androidx.navigation.NavGraphBuilder | ||
import androidx.navigation.NavType | ||
import androidx.navigation.compose.composable | ||
import androidx.navigation.navArgument | ||
import com.radixdlt.sargon.SecurityStructureId | ||
|
||
private const val ROUTE_SECURITY_SHIELD_DETAILS_SCREEN = "security_shield_details_screen" | ||
private const val ARG_SECURITY_STRUCTURE_ID = "arg_security_structure_id" | ||
private const val ARG_SECURITY_STRUCTURE_NAME = "arg_security_structure_name" | ||
|
||
internal class SecurityShieldDetailsArgs( | ||
val securityStructureId: SecurityStructureId, | ||
val securityStructureName: String | ||
) { | ||
constructor(savedStateHandle: SavedStateHandle) : this( | ||
securityStructureId = SecurityStructureId.fromString( | ||
requireNotNull(savedStateHandle.get<String>(ARG_SECURITY_STRUCTURE_ID)) | ||
), | ||
securityStructureName = requireNotNull(savedStateHandle.get<String>(ARG_SECURITY_STRUCTURE_NAME)) | ||
) | ||
} | ||
|
||
fun NavController.securityShieldDetails( | ||
securityStructureId: SecurityStructureId, | ||
securityStructureName: String | ||
) { | ||
navigate("$ROUTE_SECURITY_SHIELD_DETAILS_SCREEN/$securityStructureId/$securityStructureName") | ||
} | ||
|
||
fun NavGraphBuilder.securityShieldDetails(navController: NavController) { | ||
composable( | ||
route = "$ROUTE_SECURITY_SHIELD_DETAILS_SCREEN/{$ARG_SECURITY_STRUCTURE_ID}/{$ARG_SECURITY_STRUCTURE_NAME}", | ||
arguments = listOf( | ||
navArgument(ARG_SECURITY_STRUCTURE_ID) { | ||
type = NavType.StringType | ||
}, | ||
navArgument(ARG_SECURITY_STRUCTURE_NAME) { | ||
type = NavType.StringType | ||
} | ||
), | ||
enterTransition = { | ||
slideIntoContainer(AnimatedContentTransitionScope.SlideDirection.Left) | ||
}, | ||
exitTransition = { | ||
ExitTransition.None | ||
}, | ||
popEnterTransition = { | ||
EnterTransition.None | ||
}, | ||
popExitTransition = { | ||
slideOutOfContainer(AnimatedContentTransitionScope.SlideDirection.Right) | ||
} | ||
) { | ||
SecurityShieldDetailsScreen( | ||
viewModel = hiltViewModel(), | ||
onBackClick = { navController.navigateUp() } | ||
) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would split the composables on their own files. since they are already in a
common.securityshields
package.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point but in which way though?