Config uploader

This commit is contained in:
SessionHero01 2024-10-07 15:05:43 +11:00
parent 80344f0ffd
commit d2a4f12c29
No known key found for this signature in database
2 changed files with 6 additions and 12 deletions

View File

@ -41,7 +41,7 @@ import com.squareup.phrase.Phrase;
import org.conscrypt.Conscrypt; import org.conscrypt.Conscrypt;
import org.session.libsession.database.MessageDataProvider; import org.session.libsession.database.MessageDataProvider;
import org.session.libsession.messaging.MessagingModuleConfiguration; 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.GroupManagerV2;
import org.session.libsession.messaging.groups.RemoveGroupMemberHandler; import org.session.libsession.messaging.groups.RemoveGroupMemberHandler;
import org.session.libsession.messaging.notifications.TokenFetcher; 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.messaging.sending_receiving.pollers.Poller;
import org.session.libsession.snode.SnodeClock; import org.session.libsession.snode.SnodeClock;
import org.session.libsession.snode.SnodeModule; import org.session.libsession.snode.SnodeModule;
import org.session.libsession.utilities.Address;
import org.session.libsession.utilities.Device; import org.session.libsession.utilities.Device;
import org.session.libsession.utilities.Environment; import org.session.libsession.utilities.Environment;
import org.session.libsession.utilities.ProfilePictureUtilities; import org.session.libsession.utilities.ProfilePictureUtilities;
@ -161,7 +160,8 @@ public class ApplicationContext extends Application implements DefaultLifecycleO
@Inject SSKEnvironment.ProfileManagerProtocol profileManager; @Inject SSKEnvironment.ProfileManagerProtocol profileManager;
CallMessageProcessor callMessageProcessor; CallMessageProcessor callMessageProcessor;
MessagingModuleConfiguration messagingModuleConfiguration; MessagingModuleConfiguration messagingModuleConfiguration;
@Inject ConfigSyncHandler configSyncHandler; @Inject
ConfigUploader configUploader;
@Inject RemoveGroupMemberHandler removeGroupMemberHandler; @Inject RemoveGroupMemberHandler removeGroupMemberHandler;
@Inject SnodeClock snodeClock; @Inject SnodeClock snodeClock;
@ -268,7 +268,7 @@ public class ApplicationContext extends Application implements DefaultLifecycleO
HTTP.INSTANCE.setConnectedToNetwork(networkConstraint::isMet); HTTP.INSTANCE.setConnectedToNetwork(networkConstraint::isMet);
pushRegistrationHandler.run(); pushRegistrationHandler.run();
configSyncHandler.start(); configUploader.start();
removeGroupMemberHandler.start(); removeGroupMemberHandler.start();
snodeClock.start(); snodeClock.start();

View File

@ -1,16 +1,11 @@
package org.session.libsession.messaging.configs package org.session.libsession.messaging.configs
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.DelicateCoroutinesApi import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.Job import kotlinx.coroutines.Job
import kotlinx.coroutines.asCoroutineDispatcher
import kotlinx.coroutines.async import kotlinx.coroutines.async
import kotlinx.coroutines.awaitAll import kotlinx.coroutines.awaitAll
import kotlinx.coroutines.coroutineScope import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.flow.debounce
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.sync.Mutex import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock 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.Namespace
import org.session.libsignal.utilities.Snode import org.session.libsignal.utilities.Snode
import org.session.libsignal.utilities.retryWithUniformInterval import org.session.libsignal.utilities.retryWithUniformInterval
import java.util.concurrent.Executors
import javax.inject.Inject 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. * This class is responsible for sending the local config changes to the swarm.
* *
* It does so by listening for changes in the config factory. * 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 configFactory: ConfigFactoryProtocol,
private val storageProtocol: StorageProtocol, private val storageProtocol: StorageProtocol,
) { ) {