mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-25 09:17:44 +00:00
Use global Kovenant config
This commit is contained in:
parent
761c12addd
commit
a822c74ecc
20
app/src/main/java/org/thoughtcrime/securesms/AppContext.kt
Normal file
20
app/src/main/java/org/thoughtcrime/securesms/AppContext.kt
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
package org.thoughtcrime.securesms
|
||||||
|
|
||||||
|
import android.util.Log
|
||||||
|
import nl.komponents.kovenant.Kovenant
|
||||||
|
import nl.komponents.kovenant.jvm.asDispatcher
|
||||||
|
import org.session.libsignal.utilities.ThreadUtils
|
||||||
|
import java.util.concurrent.Executors
|
||||||
|
|
||||||
|
object AppContext {
|
||||||
|
|
||||||
|
fun configureKovenant() {
|
||||||
|
Kovenant.context {
|
||||||
|
callbackContext.dispatcher = Executors.newSingleThreadExecutor().asDispatcher()
|
||||||
|
workerContext.dispatcher = ThreadUtils.executorPool.asDispatcher()
|
||||||
|
multipleCompletion = { v1, v2 ->
|
||||||
|
Log.d("Loki", "Promise resolved more than once (first with $v1, then with $v2); ignoring $v2.")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -103,6 +103,7 @@ import dagger.ObjectGraph;
|
|||||||
import kotlin.Unit;
|
import kotlin.Unit;
|
||||||
import kotlinx.coroutines.Job;
|
import kotlinx.coroutines.Job;
|
||||||
import network.loki.messenger.BuildConfig;
|
import network.loki.messenger.BuildConfig;
|
||||||
|
import nl.komponents.kovenant.Kovenant;
|
||||||
|
|
||||||
import static nl.komponents.kovenant.android.KovenantAndroid.startKovenant;
|
import static nl.komponents.kovenant.android.KovenantAndroid.startKovenant;
|
||||||
import static nl.komponents.kovenant.android.KovenantAndroid.stopKovenant;
|
import static nl.komponents.kovenant.android.KovenantAndroid.stopKovenant;
|
||||||
@ -163,6 +164,7 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc
|
|||||||
ProcessLifecycleOwner.get().getLifecycle().addObserver(this);
|
ProcessLifecycleOwner.get().getLifecycle().addObserver(this);
|
||||||
// Loki
|
// Loki
|
||||||
// ========
|
// ========
|
||||||
|
AppContext.INSTANCE.configureKovenant();
|
||||||
messageNotifier = new OptimizedMessageNotifier(new DefaultMessageNotifier());
|
messageNotifier = new OptimizedMessageNotifier(new DefaultMessageNotifier());
|
||||||
broadcaster = new Broadcaster(this);
|
broadcaster = new Broadcaster(this);
|
||||||
threadNotificationHandler = new Handler(Looper.getMainLooper());
|
threadNotificationHandler = new Handler(Looper.getMainLooper());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user