From d2a4f12c29cc51c8ffdbaa09ff7eea7d406df3e1 Mon Sep 17 00:00:00 2001 From: SessionHero01 <180888785+SessionHero01@users.noreply.github.com> Date: Mon, 7 Oct 2024 15:05:43 +1100 Subject: [PATCH] Config uploader --- .../org/thoughtcrime/securesms/ApplicationContext.java | 8 ++++---- .../{ConfigSyncHandler.kt => ConfigUploader.kt} | 10 ++-------- 2 files changed, 6 insertions(+), 12 deletions(-) rename libsession/src/main/java/org/session/libsession/messaging/configs/{ConfigSyncHandler.kt => ConfigUploader.kt} (96%) diff --git a/app/src/main/java/org/thoughtcrime/securesms/ApplicationContext.java b/app/src/main/java/org/thoughtcrime/securesms/ApplicationContext.java index 20e6149790..811ca8114e 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/ApplicationContext.java +++ b/app/src/main/java/org/thoughtcrime/securesms/ApplicationContext.java @@ -41,7 +41,7 @@ import com.squareup.phrase.Phrase; import org.conscrypt.Conscrypt; import org.session.libsession.database.MessageDataProvider; import org.session.libsession.messaging.MessagingModuleConfiguration; -import org.session.libsession.messaging.configs.ConfigSyncHandler; +import org.session.libsession.messaging.configs.ConfigUploader; import org.session.libsession.messaging.groups.GroupManagerV2; import org.session.libsession.messaging.groups.RemoveGroupMemberHandler; import org.session.libsession.messaging.notifications.TokenFetcher; @@ -50,7 +50,6 @@ import org.session.libsession.messaging.sending_receiving.pollers.LegacyClosedGr import org.session.libsession.messaging.sending_receiving.pollers.Poller; import org.session.libsession.snode.SnodeClock; import org.session.libsession.snode.SnodeModule; -import org.session.libsession.utilities.Address; import org.session.libsession.utilities.Device; import org.session.libsession.utilities.Environment; import org.session.libsession.utilities.ProfilePictureUtilities; @@ -161,7 +160,8 @@ public class ApplicationContext extends Application implements DefaultLifecycleO @Inject SSKEnvironment.ProfileManagerProtocol profileManager; CallMessageProcessor callMessageProcessor; MessagingModuleConfiguration messagingModuleConfiguration; - @Inject ConfigSyncHandler configSyncHandler; + @Inject + ConfigUploader configUploader; @Inject RemoveGroupMemberHandler removeGroupMemberHandler; @Inject SnodeClock snodeClock; @@ -268,7 +268,7 @@ public class ApplicationContext extends Application implements DefaultLifecycleO HTTP.INSTANCE.setConnectedToNetwork(networkConstraint::isMet); pushRegistrationHandler.run(); - configSyncHandler.start(); + configUploader.start(); removeGroupMemberHandler.start(); snodeClock.start(); diff --git a/libsession/src/main/java/org/session/libsession/messaging/configs/ConfigSyncHandler.kt b/libsession/src/main/java/org/session/libsession/messaging/configs/ConfigUploader.kt similarity index 96% rename from libsession/src/main/java/org/session/libsession/messaging/configs/ConfigSyncHandler.kt rename to libsession/src/main/java/org/session/libsession/messaging/configs/ConfigUploader.kt index c5c81c14af..a5f17ff3d8 100644 --- a/libsession/src/main/java/org/session/libsession/messaging/configs/ConfigSyncHandler.kt +++ b/libsession/src/main/java/org/session/libsession/messaging/configs/ConfigUploader.kt @@ -1,16 +1,11 @@ package org.session.libsession.messaging.configs -import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.DelicateCoroutinesApi -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.Job -import kotlinx.coroutines.asCoroutineDispatcher import kotlinx.coroutines.async import kotlinx.coroutines.awaitAll import kotlinx.coroutines.coroutineScope -import kotlinx.coroutines.flow.debounce import kotlinx.coroutines.launch import kotlinx.coroutines.sync.Mutex import kotlinx.coroutines.sync.withLock @@ -34,17 +29,16 @@ import org.session.libsignal.utilities.Log import org.session.libsignal.utilities.Namespace import org.session.libsignal.utilities.Snode import org.session.libsignal.utilities.retryWithUniformInterval -import java.util.concurrent.Executors import javax.inject.Inject -private const val TAG = "ConfigSyncHandler" +private const val TAG = "ConfigUploader" /** * This class is responsible for sending the local config changes to the swarm. * * It does so by listening for changes in the config factory. */ -class ConfigSyncHandler @Inject constructor( +class ConfigUploader @Inject constructor( private val configFactory: ConfigFactoryProtocol, private val storageProtocol: StorageProtocol, ) {