Skip to content

Commit

Permalink
integrated auth confirmation dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry-Borodin committed Aug 17, 2023
1 parent 4bb1e37 commit 6b9f59c
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import io.parity.signer.screens.scan.errors.TransactionErrorModel
import io.parity.signer.screens.scan.transaction.TransactionPreviewType
import io.parity.signer.screens.scan.transaction.TransactionsScreenFull
import io.parity.signer.screens.scan.transaction.dynamicderivations.AddDerivedKeysScreen
import io.parity.signer.screens.scan.transaction.dynamicderivations.AddDynamicDerivationScreenFull
import io.parity.signer.screens.scan.transaction.previewType
import io.parity.signer.ui.BottomSheetWrapperRoot
import io.parity.signer.uniffi.Action
Expand Down Expand Up @@ -105,9 +106,8 @@ fun ScanNavSubgraph(
},
)
} else if (dynamicDerivationsData != null) {
AddDerivedKeysScreen(
AddDynamicDerivationScreenFull(
model = dynamicDerivationsData,
modifier = Modifier.statusBarsPadding(),
onBack = scanViewModel::clearState,
onDone = {
scanViewModel.createDynamicDerivations(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package io.parity.signer.screens.scan.transaction.dynamicderivations

import android.content.res.Configuration
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material.MaterialTheme
Expand All @@ -18,13 +17,12 @@ 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.domain.EmptyNavigator
import io.parity.signer.ui.theme.SignerNewTheme
import io.parity.signer.ui.theme.SignerTypeface
import io.parity.signer.ui.theme.textSecondary

@Composable
fun ConfirmExportPrivateKeyMenu(
internal fun AddDDConfirmBottomSheet(
onCancel: Callback,
onConfirm: Callback,
) {
Expand Down Expand Up @@ -79,6 +77,6 @@ fun ConfirmExportPrivateKeyMenu(
@Composable
private fun PreviewConfirmExportPrivateKeyMenu() {
SignerNewTheme {
ConfirmExportPrivateKeyMenu({}, {})
AddDDConfirmBottomSheet({}, {})
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,13 @@ import io.parity.signer.uniffi.QrData
import io.parity.signer.uniffi.SignerImage

@Composable
fun AddDerivedKeysScreen(
internal fun AddDerivedKeysScreen(
model: DdPreview,
modifier: Modifier = Modifier,
onBack: Callback,
onDone: Callback,
) {
BackHandler(onBack = onBack)

Column(
modifier = modifier.verticalScroll(rememberScrollState()),
) {
Expand Down
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(
onCancel = { confirmState.value = false },
onConfirm = onDone,
)
}
}
}

0 comments on commit 6b9f59c

Please sign in to comment.