Prevent crash when logging in

This commit is contained in:
davidoskky 2022-10-17 19:35:52 +02:00
parent 8b0bbe71c9
commit c25e8889a4

View File

@ -43,10 +43,11 @@ class Repository(private val api: SelfossApi, private val appSettingsService: Ap
init {
// TODO: Dispatchers.IO not available in KMM, an alternative solution should be found
connectivityStatus.start()
runBlocking {
updateApiVersion()
dateUtils = DateUtils(appSettingsService)
reloadBadges()
if (appSettingsService.getBaseUrl() != "") {
runBlocking {
updateApiVersion()
reloadBadges()
}
}
}
@ -408,6 +409,7 @@ class Repository(private val api: SelfossApi, private val appSettingsService: Ap
appSettingsService.updateApiVersion(fetchedVersion.data.getApiMajorVersion())
}
}
dateUtils = DateUtils(appSettingsService)
}
fun isNetworkAvailable() = isConnectionAvailable.value && !offlineOverride