Refactor: Consistent & correct usage of coroutines (#7077)

* Refactor: Consistent usage of coroutines

* Add usage comments to the different threads

* Refactor: Properly separate crash handling into its platform-specific parts

* Fix autoSave never finishing

* Correctly handle coroutines when the GL thread is not accepting runnables anymore

Co-authored-by: Yair Morgenstern <yairm210@hotmail.com>
This commit is contained in:
Timo T
2022-06-11 23:13:49 +02:00
committed by GitHub
parent 9008d242a3
commit 9bd8750739
43 changed files with 479 additions and 464 deletions

View File

@ -7,7 +7,6 @@ import android.provider.DocumentsContract
import android.provider.OpenableColumns
import androidx.annotation.GuardedBy
import com.unciv.logic.CustomFileLocationHelper
import com.unciv.ui.crashhandling.postCrashHandlingRunnable
import java.io.InputStream
import java.io.OutputStream

View File

@ -3,6 +3,7 @@ package com.unciv.app
import android.app.Activity
import android.content.pm.ActivityInfo
import com.unciv.ui.utils.GeneralPlatformSpecificHelpers
import kotlin.concurrent.thread
/** See also interface [GeneralPlatformSpecificHelpers].
*
@ -35,4 +36,9 @@ Sources for Info about current orientation in case need:
* External is probably on an SD-card or similar which is always accessible by the user.
*/
override fun shouldPreferExternalStorage(): Boolean = true
override fun handleUncaughtThrowable(ex: Throwable): Boolean {
thread { throw ex } // this will kill the app but report the exception to the Google Play Console if the user allows it
return true
}
}