|
|
@@ -720,7 +720,6 @@ class TaskRunner(
|
|
|
)
|
|
|
}
|
|
|
var success = true
|
|
|
- var retry = 0
|
|
|
repeat(num) {
|
|
|
if (!isActive) {
|
|
|
Log.e(TAG, "storeNumbers: job is cancelled, stopping repeat")
|
|
|
@@ -728,7 +727,9 @@ class TaskRunner(
|
|
|
}
|
|
|
Log.i(TAG, "storeNumbers: $it")
|
|
|
try {
|
|
|
- if (success || retry > 3) {
|
|
|
+ if ((success || appStateRepo.appState.value.requestedNum > 3)
|
|
|
+ && !(it == 0 && appStateRepo.appState.value.requestedNum == 0)
|
|
|
+ ) {
|
|
|
reset()
|
|
|
}
|
|
|
requestNumberAtomic(store = true)
|
|
|
@@ -745,14 +746,13 @@ class TaskRunner(
|
|
|
flag = 1
|
|
|
)
|
|
|
success = true
|
|
|
- retry = 0
|
|
|
} catch (e: CancellationException) {
|
|
|
Log.e(TAG, "storeNumbers: job is cancelled", e)
|
|
|
} catch (e: Exception) {
|
|
|
success = false
|
|
|
- retry++
|
|
|
- Log.e(TAG, "Error store number, retry: $retry", e)
|
|
|
+ Log.e(TAG, "Error store number", e)
|
|
|
}
|
|
|
+ appStateRepo.incrementRequestedNum()
|
|
|
}
|
|
|
if (success) {
|
|
|
reset()
|