Skip to content

Commit

Permalink
Merge pull request #31 from mysteriumnetwork/fix/balance-delay-fetch
Browse files Browse the repository at this point in the history
Fix/balance delay fetch
  • Loading branch information
i-kulikov-geniusee authored Nov 29, 2023
2 parents ce08398 + e19ff75 commit 7692db0
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 10 deletions.
2 changes: 1 addition & 1 deletion android/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ android {
minSdk = libs.versions.minSdk.get().toInt()
targetSdk = libs.versions.targetSdk.get().toInt()
versionCode = 2
versionName = "1.1.1"
versionName = "1.1"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ sealed class Settings {
data class UpdateLimit(val value: String) : Event()
object SaveMobileDataLimit : Event()
object OnContinue : Event()
object ShutDown: Event()
object ConfirmShutDown: Event()
object CancelShutDown: Event()
object ShutDown : Event()
object ConfirmShutDown : Event()
object CancelShutDown : Event()
}

data class State(
Expand All @@ -30,15 +30,16 @@ sealed class Settings {
val isStartingNode: Boolean,
val showShutDownConfirmation: Boolean,
val nodeError: NodeError?,
val continueButtonEnabled: Boolean
val continueButtonEnabled: Boolean,
val isLoading: Boolean = false,
) : UIState

data class NodeError(
@StringRes val messageResId: Int
)

sealed class Effect : UIEffect {
data class Navigation(val destination: NavigationDestination): Effect()
object CloseApp: Effect()
data class Navigation(val destination: NavigationDestination) : Effect()
object CloseApp : Effect()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
Expand Down Expand Up @@ -82,7 +84,7 @@ fun SettingsScreen(
appVersion = context.appVersion(),
onEvent = { viewModel.setEvent(it) },
onNavigate = onNavigate,
onHelpPressed = { viewModel.trackHelpPressed()}
onHelpPressed = { viewModel.trackHelpPressed() }
)
}

Expand Down Expand Up @@ -147,6 +149,10 @@ private fun SettingsContent(
}
}
}

if (state.isLoading) {
CircularProgressIndicator(modifier = Modifier.align(Alignment.Center))
}
}

if (state.showShutDownConfirmation) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class SettingsViewModel(
showShutDownConfirmation = false,
continueButtonEnabled = true,
nodeError = null,
isLoading = false
)
}

Expand Down Expand Up @@ -175,9 +176,12 @@ class SettingsViewModel(
}

private fun shutDownNode() = launch {
setState { copy(isLoading = true, showShutDownConfirmation = false) }

withContext(ioDispatcher) {
node.stop()
}
setState { copy(isLoading = true) }
setEffect { Settings.Effect.CloseApp }
}

Expand Down
2 changes: 1 addition & 1 deletion android/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ compose-bom = "2023.10.01"
compose-navigation = "2.7.5"
accompanist = "0.30.1"
node-terms = "0.0.50"
node = "1.28.0"
node = "1.29.2-rc3"
koin = "3.4.3"
koin-compose = "3.4.6"
markwon = "4.6.2"
Expand Down

0 comments on commit 7692db0

Please sign in to comment.