mirror of
https://codeberg.org/timelimit/timelimit-android.git
synced 2025-10-05 02:39:30 +02:00
Add option to show exception from the background task logic main loop
This commit is contained in:
parent
422e823c29
commit
6dbb7579e8
5 changed files with 29 additions and 0 deletions
|
@ -49,6 +49,7 @@ import java.util.*
|
|||
|
||||
class BackgroundTaskLogic(val appLogic: AppLogic) {
|
||||
var pauseBackgroundLoop = false
|
||||
val lastLoopException = MutableLiveData<Exception?>().apply { value = null }
|
||||
|
||||
companion object {
|
||||
private const val CHECK_PERMISSION_INTERVAL = 10 * 1000L // all 10 seconds
|
||||
|
@ -531,6 +532,7 @@ class BackgroundTaskLogic(val appLogic: AppLogic) {
|
|||
}
|
||||
} catch (ex: SecurityException) {
|
||||
// this is handled by an other main loop (with a delay)
|
||||
lastLoopException.postValue(ex)
|
||||
|
||||
appLogic.platformIntegration.setAppStatusMessage(AppStatusMessage(
|
||||
appLogic.context.getString(R.string.background_logic_error),
|
||||
|
@ -542,6 +544,8 @@ class BackgroundTaskLogic(val appLogic: AppLogic) {
|
|||
Log.w(LOG_TAG, "exception during running main loop", ex)
|
||||
}
|
||||
|
||||
lastLoopException.postValue(ex)
|
||||
|
||||
appLogic.platformIntegration.setAppStatusMessage(AppStatusMessage(
|
||||
appLogic.context.getString(R.string.background_logic_error),
|
||||
appLogic.context.getString(R.string.background_logic_error_internal)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue