Skip to content

Commit d29e88b

Browse files
committed
Avoid cancelling tasks in case of a orientation change
1 parent 6883ded commit d29e88b

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

app/src/main/kotlin/com/proxerme/app/task/framework/BaseTask.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ abstract class BaseTask<I, O>(override var successCallback: ((O) -> Unit)? = nul
4646
open protected fun start(action: () -> Unit) {
4747
cancel()
4848

49+
startWithoutCancelling(action)
50+
}
51+
52+
open protected fun startWithoutCancelling(action: () -> Unit) {
4953
onStartCallback?.invoke()
5054

5155
action.invoke()

app/src/main/kotlin/com/proxerme/app/task/framework/ValidatingTask.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class ValidatingTask<I, O>(private val task: Task<I, O>,
3333
return
3434
}
3535

36-
start {
36+
startWithoutCancelling {
3737
task.execute(input)
3838
}
3939
}

0 commit comments

Comments
 (0)