Fix gated close codes, run ticket refresh on Dispatchers.IO, prevent scope race on startup, and auto-format files.
This commit is contained in:
12 files changed
+118
-24
No files matched your search
@@ -301,6 +301,7 @@ class ChannelsViewModel :
|
||||
onboardingExpiresIn = formatExpiry(setup?.expiresAt),
|
||||
)
|
||||
}
|
||||
|
||||
is com.m57.hermescontrol.data.remote.NetworkResult.Failure -> {
|
||||
it.copy(
|
||||
onboardingPhase = OnboardingPhase.IDLE,
|
||||
@@ -350,6 +351,7 @@ class ChannelsViewModel :
|
||||
}
|
||||
_uiState.update { it.copy(onboardingError = null) }
|
||||
}
|
||||
|
||||
is com.m57.hermescontrol.data.remote.NetworkResult.Failure -> {
|
||||
val expired = isOnboardingExpired(_uiState.value.onboardingSetup)
|
||||
if (expired) {
|
||||
@@ -470,6 +472,7 @@ class ChannelsViewModel :
|
||||
loadPlatforms()
|
||||
}
|
||||
}
|
||||
|
||||
is com.m57.hermescontrol.data.remote.NetworkResult.Failure -> {
|
||||
_uiState.update {
|
||||
it.copy(
|
||||
@@ -520,7 +523,9 @@ private fun formatExpiry(expiresAt: String?): String {
|
||||
val ms =
|
||||
try {
|
||||
isoTimestampParser
|
||||
.parse(expiresAt)?.time?.minus(System.currentTimeMillis())
|
||||
.parse(expiresAt)
|
||||
?.time
|
||||
?.minus(System.currentTimeMillis())
|
||||
} catch (_: Exception) {
|
||||
null
|
||||
}
|
||||
@@ -537,7 +542,8 @@ private fun isOnboardingExpired(setup: com.m57.hermescontrol.data.model.Telegram
|
||||
val ms =
|
||||
try {
|
||||
isoTimestampParser
|
||||
.parse(expiresAt)?.time
|
||||
.parse(expiresAt)
|
||||
?.time
|
||||
} catch (_: Exception) {
|
||||
null
|
||||
}
|
||||
|
||||
+3
@@ -186,6 +186,7 @@ internal fun TelegramOnboardingDialog(
|
||||
Text("Save and restart")
|
||||
}
|
||||
}
|
||||
|
||||
else -> {}
|
||||
}
|
||||
},
|
||||
@@ -194,9 +195,11 @@ internal fun TelegramOnboardingDialog(
|
||||
OnboardingPhase.READY -> {
|
||||
TextButton(onClick = onDismiss) { Text("Cancel") }
|
||||
}
|
||||
|
||||
OnboardingPhase.WAITING -> {
|
||||
TextButton(onClick = onDismiss) { Text("Cancel") }
|
||||
}
|
||||
|
||||
OnboardingPhase.IDLE, OnboardingPhase.STARTING, OnboardingPhase.APPLYING -> {}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user