This commit is contained in:
aminecmi 2022-08-19 22:38:55 +02:00
parent c87473e8f1
commit 44a0469b17
2 changed files with 8 additions and 3 deletions

View File

@ -329,8 +329,13 @@ class Repository(private val api: SelfossApi, private val apiDetails: ApiDetails
return success return success
} }
suspend fun updateRemote(): Boolean = suspend fun updateRemote(): Boolean {
isNetworkAvailable() && api.update()?.isSuccess == true return if (isNetworkAvailable()) {
api.update()?.equals("finished") ?: false
} else {
false
}
}
suspend fun login(): Boolean { suspend fun login(): Boolean {
var result = false var result = false

View File

@ -100,7 +100,7 @@ class SelfossApi(private val apiDetailsService: ApiDetailsService) {
parameter("password", apiDetailsService.getPassword()) parameter("password", apiDetailsService.getPassword())
}.body() }.body()
suspend fun update(): SelfossModel.SuccessResponse? = suspend fun update(): String? =
client.get(url("/update")) { client.get(url("/update")) {
parameter("username", apiDetailsService.getUserName()) parameter("username", apiDetailsService.getUserName())
parameter("password", apiDetailsService.getPassword()) parameter("password", apiDetailsService.getPassword())