Prevent crash when logging in #81
@ -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() != "") {
|
||||
AmineB marked this conversation as resolved
Outdated
|
||||
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)
|
||||
AmineB marked this conversation as resolved
Outdated
AmineB
commented
why was this added ? why was this added ?
davidoskky
commented
If the repository is initialized before the login, this is required to initialize the dateUtils after logging in If the repository is initialized before the login, this is required to initialize the dateUtils after logging in
|
||||
}
|
||||
|
||||
fun isNetworkAvailable() = isConnectionAvailable.value && !offlineOverride
|
||||
|
Loading…
Reference in New Issue
Block a user
getBaseUrl
should never return an empty string.There is a verification done before even logging-in (and saving the settings), so this should never happen.
The repository is initialized before logging in, at that point appSettingsService returns an empty string
Ok, so this is a workaround.
The issue is that the
runBlocking
block is called even when the user is'nt updated. This should be fixed.I could remove this from the init method and make a new public method which is called by the login activity after it checks that the user is correctly set.
that could be better, yes !