fix: null check in updater
Signed-off-by: Infi <wingit@geist.ga>
This commit is contained in:
parent
eeec84fd09
commit
933924328f
|
|
@ -1,6 +1,7 @@
|
||||||
package chat.revolt.screens.settings
|
package chat.revolt.screens.settings
|
||||||
|
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
|
import android.util.Log
|
||||||
import androidx.browser.customtabs.CustomTabsIntent
|
import androidx.browser.customtabs.CustomTabsIntent
|
||||||
import androidx.compose.animation.AnimatedVisibility
|
import androidx.compose.animation.AnimatedVisibility
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
|
|
@ -83,7 +84,7 @@ data class UpdaterBody(
|
||||||
data class UpdaterResponse(
|
data class UpdaterResponse(
|
||||||
val outdated: Boolean,
|
val outdated: Boolean,
|
||||||
@SerialName("newest_build")
|
@SerialName("newest_build")
|
||||||
val newestBuild: Int,
|
val newestBuild: Int?,
|
||||||
val token: String?,
|
val token: String?,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -120,13 +121,14 @@ class ClosedBetaUpdaterScreenViewModel : ViewModel() {
|
||||||
delay(1000)
|
delay(1000)
|
||||||
|
|
||||||
updateState = UpdateState.UpdateAvailable
|
updateState = UpdateState.UpdateAvailable
|
||||||
newestBuild = outdated.newestBuild
|
newestBuild = outdated.newestBuild ?: -1
|
||||||
newestDownloadToken = outdated.token ?: ""
|
newestDownloadToken = outdated.token ?: ""
|
||||||
} else {
|
} else {
|
||||||
updateState = UpdateState.UpToDate
|
updateState = UpdateState.UpToDate
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
updateState = UpdateState.ErrorChecking
|
updateState = UpdateState.ErrorChecking
|
||||||
|
Log.e("Updater", "Error checking for updates", e)
|
||||||
return@launch
|
return@launch
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue