mirror of
https://github.com/oxen-io/session-android.git
synced 2025-02-20 06:08:27 +00:00
Quick fix crash
This commit is contained in:
parent
062f22071e
commit
550d8b61c7
@ -155,12 +155,11 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc
|
|||||||
broadcaster = new Broadcaster(this);
|
broadcaster = new Broadcaster(this);
|
||||||
threadNotificationHandler = new Handler(Looper.getMainLooper());
|
threadNotificationHandler = new Handler(Looper.getMainLooper());
|
||||||
LokiAPIDatabase apiDB = DatabaseFactory.getLokiAPIDatabase(this);
|
LokiAPIDatabase apiDB = DatabaseFactory.getLokiAPIDatabase(this);
|
||||||
String userPublicKey = TextSecurePreferences.getLocalNumber(this);
|
|
||||||
MessagingModuleConfiguration.Companion.configure(this,
|
MessagingModuleConfiguration.Companion.configure(this,
|
||||||
DatabaseFactory.getStorage(this),
|
DatabaseFactory.getStorage(this),
|
||||||
DatabaseFactory.getAttachmentProvider(this));
|
DatabaseFactory.getAttachmentProvider(this));
|
||||||
SnodeModule.Companion.configure(apiDB, broadcaster);
|
SnodeModule.Companion.configure(apiDB, broadcaster);
|
||||||
resubmitProfilePictureIfNeeded();
|
String userPublicKey = TextSecurePreferences.getLocalNumber(this);
|
||||||
if (userPublicKey != null) {
|
if (userPublicKey != null) {
|
||||||
registerForFCMIfNeeded(false);
|
registerForFCMIfNeeded(false);
|
||||||
}
|
}
|
||||||
@ -175,6 +174,7 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc
|
|||||||
initializeJobManager();
|
initializeJobManager();
|
||||||
initializeWebRtc();
|
initializeWebRtc();
|
||||||
initializeBlobProvider();
|
initializeBlobProvider();
|
||||||
|
resubmitProfilePictureIfNeeded();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -313,13 +313,13 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc
|
|||||||
|
|
||||||
private void initializeJobManager() {
|
private void initializeJobManager() {
|
||||||
this.jobManager = new JobManager(this, new JobManager.Configuration.Builder()
|
this.jobManager = new JobManager(this, new JobManager.Configuration.Builder()
|
||||||
.setDataSerializer(new JsonDataSerializer())
|
.setDataSerializer(new JsonDataSerializer())
|
||||||
.setJobFactories(JobManagerFactories.getJobFactories(this))
|
.setJobFactories(JobManagerFactories.getJobFactories(this))
|
||||||
.setConstraintFactories(JobManagerFactories.getConstraintFactories(this))
|
.setConstraintFactories(JobManagerFactories.getConstraintFactories(this))
|
||||||
.setConstraintObservers(JobManagerFactories.getConstraintObservers(this))
|
.setConstraintObservers(JobManagerFactories.getConstraintObservers(this))
|
||||||
.setJobStorage(new FastJobStorage(DatabaseFactory.getJobDatabase(this)))
|
.setJobStorage(new FastJobStorage(DatabaseFactory.getJobDatabase(this)))
|
||||||
.setDependencyInjector(this)
|
.setDependencyInjector(this)
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeDependencyInjection() {
|
private void initializeDependencyInjection() {
|
||||||
@ -327,7 +327,6 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc
|
|||||||
this.objectGraph = ObjectGraph.create(communicationModule);
|
this.objectGraph = ObjectGraph.create(communicationModule);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void initializeExpiringMessageManager() {
|
private void initializeExpiringMessageManager() {
|
||||||
this.expiringMessageManager = new ExpiringMessageManager(this);
|
this.expiringMessageManager = new ExpiringMessageManager(this);
|
||||||
}
|
}
|
||||||
@ -349,7 +348,7 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initializePeriodicTasks() {
|
private void initializePeriodicTasks() {
|
||||||
BackgroundPollWorker.schedulePeriodic(this); // Loki
|
BackgroundPollWorker.schedulePeriodic(this);
|
||||||
|
|
||||||
if (BuildConfig.PLAY_STORE_DISABLED) {
|
if (BuildConfig.PLAY_STORE_DISABLED) {
|
||||||
UpdateApkRefreshListener.schedule(this);
|
UpdateApkRefreshListener.schedule(this);
|
||||||
|
@ -14,8 +14,8 @@ class MessagingModuleConfiguration(
|
|||||||
lateinit var shared: MessagingModuleConfiguration
|
lateinit var shared: MessagingModuleConfiguration
|
||||||
|
|
||||||
fun configure(context: Context,
|
fun configure(context: Context,
|
||||||
storage: StorageProtocol,
|
storage: StorageProtocol,
|
||||||
messageDataProvider: MessageDataProvider
|
messageDataProvider: MessageDataProvider
|
||||||
) {
|
) {
|
||||||
if (Companion::shared.isInitialized) { return }
|
if (Companion::shared.isInitialized) { return }
|
||||||
shared = MessagingModuleConfiguration(context, storage, messageDataProvider)
|
shared = MessagingModuleConfiguration(context, storage, messageDataProvider)
|
||||||
|
@ -373,8 +373,8 @@ object OnionRequestAPI {
|
|||||||
}
|
}
|
||||||
val promise = deferred.promise
|
val promise = deferred.promise
|
||||||
promise.fail { exception ->
|
promise.fail { exception ->
|
||||||
val path = paths.firstOrNull { it.contains(guardSnode) }
|
if (exception is HTTP.HTTPRequestFailedException && SnodeModule.isInitialized) {
|
||||||
if (exception is HTTP.HTTPRequestFailedException) {
|
val path = paths.firstOrNull { it.contains(guardSnode) }
|
||||||
fun handleUnspecificError() {
|
fun handleUnspecificError() {
|
||||||
if (path == null) { return }
|
if (path == null) { return }
|
||||||
var pathFailureCount = OnionRequestAPI.pathFailureCount[path] ?: 0
|
var pathFailureCount = OnionRequestAPI.pathFailureCount[path] ?: 0
|
||||||
|
@ -8,8 +8,10 @@ class SnodeModule(val storage: LokiAPIDatabaseProtocol, val broadcaster: Broadca
|
|||||||
companion object {
|
companion object {
|
||||||
lateinit var shared: SnodeModule
|
lateinit var shared: SnodeModule
|
||||||
|
|
||||||
|
val isInitialized: Boolean get() = Companion::shared.isInitialized
|
||||||
|
|
||||||
fun configure(storage: LokiAPIDatabaseProtocol, broadcaster: Broadcaster) {
|
fun configure(storage: LokiAPIDatabaseProtocol, broadcaster: Broadcaster) {
|
||||||
if (Companion::shared.isInitialized) { return }
|
if (isInitialized) { return }
|
||||||
shared = SnodeModule(storage, broadcaster)
|
shared = SnodeModule(storage, broadcaster)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user