Fetch api version on login
This commit is contained in:
parent
0eed9a8d07
commit
e281751bb0
@ -44,7 +44,6 @@ class Repository(private val api: SelfossApi, private val apiDetails: ApiDetails
|
||||
// TODO: Dispatchers.IO not available in KMM, an alternative solution should be found
|
||||
CoroutineScope(Dispatchers.Main).launch {
|
||||
updateApiVersion()
|
||||
dateUtils = DateUtils(apiMajorVersion)
|
||||
reloadBadges()
|
||||
}
|
||||
}
|
||||
@ -343,6 +342,9 @@ class Repository(private val api: SelfossApi, private val apiDetails: ApiDetails
|
||||
try {
|
||||
val response = api.login()
|
||||
result = response?.isSuccess == true
|
||||
if (result) {
|
||||
updateApiVersion()
|
||||
}
|
||||
} catch (cause: Throwable) {
|
||||
Napier.e(cause.stackTraceToString(), tag = "RepositoryImpl.updateRemote")
|
||||
}
|
||||
@ -373,6 +375,7 @@ class Repository(private val api: SelfossApi, private val apiDetails: ApiDetails
|
||||
settings.putInt("apiVersionMajor", apiMajorVersion)
|
||||
}
|
||||
}
|
||||
dateUtils = DateUtils(apiMajorVersion)
|
||||
}
|
||||
|
||||
fun isNetworkAvailable() = isConnectionAvailable.value && !offlineOverride
|
||||
|
Loading…
Reference in New Issue
Block a user