Revert non 1.3.3 changes (#1782)
* Revert "#1763 Keystone confirmation flow design update (#1773)" This reverts commit1ed5088953
. * Revert "Flexa bump to version 1.0.11 from maven central (#1762)" This reverts commited8dad3c54
.
This commit is contained in:
parent
1ed5088953
commit
a20fbd3e83
|
@ -6,13 +6,6 @@ and this application adheres to [Semantic Versioning](https://semver.org/spec/v2
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
### Added
|
|
||||||
- Confirm the rejection of a Keystone transaction dialog added.
|
|
||||||
|
|
||||||
### Changed
|
|
||||||
- `Flexa` version has been bumped to 1.0.11
|
|
||||||
- Keystone flows swapped the buttons for the better UX, the main CTA is the closes button for a thumb.
|
|
||||||
|
|
||||||
## [1.3.3 (839)] - 2025-01-23
|
## [1.3.3 (839)] - 2025-01-23
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
|
@ -30,13 +30,14 @@ buildscript {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mavenCentral {
|
// We don't use mavenCentral now, but in the future we may want to use it for some dependencies
|
||||||
if (isRepoRestrictionEnabled) {
|
// mavenCentral {
|
||||||
content {
|
// if (isRepoRestrictionEnabled) {
|
||||||
googleGroups.forEach { excludeGroup(it) }
|
// content {
|
||||||
}
|
// googleGroups.forEach { excludeGroup(it) }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
gradlePluginPortal {
|
gradlePluginPortal {
|
||||||
if (isRepoRestrictionEnabled) {
|
if (isRepoRestrictionEnabled) {
|
||||||
content {
|
content {
|
||||||
|
@ -44,6 +45,7 @@ buildscript {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
maven("${rootProject.projectDir}/maven") // url to a local maven in this repository
|
||||||
maven("https://jitpack.io")
|
maven("https://jitpack.io")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -215,7 +215,7 @@ ZXING_VERSION=3.5.3
|
||||||
ZIP_321_VERSION = 0.0.6
|
ZIP_321_VERSION = 0.0.6
|
||||||
ZCASH_BIP39_VERSION=1.0.8
|
ZCASH_BIP39_VERSION=1.0.8
|
||||||
|
|
||||||
FLEXA_VERSION=1.0.11
|
FLEXA_VERSION=1.0.9
|
||||||
|
|
||||||
# WARNING: Ensure a non-snapshot version is used before releasing to production
|
# WARNING: Ensure a non-snapshot version is used before releasing to production
|
||||||
ZCASH_SDK_VERSION=2.2.7
|
ZCASH_SDK_VERSION=2.2.7
|
||||||
|
|
Binary file not shown.
|
@ -0,0 +1,120 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>com.flexa</groupId>
|
||||||
|
<artifactId>core</artifactId>
|
||||||
|
<version>1.0.9</version>
|
||||||
|
<packaging>aar</packaging>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>androidx.core</groupId>
|
||||||
|
<artifactId>core-ktx</artifactId>
|
||||||
|
<version>1.13.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>androidx.compose.ui</groupId>
|
||||||
|
<artifactId>ui</artifactId>
|
||||||
|
<version>1.7.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>androidx.compose.ui</groupId>
|
||||||
|
<artifactId>ui-tooling-preview</artifactId>
|
||||||
|
<version>1.7.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>androidx.compose.material</groupId>
|
||||||
|
<artifactId>material-icons-extended</artifactId>
|
||||||
|
<version>1.7.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>androidx.compose.material3</groupId>
|
||||||
|
<artifactId>material3</artifactId>
|
||||||
|
<version>1.3.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>androidx.activity</groupId>
|
||||||
|
<artifactId>activity-compose</artifactId>
|
||||||
|
<version>1.9.2</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>androidx.compose.runtime</groupId>
|
||||||
|
<artifactId>runtime-livedata</artifactId>
|
||||||
|
<version>1.7.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>androidx.navigation</groupId>
|
||||||
|
<artifactId>navigation-compose</artifactId>
|
||||||
|
<version>2.8.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>androidx.webkit</groupId>
|
||||||
|
<artifactId>webkit</artifactId>
|
||||||
|
<version>1.12.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>androidx.lifecycle</groupId>
|
||||||
|
<artifactId>lifecycle-runtime-compose</artifactId>
|
||||||
|
<version>2.8.5</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>androidx.lifecycle</groupId>
|
||||||
|
<artifactId>lifecycle-viewmodel-compose</artifactId>
|
||||||
|
<version>2.8.5</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>androidx.appcompat</groupId>
|
||||||
|
<artifactId>appcompat</artifactId>
|
||||||
|
<version>1.7.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.coil-kt</groupId>
|
||||||
|
<artifactId>coil-compose</artifactId>
|
||||||
|
<version>2.7.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>joda-time</groupId>
|
||||||
|
<artifactId>joda-time</artifactId>
|
||||||
|
<version>2.12.7</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.squareup.okhttp3</groupId>
|
||||||
|
<artifactId>okhttp</artifactId>
|
||||||
|
<version>4.12.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.squareup.okhttp3</groupId>
|
||||||
|
<artifactId>logging-interceptor</artifactId>
|
||||||
|
<version>4.12.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.squareup.okhttp3</groupId>
|
||||||
|
<artifactId>okhttp-sse</artifactId>
|
||||||
|
<version>4.12.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>androidx.security</groupId>
|
||||||
|
<artifactId>security-crypto</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.crypto.tink</groupId>
|
||||||
|
<artifactId>tink-android</artifactId>
|
||||||
|
<version>1.8.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.code.gson</groupId>
|
||||||
|
<artifactId>gson</artifactId>
|
||||||
|
<version>2.11.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jetbrains.kotlinx</groupId>
|
||||||
|
<artifactId>kotlinx-serialization-json</artifactId>
|
||||||
|
<version>1.6.3</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>androidx.room</groupId>
|
||||||
|
<artifactId>room-runtime</artifactId>
|
||||||
|
<version>2.6.1</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<metadata>
|
||||||
|
<groupId>com.flexa</groupId>
|
||||||
|
<artifactId>core</artifactId>
|
||||||
|
<versioning>
|
||||||
|
<latest>1.0.9</latest>
|
||||||
|
<release>1.0.9</release>
|
||||||
|
<versions>
|
||||||
|
<version>1.0.9</version>
|
||||||
|
</versions>
|
||||||
|
<lastUpdated>20241126103837</lastUpdated>
|
||||||
|
</versioning>
|
||||||
|
</metadata>
|
Binary file not shown.
|
@ -0,0 +1,105 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>com.flexa</groupId>
|
||||||
|
<artifactId>spend</artifactId>
|
||||||
|
<version>1.0.9</version>
|
||||||
|
<packaging>aar</packaging>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.flexa</groupId>
|
||||||
|
<artifactId>core</artifactId>
|
||||||
|
<version>1.0.9</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>androidx.core</groupId>
|
||||||
|
<artifactId>core-ktx</artifactId>
|
||||||
|
<version>1.13.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>androidx.compose.ui</groupId>
|
||||||
|
<artifactId>ui</artifactId>
|
||||||
|
<version>1.7.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>androidx.compose.ui</groupId>
|
||||||
|
<artifactId>ui-util</artifactId>
|
||||||
|
<version>1.7.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>androidx.compose.ui</groupId>
|
||||||
|
<artifactId>ui-tooling-preview</artifactId>
|
||||||
|
<version>1.7.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>androidx.compose.material</groupId>
|
||||||
|
<artifactId>material-icons-extended</artifactId>
|
||||||
|
<version>1.7.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>androidx.compose.material3</groupId>
|
||||||
|
<artifactId>material3</artifactId>
|
||||||
|
<version>1.3.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>androidx.activity</groupId>
|
||||||
|
<artifactId>activity-compose</artifactId>
|
||||||
|
<version>1.9.2</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>androidx.lifecycle</groupId>
|
||||||
|
<artifactId>lifecycle-viewmodel-compose</artifactId>
|
||||||
|
<version>2.8.5</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>androidx.navigation</groupId>
|
||||||
|
<artifactId>navigation-compose</artifactId>
|
||||||
|
<version>2.8.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>androidx.compose.runtime</groupId>
|
||||||
|
<artifactId>runtime-livedata</artifactId>
|
||||||
|
<version>1.7.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>androidx.webkit</groupId>
|
||||||
|
<artifactId>webkit</artifactId>
|
||||||
|
<version>1.12.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.coil-kt</groupId>
|
||||||
|
<artifactId>coil-compose</artifactId>
|
||||||
|
<version>2.7.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.coil-kt</groupId>
|
||||||
|
<artifactId>coil-svg</artifactId>
|
||||||
|
<version>2.7.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.caverock</groupId>
|
||||||
|
<artifactId>androidsvg-aar</artifactId>
|
||||||
|
<version>1.4</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.zxing</groupId>
|
||||||
|
<artifactId>core</artifactId>
|
||||||
|
<version>3.5.3</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-codec</groupId>
|
||||||
|
<artifactId>commons-codec</artifactId>
|
||||||
|
<version>1.15</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>androidx.work</groupId>
|
||||||
|
<artifactId>work-runtime-ktx</artifactId>
|
||||||
|
<version>2.9.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.flexa</groupId>
|
||||||
|
<artifactId>core</artifactId>
|
||||||
|
<version>1.0.9</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<metadata>
|
||||||
|
<groupId>com.flexa</groupId>
|
||||||
|
<artifactId>spend</artifactId>
|
||||||
|
<versioning>
|
||||||
|
<latest>1.0.9</latest>
|
||||||
|
<release>1.0.9</release>
|
||||||
|
<versions>
|
||||||
|
<version>1.0.9</version>
|
||||||
|
</versions>
|
||||||
|
<lastUpdated>20241126103856</lastUpdated>
|
||||||
|
</versioning>
|
||||||
|
</metadata>
|
|
@ -137,6 +137,7 @@ dependencyResolutionManagement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
maven("${rootProject.projectDir}/maven") // url to a local maven in this repository
|
||||||
maven("https://jitpack.io")
|
maven("https://jitpack.io")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,8 +260,8 @@ dependencyResolutionManagement {
|
||||||
library("zxing", "com.google.zxing:core:$zxingVersion")
|
library("zxing", "com.google.zxing:core:$zxingVersion")
|
||||||
library("koin", "io.insert-koin:koin-android:$koinVersion")
|
library("koin", "io.insert-koin:koin-android:$koinVersion")
|
||||||
library("koin-compose", "io.insert-koin:koin-androidx-compose:$koinVersion")
|
library("koin-compose", "io.insert-koin:koin-androidx-compose:$koinVersion")
|
||||||
library("flexa-core", "co.flexa:core:$flexaVersion")
|
library("flexa-core", "com.flexa:core:$flexaVersion")
|
||||||
library("flexa-spend", "co.flexa:spend:$flexaVersion")
|
library("flexa-spend", "com.flexa:spend:$flexaVersion")
|
||||||
library("keystone", "com.github.KeystoneHQ:keystone-sdk-android:$keystoneVersion")
|
library("keystone", "com.github.KeystoneHQ:keystone-sdk-android:$keystoneVersion")
|
||||||
|
|
||||||
// Test libraries
|
// Test libraries
|
||||||
|
|
|
@ -201,22 +201,6 @@ object ZashiButtonDefaults {
|
||||||
borderColor = borderColor,
|
borderColor = borderColor,
|
||||||
disabledBorderColor = Color.Unspecified
|
disabledBorderColor = Color.Unspecified
|
||||||
)
|
)
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun destructive2Colors(
|
|
||||||
containerColor: Color = ZashiColors.Btns.Destructive2.btnDestroy2Bg,
|
|
||||||
contentColor: Color = ZashiColors.Btns.Destructive2.btnDestroy2Fg,
|
|
||||||
borderColor: Color = Color.Unspecified,
|
|
||||||
disabledContainerColor: Color = ZashiColors.Btns.Destructive2.btnDestroy2BgDisabled,
|
|
||||||
disabledContentColor: Color = ZashiColors.Btns.Destructive2.btnDestroy2FgDisabled,
|
|
||||||
) = ZashiButtonColors(
|
|
||||||
containerColor = containerColor,
|
|
||||||
contentColor = contentColor,
|
|
||||||
disabledContainerColor = disabledContainerColor,
|
|
||||||
disabledContentColor = disabledContentColor,
|
|
||||||
borderColor = borderColor,
|
|
||||||
disabledBorderColor = Color.Unspecified
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Immutable
|
@Immutable
|
||||||
|
|
|
@ -1,58 +0,0 @@
|
||||||
package co.electriccoin.zcash.ui.design.component
|
|
||||||
|
|
||||||
import androidx.activity.compose.BackHandler
|
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
|
||||||
import androidx.compose.material3.ModalBottomSheetProperties
|
|
||||||
import androidx.compose.material3.SheetState
|
|
||||||
import androidx.compose.runtime.Composable
|
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
|
||||||
import androidx.compose.runtime.getValue
|
|
||||||
import androidx.compose.runtime.mutableStateOf
|
|
||||||
import androidx.compose.runtime.remember
|
|
||||||
import androidx.compose.runtime.setValue
|
|
||||||
import androidx.compose.ui.Modifier
|
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
|
||||||
@Composable
|
|
||||||
fun <T : ModalBottomSheetState> ZashiInScreenModalBottomSheet(
|
|
||||||
state: T?,
|
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
sheetState: SheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true),
|
|
||||||
content: @Composable (T) -> Unit = {},
|
|
||||||
) {
|
|
||||||
var normalizedState: T? by remember { mutableStateOf(null) }
|
|
||||||
|
|
||||||
normalizedState?.let {
|
|
||||||
ZashiModalBottomSheet(
|
|
||||||
onDismissRequest = {
|
|
||||||
it.onBack()
|
|
||||||
},
|
|
||||||
modifier = modifier,
|
|
||||||
sheetState = sheetState,
|
|
||||||
properties =
|
|
||||||
ModalBottomSheetProperties(
|
|
||||||
shouldDismissOnBackPress = false
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
BackHandler {
|
|
||||||
it.onBack()
|
|
||||||
}
|
|
||||||
|
|
||||||
content(it)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LaunchedEffect(state) {
|
|
||||||
if (state != null) {
|
|
||||||
normalizedState = state
|
|
||||||
sheetState.show()
|
|
||||||
} else {
|
|
||||||
sheetState.hide()
|
|
||||||
normalizedState = null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ModalBottomSheetState {
|
|
||||||
val onBack: () -> Unit
|
|
||||||
}
|
|
|
@ -12,8 +12,6 @@ import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.material3.BottomSheetDefaults
|
import androidx.compose.material3.BottomSheetDefaults
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
import androidx.compose.material3.ModalBottomSheet
|
import androidx.compose.material3.ModalBottomSheet
|
||||||
import androidx.compose.material3.ModalBottomSheetDefaults
|
|
||||||
import androidx.compose.material3.ModalBottomSheetProperties
|
|
||||||
import androidx.compose.material3.SheetState
|
import androidx.compose.material3.SheetState
|
||||||
import androidx.compose.material3.SheetValue
|
import androidx.compose.material3.SheetValue
|
||||||
import androidx.compose.material3.SheetValue.Expanded
|
import androidx.compose.material3.SheetValue.Expanded
|
||||||
|
@ -38,7 +36,6 @@ fun ZashiModalBottomSheet(
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
scrimColor: Color = BottomSheetDefaults.ScrimColor,
|
scrimColor: Color = BottomSheetDefaults.ScrimColor,
|
||||||
sheetState: SheetState = rememberModalBottomSheetState(),
|
sheetState: SheetState = rememberModalBottomSheetState(),
|
||||||
properties: ModalBottomSheetProperties = ModalBottomSheetDefaults.properties,
|
|
||||||
content: @Composable ColumnScope.() -> Unit,
|
content: @Composable ColumnScope.() -> Unit,
|
||||||
) {
|
) {
|
||||||
ModalBottomSheet(
|
ModalBottomSheet(
|
||||||
|
@ -49,7 +46,6 @@ fun ZashiModalBottomSheet(
|
||||||
shape = ZashiModalBottomSheetDefaults.SheetShape,
|
shape = ZashiModalBottomSheetDefaults.SheetShape,
|
||||||
containerColor = ZashiModalBottomSheetDefaults.ContainerColor,
|
containerColor = ZashiModalBottomSheetDefaults.ContainerColor,
|
||||||
dragHandle = { ZashiModalBottomSheetDragHandle() },
|
dragHandle = { ZashiModalBottomSheetDragHandle() },
|
||||||
properties = properties,
|
|
||||||
content = content,
|
content = content,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -358,15 +358,15 @@ private fun AmountWidget(state: AmountState) {
|
||||||
private fun BottomBar(state: ReviewTransactionState) {
|
private fun BottomBar(state: ReviewTransactionState) {
|
||||||
ZashiBottomBar {
|
ZashiBottomBar {
|
||||||
ZashiButton(
|
ZashiButton(
|
||||||
state = state.negativeButton,
|
state = state.primaryButton,
|
||||||
colors = ZashiButtonDefaults.secondaryColors(),
|
|
||||||
modifier =
|
modifier =
|
||||||
Modifier
|
Modifier
|
||||||
.padding(horizontal = 24.dp)
|
.padding(horizontal = 24.dp)
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
)
|
)
|
||||||
ZashiButton(
|
ZashiButton(
|
||||||
state = state.primaryButton,
|
state = state.negativeButton,
|
||||||
|
colors = ZashiButtonDefaults.secondaryColors(),
|
||||||
modifier =
|
modifier =
|
||||||
Modifier
|
Modifier
|
||||||
.padding(horizontal = 24.dp)
|
.padding(horizontal = 24.dp)
|
||||||
|
|
|
@ -1,21 +1,17 @@
|
||||||
package co.electriccoin.zcash.ui.screen.signkeystonetransaction
|
package co.electriccoin.zcash.ui.screen.signkeystonetransaction
|
||||||
|
|
||||||
import androidx.activity.compose.BackHandler
|
import androidx.activity.compose.BackHandler
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
import co.electriccoin.zcash.ui.screen.signkeystonetransaction.view.SignKeystoneTransactionBottomSheet
|
|
||||||
import co.electriccoin.zcash.ui.screen.signkeystonetransaction.view.SignKeystoneTransactionView
|
import co.electriccoin.zcash.ui.screen.signkeystonetransaction.view.SignKeystoneTransactionView
|
||||||
import co.electriccoin.zcash.ui.screen.signkeystonetransaction.viewmodel.SignKeystoneTransactionViewModel
|
import co.electriccoin.zcash.ui.screen.signkeystonetransaction.viewmodel.SignKeystoneTransactionViewModel
|
||||||
import org.koin.androidx.compose.koinViewModel
|
import org.koin.androidx.compose.koinViewModel
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
|
||||||
@Composable
|
@Composable
|
||||||
fun AndroidSignKeystoneTransaction() {
|
fun AndroidSignKeystoneTransaction() {
|
||||||
val viewModel = koinViewModel<SignKeystoneTransactionViewModel>()
|
val viewModel = koinViewModel<SignKeystoneTransactionViewModel>()
|
||||||
val state by viewModel.state.collectAsStateWithLifecycle()
|
val state by viewModel.state.collectAsStateWithLifecycle()
|
||||||
val bottomSheetState by viewModel.bottomSheetState.collectAsStateWithLifecycle()
|
|
||||||
|
|
||||||
BackHandler {
|
BackHandler {
|
||||||
state?.onBack?.invoke()
|
state?.onBack?.invoke()
|
||||||
|
@ -24,8 +20,4 @@ fun AndroidSignKeystoneTransaction() {
|
||||||
state?.let {
|
state?.let {
|
||||||
SignKeystoneTransactionView(it)
|
SignKeystoneTransactionView(it)
|
||||||
}
|
}
|
||||||
|
|
||||||
SignKeystoneTransactionBottomSheet(
|
|
||||||
state = bottomSheetState
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,110 +0,0 @@
|
||||||
package co.electriccoin.zcash.ui.screen.signkeystonetransaction.view
|
|
||||||
|
|
||||||
import androidx.compose.foundation.Image
|
|
||||||
import androidx.compose.foundation.layout.Column
|
|
||||||
import androidx.compose.foundation.layout.Spacer
|
|
||||||
import androidx.compose.foundation.layout.WindowInsets
|
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
|
||||||
import androidx.compose.foundation.layout.height
|
|
||||||
import androidx.compose.foundation.layout.padding
|
|
||||||
import androidx.compose.foundation.layout.systemBars
|
|
||||||
import androidx.compose.foundation.layout.windowInsetsBottomHeight
|
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
|
||||||
import androidx.compose.material3.SheetState
|
|
||||||
import androidx.compose.material3.SheetValue
|
|
||||||
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.text.font.FontWeight
|
|
||||||
import androidx.compose.ui.unit.dp
|
|
||||||
import co.electriccoin.zcash.ui.R
|
|
||||||
import co.electriccoin.zcash.ui.design.component.ButtonState
|
|
||||||
import co.electriccoin.zcash.ui.design.component.ModalBottomSheetState
|
|
||||||
import co.electriccoin.zcash.ui.design.component.ZashiButton
|
|
||||||
import co.electriccoin.zcash.ui.design.component.ZashiButtonDefaults
|
|
||||||
import co.electriccoin.zcash.ui.design.component.ZashiInScreenModalBottomSheet
|
|
||||||
import co.electriccoin.zcash.ui.design.component.rememberModalBottomSheetState
|
|
||||||
import co.electriccoin.zcash.ui.design.newcomponent.PreviewScreens
|
|
||||||
import co.electriccoin.zcash.ui.design.theme.ZcashTheme
|
|
||||||
import co.electriccoin.zcash.ui.design.theme.colors.ZashiColors
|
|
||||||
import co.electriccoin.zcash.ui.design.theme.typography.ZashiTypography
|
|
||||||
import co.electriccoin.zcash.ui.design.util.stringRes
|
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
|
||||||
@Composable
|
|
||||||
fun SignKeystoneTransactionBottomSheet(
|
|
||||||
state: SignKeystoneTransactionBottomSheetState?,
|
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
sheetState: SheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true),
|
|
||||||
) {
|
|
||||||
ZashiInScreenModalBottomSheet(
|
|
||||||
state = state,
|
|
||||||
sheetState = sheetState,
|
|
||||||
modifier = modifier
|
|
||||||
) {
|
|
||||||
Column(
|
|
||||||
modifier = Modifier.padding(horizontal = 24.dp),
|
|
||||||
horizontalAlignment = Alignment.CenterHorizontally
|
|
||||||
) {
|
|
||||||
Image(
|
|
||||||
painter = painterResource(R.drawable.ic_keystone_sign_reject),
|
|
||||||
contentDescription = null
|
|
||||||
)
|
|
||||||
Spacer(Modifier.height(8.dp))
|
|
||||||
Text(
|
|
||||||
text = stringResource(R.string.sign_keystone_transaction_bottom_sheet_title),
|
|
||||||
style = ZashiTypography.header6,
|
|
||||||
color = ZashiColors.Text.textPrimary,
|
|
||||||
fontWeight = FontWeight.SemiBold
|
|
||||||
)
|
|
||||||
Spacer(Modifier.height(8.dp))
|
|
||||||
Text(
|
|
||||||
text = stringResource(R.string.sign_keystone_transaction_bottom_sheet_subtitle),
|
|
||||||
style = ZashiTypography.textSm,
|
|
||||||
color = ZashiColors.Text.textTertiary,
|
|
||||||
)
|
|
||||||
Spacer(Modifier.height(32.dp))
|
|
||||||
ZashiButton(
|
|
||||||
modifier = Modifier.fillMaxWidth(),
|
|
||||||
state = it.positiveButton
|
|
||||||
)
|
|
||||||
Spacer(Modifier.height(8.dp))
|
|
||||||
ZashiButton(
|
|
||||||
modifier = Modifier.fillMaxWidth(),
|
|
||||||
state = it.negativeButton,
|
|
||||||
colors = ZashiButtonDefaults.destructive2Colors()
|
|
||||||
)
|
|
||||||
Spacer(modifier = Modifier.windowInsetsBottomHeight(WindowInsets.systemBars))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
data class SignKeystoneTransactionBottomSheetState(
|
|
||||||
override val onBack: () -> Unit,
|
|
||||||
val positiveButton: ButtonState,
|
|
||||||
val negativeButton: ButtonState,
|
|
||||||
) : ModalBottomSheetState
|
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
|
||||||
@PreviewScreens
|
|
||||||
@Composable
|
|
||||||
private fun Preview() =
|
|
||||||
ZcashTheme {
|
|
||||||
SignKeystoneTransactionBottomSheet(
|
|
||||||
sheetState =
|
|
||||||
rememberModalBottomSheetState(
|
|
||||||
skipPartiallyExpanded = true,
|
|
||||||
skipHiddenState = true,
|
|
||||||
initialValue = SheetValue.Expanded,
|
|
||||||
),
|
|
||||||
state =
|
|
||||||
SignKeystoneTransactionBottomSheetState(
|
|
||||||
onBack = {},
|
|
||||||
positiveButton = ButtonState(stringRes("Get Signature")),
|
|
||||||
negativeButton = ButtonState(stringRes("Reject")),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
|
@ -163,12 +163,12 @@ private fun BottomSection(
|
||||||
}
|
}
|
||||||
ZashiButton(
|
ZashiButton(
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
state = state.negativeButton,
|
state = state.positiveButton
|
||||||
colors = ZashiButtonDefaults.destructive1Colors()
|
|
||||||
)
|
)
|
||||||
ZashiButton(
|
ZashiButton(
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
state = state.positiveButton
|
state = state.negativeButton,
|
||||||
|
colors = ZashiButtonDefaults.secondaryColors()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,19 +18,15 @@ import co.electriccoin.zcash.ui.screen.addressbook.viewmodel.ADDRESS_MAX_LENGTH
|
||||||
import co.electriccoin.zcash.ui.screen.scankeystone.ScanKeystonePCZTRequest
|
import co.electriccoin.zcash.ui.screen.scankeystone.ScanKeystonePCZTRequest
|
||||||
import co.electriccoin.zcash.ui.screen.signkeystonetransaction.state.SignKeystoneTransactionState
|
import co.electriccoin.zcash.ui.screen.signkeystonetransaction.state.SignKeystoneTransactionState
|
||||||
import co.electriccoin.zcash.ui.screen.signkeystonetransaction.state.ZashiAccountInfoListItemState
|
import co.electriccoin.zcash.ui.screen.signkeystonetransaction.state.ZashiAccountInfoListItemState
|
||||||
import co.electriccoin.zcash.ui.screen.signkeystonetransaction.view.SignKeystoneTransactionBottomSheetState
|
|
||||||
import com.sparrowwallet.hummingbird.UREncoder
|
import com.sparrowwallet.hummingbird.UREncoder
|
||||||
import kotlinx.coroutines.delay
|
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
import kotlinx.coroutines.flow.SharingStarted
|
import kotlinx.coroutines.flow.SharingStarted
|
||||||
import kotlinx.coroutines.flow.StateFlow
|
import kotlinx.coroutines.flow.StateFlow
|
||||||
import kotlinx.coroutines.flow.WhileSubscribed
|
import kotlinx.coroutines.flow.WhileSubscribed
|
||||||
import kotlinx.coroutines.flow.combine
|
import kotlinx.coroutines.flow.combine
|
||||||
import kotlinx.coroutines.flow.map
|
|
||||||
import kotlinx.coroutines.flow.stateIn
|
import kotlinx.coroutines.flow.stateIn
|
||||||
import kotlinx.coroutines.flow.update
|
import kotlinx.coroutines.flow.update
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlin.time.Duration.Companion.milliseconds
|
|
||||||
|
|
||||||
class SignKeystoneTransactionViewModel(
|
class SignKeystoneTransactionViewModel(
|
||||||
observeSelectedWalletAccount: ObserveSelectedWalletAccountUseCase,
|
observeSelectedWalletAccount: ObserveSelectedWalletAccountUseCase,
|
||||||
|
@ -42,37 +38,8 @@ class SignKeystoneTransactionViewModel(
|
||||||
) : ViewModel() {
|
) : ViewModel() {
|
||||||
private var encoder: UREncoder? = null
|
private var encoder: UREncoder? = null
|
||||||
|
|
||||||
private val isBottomSheetVisible = MutableStateFlow(false)
|
|
||||||
|
|
||||||
private val currentQrPart = MutableStateFlow<String?>(null)
|
private val currentQrPart = MutableStateFlow<String?>(null)
|
||||||
|
|
||||||
val bottomSheetState =
|
|
||||||
isBottomSheetVisible
|
|
||||||
.map { isVisible ->
|
|
||||||
if (isVisible) {
|
|
||||||
SignKeystoneTransactionBottomSheetState(
|
|
||||||
onBack = ::onCloseBottomSheetClick,
|
|
||||||
positiveButton =
|
|
||||||
ButtonState(
|
|
||||||
text = stringRes(R.string.sign_keystone_transaction_bottom_sheet_go_back),
|
|
||||||
onClick = ::onCloseBottomSheetClick
|
|
||||||
),
|
|
||||||
negativeButton =
|
|
||||||
ButtonState(
|
|
||||||
text = stringRes(R.string.sign_keystone_transaction_bottom_sheet_reject),
|
|
||||||
onClick = ::onRejectBottomSheetClick
|
|
||||||
),
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.stateIn(
|
|
||||||
scope = viewModelScope,
|
|
||||||
started = SharingStarted.WhileSubscribed(ANDROID_STATE_FLOW_TIMEOUT),
|
|
||||||
initialValue = null
|
|
||||||
)
|
|
||||||
|
|
||||||
val state: StateFlow<SignKeystoneTransactionState?> =
|
val state: StateFlow<SignKeystoneTransactionState?> =
|
||||||
combine(
|
combine(
|
||||||
observeProposalUseCase(),
|
observeProposalUseCase(),
|
||||||
|
@ -114,11 +81,7 @@ class SignKeystoneTransactionViewModel(
|
||||||
// TODO [#1731]: https://github.com/Electric-Coin-Company/zashi-android/issues/1731
|
// TODO [#1731]: https://github.com/Electric-Coin-Company/zashi-android/issues/1731
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}.stateIn(
|
}.stateIn(viewModelScope, SharingStarted.WhileSubscribed(ANDROID_STATE_FLOW_TIMEOUT), null)
|
||||||
scope = viewModelScope,
|
|
||||||
started = SharingStarted.WhileSubscribed(ANDROID_STATE_FLOW_TIMEOUT),
|
|
||||||
initialValue = null
|
|
||||||
)
|
|
||||||
|
|
||||||
init {
|
init {
|
||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
|
@ -131,29 +94,17 @@ class SignKeystoneTransactionViewModel(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onRejectBottomSheetClick() {
|
|
||||||
viewModelScope.launch {
|
|
||||||
isBottomSheetVisible.update { false }
|
|
||||||
delay(350.milliseconds)
|
|
||||||
cancelKeystoneProposalFlow()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun onCloseBottomSheetClick() {
|
|
||||||
isBottomSheetVisible.update { false }
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun onSharePCZTClick() =
|
private fun onSharePCZTClick() =
|
||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
sharePCZT()
|
sharePCZT()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onBack() {
|
private fun onBack() {
|
||||||
isBottomSheetVisible.update { !it }
|
cancelKeystoneProposalFlow()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onRejectClick() {
|
private fun onRejectClick() {
|
||||||
isBottomSheetVisible.update { true }
|
cancelKeystoneProposalFlow()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onSignTransactionClick() {
|
private fun onSignTransactionClick() {
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:aapt="http://schemas.android.com/aapt"
|
|
||||||
android:width="45dp"
|
|
||||||
android:height="44dp"
|
|
||||||
android:viewportWidth="45"
|
|
||||||
android:viewportHeight="44">
|
|
||||||
<path
|
|
||||||
android:pathData="M0.5,22C0.5,9.85 10.35,0 22.5,0C34.65,0 44.5,9.85 44.5,22C44.5,34.15 34.65,44 22.5,44C10.35,44 0.5,34.15 0.5,22Z">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:startX="22.5"
|
|
||||||
android:startY="0"
|
|
||||||
android:endX="22.5"
|
|
||||||
android:endY="44"
|
|
||||||
android:type="linear">
|
|
||||||
<item android:offset="0" android:color="#FF55160C"/>
|
|
||||||
<item android:offset="1" android:color="#FF7A271A"/>
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path
|
|
||||||
android:pathData="M18.333,29.219C15.842,27.778 14.167,25.085 14.167,22C14.167,17.398 17.897,13.667 22.5,13.667C27.102,13.667 30.833,17.398 30.833,22C30.833,25.085 29.157,27.778 26.667,29.219M25.833,22L22.5,18.667M22.5,18.667L19.167,22M22.5,18.667V30.333"
|
|
||||||
android:strokeLineJoin="round"
|
|
||||||
android:strokeWidth="1.66667"
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:strokeColor="#F04438"
|
|
||||||
android:strokeLineCap="round"/>
|
|
||||||
</vector>
|
|
|
@ -1,28 +0,0 @@
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:aapt="http://schemas.android.com/aapt"
|
|
||||||
android:width="45dp"
|
|
||||||
android:height="44dp"
|
|
||||||
android:viewportWidth="45"
|
|
||||||
android:viewportHeight="44">
|
|
||||||
<path
|
|
||||||
android:pathData="M0.5,22C0.5,9.85 10.35,0 22.5,0C34.65,0 44.5,9.85 44.5,22C44.5,34.15 34.65,44 22.5,44C10.35,44 0.5,34.15 0.5,22Z">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:startX="22.5"
|
|
||||||
android:startY="0"
|
|
||||||
android:endX="22.5"
|
|
||||||
android:endY="44"
|
|
||||||
android:type="linear">
|
|
||||||
<item android:offset="0" android:color="#FFFEF3F2"/>
|
|
||||||
<item android:offset="1" android:color="#FFFEE4E2"/>
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path
|
|
||||||
android:pathData="M18.333,29.219C15.842,27.778 14.167,25.085 14.167,22C14.167,17.398 17.898,13.667 22.5,13.667C27.102,13.667 30.833,17.398 30.833,22C30.833,25.085 29.157,27.778 26.667,29.219M25.833,22L22.5,18.667M22.5,18.667L19.167,22M22.5,18.667V30.333"
|
|
||||||
android:strokeLineJoin="round"
|
|
||||||
android:strokeWidth="1.66667"
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:strokeColor="#F04438"
|
|
||||||
android:strokeLineCap="round"/>
|
|
||||||
</vector>
|
|
|
@ -6,8 +6,4 @@
|
||||||
<string name="sign_keystone_transaction_badge">Hardware</string>
|
<string name="sign_keystone_transaction_badge">Hardware</string>
|
||||||
<string name="sign_keystone_transaction_positive">Obtener Firma</string>
|
<string name="sign_keystone_transaction_positive">Obtener Firma</string>
|
||||||
<string name="sign_keystone_transaction_negative">Rechazar</string>
|
<string name="sign_keystone_transaction_negative">Rechazar</string>
|
||||||
<string name="sign_keystone_transaction_bottom_sheet_title">¿Estás seguro?</string>
|
|
||||||
<string name="sign_keystone_transaction_bottom_sheet_subtitle">Rechazar la firma cancelará la transacción y tendrás que empezar de nuevo si deseas continuar. Esta acción no se puede deshacer.</string>
|
|
||||||
<string name="sign_keystone_transaction_bottom_sheet_go_back">Volver</string>
|
|
||||||
<string name="sign_keystone_transaction_bottom_sheet_reject">Rechazar firma</string>
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -6,8 +6,4 @@
|
||||||
<string name="sign_keystone_transaction_badge">Hardware</string>
|
<string name="sign_keystone_transaction_badge">Hardware</string>
|
||||||
<string name="sign_keystone_transaction_positive">Get Signature</string>
|
<string name="sign_keystone_transaction_positive">Get Signature</string>
|
||||||
<string name="sign_keystone_transaction_negative">Reject</string>
|
<string name="sign_keystone_transaction_negative">Reject</string>
|
||||||
<string name="sign_keystone_transaction_bottom_sheet_title">Are you sure?</string>
|
|
||||||
<string name="sign_keystone_transaction_bottom_sheet_subtitle">Rejecting the signature will cancel the transaction, and you’ll need to start over if you want to proceed. This action cannot be undone.</string>
|
|
||||||
<string name="sign_keystone_transaction_bottom_sheet_go_back">Go back</string>
|
|
||||||
<string name="sign_keystone_transaction_bottom_sheet_reject">Reject Signature</string>
|
|
||||||
</resources>
|
</resources>
|
Loading…
Reference in New Issue