Last active
June 14, 2022 09:16
-
-
Save mazzouzi/3413ad46fd785471688933340375586f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BackgroundLeakPresenter(val view: BackgroundLeakInterface) { | |
private val exceptionHandler = CoroutineExceptionHandler { _, exception -> | |
// Log exception error to server | |
} | |
private val coroutineScope = CoroutineScope(Job() + exceptionHandler) | |
fun doSomeIntensiveWork() { | |
coroutineScope.launch { | |
delay(120000) // simulate intensive work | |
view.onIntensiveWorkDone() | |
}.invokeOnCompletion { | |
Log.d("Morad", "${it?.message}") | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment