demo: clear selected remote nodes on network toggle

This commit is contained in:
Oscar Mira 2024-03-04 19:46:08 +01:00
parent 743e9997c5
commit ec41094ae9
3 changed files with 5 additions and 13 deletions

View File

@ -49,20 +49,9 @@ class AddWalletViewModel(
private fun getSelectedRemoteNodeIds() =
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) {
viewModelState.update { it.copy(network = network) }
selectedRemoteNodes.clear()
}
fun updateWalletName(name: String) {

View File

@ -317,7 +317,7 @@ private fun SecondStepScreen(
AlertDialog(onDismissRequest = { showOffLineConfirmationDialog = false }, title = {
Text("No remote nodes selected")
}, 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 = {
TextButton(onClick = {
showOffLineConfirmationDialog = false

View File

@ -149,7 +149,10 @@ class RemoteNodeClient private constructor(
delay(retryBackoff.waitTime(retryCount))
logger.d("HTTP: $method $uri")
val response = try {
val request = requestBuilder.url(uri.toString()).build()
httpClient.newCall(request).await()