mirror of
https://github.com/mollyim/monero-wallet-sdk.git
synced 2025-02-05 01:15:37 -05:00
demo: clear selected remote nodes on network toggle
This commit is contained in:
parent
743e9997c5
commit
ec41094ae9
@ -49,20 +49,9 @@ class AddWalletViewModel(
|
|||||||
private fun getSelectedRemoteNodeIds() =
|
private fun getSelectedRemoteNodeIds() =
|
||||||
selectedRemoteNodes.filterValues { checked -> checked }.keys.filterNotNull()
|
selectedRemoteNodes.filterValues { checked -> checked }.keys.filterNotNull()
|
||||||
|
|
||||||
init {
|
|
||||||
val previousNodes = mutableSetOf<RemoteNode>()
|
|
||||||
|
|
||||||
currentRemoteNodes.onEach { remoteNodes ->
|
|
||||||
val unseenNodes = remoteNodes.filter { it !in previousNodes }
|
|
||||||
unseenNodes.forEach { node ->
|
|
||||||
selectedRemoteNodes[node.id] = true
|
|
||||||
previousNodes.add(node)
|
|
||||||
}
|
|
||||||
}.launchIn(viewModelScope)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun toggleSelectedNetwork(network: MoneroNetwork) {
|
fun toggleSelectedNetwork(network: MoneroNetwork) {
|
||||||
viewModelState.update { it.copy(network = network) }
|
viewModelState.update { it.copy(network = network) }
|
||||||
|
selectedRemoteNodes.clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun updateWalletName(name: String) {
|
fun updateWalletName(name: String) {
|
||||||
|
@ -317,7 +317,7 @@ private fun SecondStepScreen(
|
|||||||
AlertDialog(onDismissRequest = { showOffLineConfirmationDialog = false }, title = {
|
AlertDialog(onDismissRequest = { showOffLineConfirmationDialog = false }, title = {
|
||||||
Text("No remote nodes selected")
|
Text("No remote nodes selected")
|
||||||
}, text = {
|
}, text = {
|
||||||
Text("There are no remote nodes added to your wallet settings. Are you sure you want to create an offline wallet?")
|
Text("It seems there are no remote nodes added to your wallet settings. Are you sure you want to create an offline wallet?")
|
||||||
}, confirmButton = {
|
}, confirmButton = {
|
||||||
TextButton(onClick = {
|
TextButton(onClick = {
|
||||||
showOffLineConfirmationDialog = false
|
showOffLineConfirmationDialog = false
|
||||||
|
@ -149,7 +149,10 @@ class RemoteNodeClient private constructor(
|
|||||||
|
|
||||||
delay(retryBackoff.waitTime(retryCount))
|
delay(retryBackoff.waitTime(retryCount))
|
||||||
|
|
||||||
|
logger.d("HTTP: $method $uri")
|
||||||
|
|
||||||
val response = try {
|
val response = try {
|
||||||
|
|
||||||
val request = requestBuilder.url(uri.toString()).build()
|
val request = requestBuilder.url(uri.toString()).build()
|
||||||
|
|
||||||
httpClient.newCall(request).await()
|
httpClient.newCall(request).await()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user