Skip to content

Commit

Permalink
Handle failed connection
Browse files Browse the repository at this point in the history
  • Loading branch information
SudoDios committed May 15, 2024
1 parent 71c3014 commit b787fab
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/kotlin/core/Service.kt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ object Service {
var running = MutableLiveData(false)

var goToResult : () -> Unit = {}
var onError : (String?) -> Unit = {}

fun init () {
speedTestHandler = SpeedTestHandler()
Expand Down Expand Up @@ -151,6 +152,7 @@ object Service {
running.value = false
}
override fun onCriticalFailure(err: String?) {
onError.invoke(err)
currentStep.value = "FAILED"
running.value = false
}
Expand Down
3 changes: 3 additions & 0 deletions src/main/kotlin/routes/sections/home/TestStage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ fun TestStage(onCancel : () -> Unit,goToResult : () -> Unit) {
Service.goToResult = {
goToResult.invoke()
}
Service.onError = {
onCancel.invoke()
}
delay(3000)
enablecancelation = true
}
Expand Down

0 comments on commit b787fab

Please sign in to comment.