|
|
|
@ -20,17 +20,13 @@ import android.annotation.SuppressLint;
|
|
|
|
|
import android.arch.lifecycle.DefaultLifecycleObserver;
|
|
|
|
|
import android.arch.lifecycle.LifecycleOwner;
|
|
|
|
|
import android.arch.lifecycle.ProcessLifecycleOwner;
|
|
|
|
|
import android.content.BroadcastReceiver;
|
|
|
|
|
import android.content.Context;
|
|
|
|
|
import android.content.Intent;
|
|
|
|
|
import android.content.IntentFilter;
|
|
|
|
|
import android.database.ContentObserver;
|
|
|
|
|
import android.os.AsyncTask;
|
|
|
|
|
import android.os.Build;
|
|
|
|
|
import android.support.annotation.NonNull;
|
|
|
|
|
import android.support.annotation.Nullable;
|
|
|
|
|
import android.support.multidex.MultiDexApplication;
|
|
|
|
|
import android.support.v4.content.LocalBroadcastManager;
|
|
|
|
|
|
|
|
|
|
import com.crashlytics.android.Crashlytics;
|
|
|
|
|
import com.google.android.gms.security.ProviderInstaller;
|
|
|
|
@ -91,6 +87,7 @@ import org.whispersystems.libsignal.logging.SignalProtocolLoggerProvider;
|
|
|
|
|
import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope;
|
|
|
|
|
import org.whispersystems.signalservice.internal.push.SignalServiceProtos;
|
|
|
|
|
import org.whispersystems.signalservice.loki.api.LokiAPIDatabaseProtocol;
|
|
|
|
|
import org.whispersystems.signalservice.loki.api.LokiDotNetAPI;
|
|
|
|
|
import org.whispersystems.signalservice.loki.api.LokiPublicChat;
|
|
|
|
|
import org.whispersystems.signalservice.loki.api.LokiPublicChatAPI;
|
|
|
|
|
import org.whispersystems.signalservice.loki.api.LokiLongPoller;
|
|
|
|
@ -113,6 +110,7 @@ import io.fabric.sdk.android.Fabric;
|
|
|
|
|
import kotlin.Unit;
|
|
|
|
|
import kotlin.jvm.functions.Function1;
|
|
|
|
|
import network.loki.messenger.BuildConfig;
|
|
|
|
|
import okhttp3.Cache;
|
|
|
|
|
|
|
|
|
|
import static nl.komponents.kovenant.android.KovenantAndroid.startKovenant;
|
|
|
|
|
import static nl.komponents.kovenant.android.KovenantAndroid.stopKovenant;
|
|
|
|
@ -128,6 +126,7 @@ import static nl.komponents.kovenant.android.KovenantAndroid.stopKovenant;
|
|
|
|
|
public class ApplicationContext extends MultiDexApplication implements DependencyInjector, DefaultLifecycleObserver, LokiP2PAPIDelegate {
|
|
|
|
|
|
|
|
|
|
private static final String TAG = ApplicationContext.class.getSimpleName();
|
|
|
|
|
private final static int OK_HTTP_CACHE_SIZE = 10 * 1024 * 1024; // 10MB
|
|
|
|
|
|
|
|
|
|
private ExpiringMessageManager expiringMessageManager;
|
|
|
|
|
private TypingStatusRepository typingStatusRepository;
|
|
|
|
@ -192,7 +191,8 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc
|
|
|
|
|
};
|
|
|
|
|
// Loki - Set up public chat manager
|
|
|
|
|
lokiPublicChatManager = new LokiPublicChatManager(this);
|
|
|
|
|
|
|
|
|
|
// Loki - Set the cache
|
|
|
|
|
LokiDotNetAPI.setCache(new Cache(this.getCacheDir(), OK_HTTP_CACHE_SIZE));
|
|
|
|
|
// Loki - Update device mappings
|
|
|
|
|
if (setUpStorageAPIIfNeeded()) {
|
|
|
|
|
LokiStorageAPI.Companion.getShared().updateUserDeviceMappings();
|
|
|
|
|