Skip to content

Commit 79e4a30

Browse files
Merge pull request #612 from bitcoinppl/use-methods
Refactor UniFFI standalone functions to enum/record methods
2 parents f95a42c + daafa30 commit 79e4a30

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+1123
-994
lines changed

android/app/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ android {
1212
applicationId = "org.bitcoinppl.cove"
1313
minSdk = 33
1414
targetSdk = 36
15-
versionCode = 16
16-
versionName = "1.2.1"
15+
versionCode = 17
16+
versionName = "1.3.0"
1717

1818
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
1919
vectorDrawables {

android/app/src/main/java/org/bitcoinppl/cove/MainActivity.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ import org.bitcoinppl.cove.views.TermsAndConditionsSheet
8282
import org.bitcoinppl.cove_core.bootstrap
8383
import org.bitcoinppl.cove_core.activeMigration
8484
import org.bitcoinppl.cove_core.bootstrapProgress
85-
import org.bitcoinppl.cove.utils.isMigrationInProgress
8685
import org.bitcoinppl.cove_core.cancelBootstrap
8786
import org.bitcoinppl.cove_core.AfterPinAction
8887
import org.bitcoinppl.cove_core.AppInitException
@@ -390,7 +389,7 @@ class MainActivity : FragmentActivity() {
390389
delay(66)
391390

392391
val step = bootstrapProgress()
393-
if (!migrationDetected && step.isMigrationInProgress) {
392+
if (!migrationDetected && step.isMigrationInProgress()) {
394393
migrationDetected = true
395394
}
396395

android/app/src/main/java/org/bitcoinppl/cove/flows/SettingsFlow/AppearanceSettingsScreen.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ import org.bitcoinppl.cove.views.SectionHeader
3636
import org.bitcoinppl.cove_core.AppAction
3737
import org.bitcoinppl.cove_core.types.ColorSchemeSelection
3838
import org.bitcoinppl.cove_core.types.allColorSchemes
39-
import org.bitcoinppl.cove_core.types.colorSchemeSelectionCapitalizedString
4039

4140
@OptIn(ExperimentalMaterial3Api::class)
4241
@Composable
@@ -118,7 +117,7 @@ private fun ColorSchemeRow(
118117
verticalAlignment = Alignment.CenterVertically,
119118
) {
120119
Text(
121-
text = colorSchemeSelectionCapitalizedString(colorScheme),
120+
text = colorScheme.capitalizedString(),
122121
style = MaterialTheme.typography.bodyLarge,
123122
)
124123

android/app/src/main/java/org/bitcoinppl/cove/flows/SettingsFlow/FiatCurrencySettingsScreen.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ import org.bitcoinppl.cove.views.SectionHeader
3636
import org.bitcoinppl.cove_core.AppAction
3737
import org.bitcoinppl.cove_core.FiatCurrency
3838
import org.bitcoinppl.cove_core.allFiatCurrencies
39-
import org.bitcoinppl.cove_core.fiatCurrencyEmoji
40-
import org.bitcoinppl.cove_core.fiatCurrencyToString
4139

4240
@OptIn(ExperimentalMaterial3Api::class)
4341
@Composable
@@ -119,7 +117,7 @@ private fun FiatCurrencyRow(
119117
verticalAlignment = Alignment.CenterVertically,
120118
) {
121119
Text(
122-
text = "${fiatCurrencyEmoji(fiatCurrency)} ${fiatCurrencyToString(fiatCurrency)}",
120+
text = "${fiatCurrency.emojiString()} ${fiatCurrency}",
123121
style = MaterialTheme.typography.bodyLarge,
124122
)
125123

android/app/src/main/java/org/bitcoinppl/cove/flows/SettingsFlow/NetworkSettingsScreen.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ import org.bitcoinppl.cove.views.SectionHeader
4141
import org.bitcoinppl.cove_core.AppAction
4242
import org.bitcoinppl.cove_core.types.Network
4343
import org.bitcoinppl.cove_core.types.allNetworks
44-
import org.bitcoinppl.cove_core.types.networkToString
4544

4645
@OptIn(ExperimentalMaterial3Api::class)
4746
@Composable
@@ -113,7 +112,7 @@ fun NetworkSettingsScreen(
113112
AlertDialog(
114113
onDismissRequest = { pendingNetworkChange = null },
115114
title = { Text("Warning: Network Changed") },
116-
text = { Text("You've changed your network to ${networkToString(network)}") },
115+
text = { Text("You've changed your network to ${network.toString()}") },
117116
confirmButton = {
118117
TextButton(
119118
onClick = {
@@ -153,7 +152,7 @@ private fun NetworkRow(
153152
verticalAlignment = Alignment.CenterVertically,
154153
) {
155154
Text(
156-
text = networkToString(network),
155+
text = network.toString(),
157156
style = MaterialTheme.typography.bodyLarge,
158157
)
159158

android/app/src/main/java/org/bitcoinppl/cove/flows/SettingsFlow/NodeSettingsScreen.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ import org.bitcoinppl.cove_core.ApiType
6060
import org.bitcoinppl.cove_core.NodeSelection
6161
import org.bitcoinppl.cove_core.NodeSelector
6262
import org.bitcoinppl.cove_core.NodeSelectorException
63-
import org.bitcoinppl.cove_core.nodeSelectionToNode
6463

6564
@OptIn(ExperimentalMaterial3Api::class)
6665
@Composable
@@ -75,7 +74,7 @@ fun NodeSettingsScreen(
7574
val nodeList = remember { nodeSelector.nodeList() }
7675
var selectedNodeSelection by remember { mutableStateOf(nodeSelector.selectedNode()) }
7776
var selectedNodeName by remember {
78-
mutableStateOf(nodeSelectionToNode(selectedNodeSelection).name)
77+
mutableStateOf(selectedNodeSelection.toNode().name)
7978
}
8079

8180
var customUrl by remember { mutableStateOf("") }
@@ -109,7 +108,7 @@ fun NodeSettingsScreen(
109108
if (showCustomFields && customUrl.isEmpty()) {
110109
val savedNode = selectedNodeSelection
111110
if (savedNode is NodeSelection.Custom) {
112-
val node = nodeSelectionToNode(savedNode)
111+
val node = savedNode.toNode()
113112
val matchesType =
114113
when (selectedNodeName) {
115114
customElectrum -> node.apiType == ApiType.ELECTRUM
@@ -266,7 +265,7 @@ fun NodeSettingsScreen(
266265
Column {
267266
// preset nodes
268267
nodeList.forEachIndexed { index, nodeSelection ->
269-
val node = nodeSelectionToNode(nodeSelection)
268+
val node = nodeSelection.toNode()
270269
NodeRow(
271270
nodeName = node.name,
272271
isSelected = selectedNodeName == node.name,

android/app/src/main/java/org/bitcoinppl/cove/flows/TapSignerFlow/TapSignerEnterPinView.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,5 +383,5 @@ private suspend fun signAction(
383383
private fun isAuthError(error: Exception): Boolean {
384384
// check if error is a bad auth error using type-safe FFI function
385385
return error is org.bitcoinppl.cove_core.TapSignerReaderException &&
386-
org.bitcoinppl.cove_core.tapSignerErrorIsAuthError(error)
386+
error.isAuthError()
387387
}

android/app/src/main/java/org/bitcoinppl/cove/utils/BootstrapStepExt.kt

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)