-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Android dd confirmation (#2010)
* added dd confirmation dialog * integrated auth confirmation dialog * added message and handling for empty keys list
- Loading branch information
1 parent
c8bd784
commit 2e4ab4c
Showing
6 changed files
with
133 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
...a/io/parity/signer/screens/scan/transaction/dynamicderivations/AddDDConfirmBottomSheet.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package io.parity.signer.screens.scan.transaction.dynamicderivations | ||
|
||
import android.content.res.Configuration | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material.MaterialTheme | ||
import androidx.compose.material.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.text.style.TextAlign | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import io.parity.signer.R | ||
import io.parity.signer.components.base.PrimaryButtonWide | ||
import io.parity.signer.components.base.SecondaryButtonWide | ||
import io.parity.signer.domain.Callback | ||
import io.parity.signer.ui.theme.SignerNewTheme | ||
import io.parity.signer.ui.theme.SignerTypeface | ||
import io.parity.signer.ui.theme.textSecondary | ||
|
||
@Composable | ||
internal fun AddDDConfirmBottomSheet( | ||
onConfirm: Callback, | ||
onCancel: Callback, | ||
) { | ||
val sidePadding = 24.dp | ||
Column( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding(start = sidePadding, end = sidePadding), | ||
horizontalAlignment = Alignment.CenterHorizontally, | ||
) { | ||
|
||
Text( | ||
text = stringResource(R.string.confirm_dynamic_derivation_header), | ||
color = MaterialTheme.colors.primary, | ||
style = SignerTypeface.TitleL, | ||
textAlign = TextAlign.Center, | ||
modifier = Modifier.padding(top = 24.dp) | ||
) | ||
Text( | ||
modifier = Modifier.padding(top = 12.dp, bottom = 24.dp), | ||
text = stringResource(R.string.confirm_dynamic_derivation_message), | ||
color = MaterialTheme.colors.textSecondary, | ||
style = SignerTypeface.BodyL, | ||
textAlign = TextAlign.Center, | ||
) | ||
|
||
PrimaryButtonWide( | ||
label = stringResource(R.string.confirm_dynamic_derivation_cta), | ||
onClicked = onConfirm, | ||
modifier = Modifier.padding(bottom = 8.dp) | ||
) | ||
|
||
SecondaryButtonWide( | ||
label = stringResource(R.string.generic_cancel), | ||
withBackground = true, | ||
onClicked = onCancel, | ||
modifier = Modifier.padding(bottom = 24.dp) | ||
) | ||
} | ||
} | ||
|
||
|
||
@Preview( | ||
name = "light", group = "themes", uiMode = Configuration.UI_MODE_NIGHT_NO, | ||
showBackground = true, backgroundColor = 0xFFFFFFFF, | ||
) | ||
@Preview( | ||
name = "dark", group = "themes", | ||
uiMode = Configuration.UI_MODE_NIGHT_YES, | ||
showBackground = true, backgroundColor = 0xFF000000, | ||
) | ||
@Composable | ||
private fun PreviewConfirmExportPrivateKeyMenu() { | ||
SignerNewTheme { | ||
AddDDConfirmBottomSheet({}, {}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...rity/signer/screens/scan/transaction/dynamicderivations/AddDynamicDerivationScreenFull.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package io.parity.signer.screens.scan.transaction.dynamicderivations | ||
|
||
import androidx.compose.foundation.layout.statusBarsPadding | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.mutableStateOf | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.ui.Modifier | ||
import io.parity.signer.domain.Callback | ||
import io.parity.signer.ui.BottomSheetWrapperRoot | ||
import io.parity.signer.uniffi.DdPreview | ||
|
||
|
||
@Composable | ||
fun AddDynamicDerivationScreenFull( | ||
model: DdPreview, | ||
onBack: Callback, | ||
onDone: Callback, | ||
) { | ||
|
||
val confirmState = remember { mutableStateOf(false) } | ||
|
||
AddDerivedKeysScreen( | ||
model = model, | ||
modifier = Modifier.statusBarsPadding(), | ||
onBack = onBack, | ||
onDone = { confirmState.value = true }, | ||
) | ||
|
||
if (confirmState.value) { | ||
BottomSheetWrapperRoot(onClosedAction = { confirmState.value = false }) { | ||
AddDDConfirmBottomSheet( | ||
onConfirm = onDone, | ||
onCancel = { confirmState.value = false }, | ||
) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters