Use kotlin.time extensions in some more places

This commit is contained in:
arkon
2022-10-22 19:57:55 -04:00
parent 39e41510d0
commit 5c868d7846
8 changed files with 20 additions and 12 deletions

View File

@@ -25,6 +25,7 @@ import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.TimeUnit
import kotlin.time.Duration.Companion.seconds
/**
* Cache where we dump the downloads directory from the filesystem. This class is needed because
@@ -243,13 +244,13 @@ class DownloadCache(
var sources = getSources()
// Try to wait until extensions and sources have loaded
withTimeout(30000L) {
withTimeout(30.seconds) {
while (!extensionManager.isInitialized) {
delay(2000L)
delay(2.seconds)
}
while (sources.isEmpty()) {
delay(2000L)
delay(2.seconds)
sources = getSources()
}
}

View File

@@ -78,6 +78,7 @@ import logcat.LogPriority
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
import uy.kohesive.injekt.injectLazy
import kotlin.time.Duration.Companion.seconds
class MainActivity : BaseActivity() {
@@ -550,7 +551,7 @@ class MainActivity : BaseActivity() {
private suspend fun resetExitConfirmation() {
isConfirmingExit = true
val toast = toast(R.string.confirm_exit, Toast.LENGTH_LONG)
delay(2000)
delay(2.seconds)
toast.cancel()
isConfirmingExit = false
}