|
|
@@ -211,7 +211,7 @@ class BackupRepository(
|
|
|
CMD_MESSAGING_APP,
|
|
|
"sleep 5",
|
|
|
)
|
|
|
-
|
|
|
+ var otp = false
|
|
|
val success = run isSuccess@{
|
|
|
if (backup.stock != 1) {
|
|
|
return@isSuccess true
|
|
|
@@ -245,10 +245,11 @@ class BackupRepository(
|
|
|
}
|
|
|
|
|
|
val state = taskRunner.gmsgStateRepository.waitForRcsState(
|
|
|
- arrayOf(RcsConfigureState.CONFIGURED), 5.minutes
|
|
|
+ arrayOf(RcsConfigureState.CONFIGURED, RcsConfigureState.WAITING_FOR_OTP), 5.minutes
|
|
|
)
|
|
|
job.cancel()
|
|
|
if (state == RcsConfigureState.CONFIGURED) return@isSuccess true
|
|
|
+ if (state == RcsConfigureState.WAITING_FOR_OTP) otp = true
|
|
|
false
|
|
|
}
|
|
|
|
|
|
@@ -268,10 +269,14 @@ class BackupRepository(
|
|
|
Log.i(TAG, "restore: failed")
|
|
|
if (backup.stock == 1) {
|
|
|
backup.retry++
|
|
|
- if (backup.retry >= 3) {
|
|
|
- backup.stock = 3
|
|
|
- dao.update(backup)
|
|
|
+ if (backup.retry >= 3 || otp) {
|
|
|
RcsNumberApi.updateStockFlag(backup.numberId, 3)
|
|
|
+ if (otp) {
|
|
|
+ dao.delete(backup)
|
|
|
+ } else {
|
|
|
+ backup.stock = 3
|
|
|
+ dao.update(backup)
|
|
|
+ }
|
|
|
} else {
|
|
|
dao.update(backup)
|
|
|
}
|