Fix handling of common backup status codes.
This commit is contained in:
parent
789aea3a3a
commit
7727deef9f
1 changed files with 5 additions and 3 deletions
|
@ -99,13 +99,15 @@ object BackupRepository {
|
||||||
private val resetInitializedStateErrorAction: StatusCodeErrorAction = { error ->
|
private val resetInitializedStateErrorAction: StatusCodeErrorAction = { error ->
|
||||||
when (error.code) {
|
when (error.code) {
|
||||||
401 -> {
|
401 -> {
|
||||||
Log.i(TAG, "Resetting initialized state due to 401.")
|
Log.w(TAG, "Received status 401. Resetting initialized state + auth credentials.", error.exception)
|
||||||
SignalStore.backup.backupsInitialized = false
|
SignalStore.backup.backupsInitialized = false
|
||||||
|
SignalStore.backup.clearAllCredentials()
|
||||||
}
|
}
|
||||||
|
|
||||||
403 -> {
|
403 -> {
|
||||||
Log.i(TAG, "Bad auth credential. Clearing stored credentials.")
|
Log.w(TAG, "Received status 403. The user is not in the media tier. Updating local state.", error.exception)
|
||||||
SignalStore.backup.clearAllCredentials()
|
SignalStore.backup.backupTier = MessageBackupTier.FREE
|
||||||
|
// TODO [backup] If the user thought they were in media tier but aren't, feels like we should have a special UX flow for this?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue