android, desktop: moving to single thread in api calls (#3670)

* android, desktop: moving to single thread in api calls

* more places

* more changes

* seconds

* long running api into init function

* changes

* developer options

* progress indicator

* string

* rename

* progressIndicator for stop chat
This commit is contained in:
Stanislav Dmitrenko authored and GitHub committed 2024-01-11 18:50:25 +00:00
1 parent bc8a6f4833
commit dad9716915
61 files changed
+331 -261

No files matched your search

@@ -26,7 +26,6 @@ import kotlinx.coroutines.sync.withLock
import java.io.*
import java.util.*
import java.util.concurrent.TimeUnit
import kotlin.system.exitProcess
const val TAG = "SIMPLEX"
@@ -72,7 +71,7 @@ class SimplexApp: Application(), LifecycleEventObserver {
override fun onStateChanged(source: LifecycleOwner, event: Lifecycle.Event) {
Log.d(TAG, "onStateChanged: $event")
withApi {
withBGApi {
when (event) {
Lifecycle.Event.ON_START -> {
isAppOnForeground = true
@@ -104,7 +104,7 @@ class SimplexService: Service() {
if (wakeLock != null || isStartingService) return
val self = this
isStartingService = true
withApi {
withBGApi {
val chatController = ChatController
waitDbMigrationEnds(chatController)
try {
@@ -114,7 +114,7 @@ class SimplexService: Service() {
Log.w(chat.simplex.app.TAG, "SimplexService: problem with the database: $chatDbStatus")
showPassphraseNotification(chatDbStatus)
safeStopService()
return@withApi
return@withBGApi
}
saveServiceState(self, ServiceState.STARTED)
wakeLock = (getSystemService(Context.POWER_SERVICE) as PowerManager).run {