Fixed compilation errors

This commit is contained in:
SessionHero01 2024-09-24 16:34:33 +10:00
parent 8c1eb1550b
commit 5c380bdbdf
No known key found for this signature in database
3 changed files with 19 additions and 8 deletions

View File

@ -1,17 +1,22 @@
package org.thoughtcrime.securesms.dependencies package org.thoughtcrime.securesms.dependencies
import dagger.Lazy
import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.SupervisorJob import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.plus import kotlinx.coroutines.plus
import network.loki.messenger.libsession_util.util.GroupInfo import network.loki.messenger.libsession_util.util.GroupInfo
import org.session.libsession.messaging.groups.GroupManagerV2
import org.session.libsession.messaging.sending_receiving.pollers.ClosedGroupPoller import org.session.libsession.messaging.sending_receiving.pollers.ClosedGroupPoller
import org.session.libsignal.utilities.AccountId import org.session.libsignal.utilities.AccountId
import java.util.concurrent.ConcurrentHashMap import java.util.concurrent.ConcurrentHashMap
class PollerFactory(private val scope: CoroutineScope, class PollerFactory(
private val executor: CoroutineDispatcher, private val scope: CoroutineScope,
private val configFactory: ConfigFactory) { private val executor: CoroutineDispatcher,
private val configFactory: ConfigFactory,
private val groupManagerV2: Lazy<GroupManagerV2>,
) {
private val pollers = ConcurrentHashMap<AccountId, ClosedGroupPoller>() private val pollers = ConcurrentHashMap<AccountId, ClosedGroupPoller>()
@ -20,7 +25,7 @@ class PollerFactory(private val scope: CoroutineScope,
if (configFactory.userGroups?.getClosedGroup(sessionId.hexString)?.invited != false) return null if (configFactory.userGroups?.getClosedGroup(sessionId.hexString)?.invited != false) return null
return pollers.getOrPut(sessionId) { return pollers.getOrPut(sessionId) {
ClosedGroupPoller(scope + SupervisorJob(), executor, sessionId, configFactory) ClosedGroupPoller(scope + SupervisorJob(), executor, sessionId, configFactory, groupManagerV2.get())
} }
} }

View File

@ -1,6 +1,7 @@
package org.thoughtcrime.securesms.dependencies package org.thoughtcrime.securesms.dependencies
import android.content.Context import android.content.Context
import dagger.Lazy
import dagger.Module import dagger.Module
import dagger.Provides import dagger.Provides
import dagger.hilt.InstallIn import dagger.hilt.InstallIn
@ -11,6 +12,7 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.GlobalScope
import org.session.libsession.messaging.groups.GroupManagerV2
import org.session.libsession.utilities.ConfigFactoryUpdateListener import org.session.libsession.utilities.ConfigFactoryUpdateListener
import org.session.libsession.utilities.TextSecurePreferences import org.session.libsession.utilities.TextSecurePreferences
import org.thoughtcrime.securesms.crypto.KeyPairUtilities import org.thoughtcrime.securesms.crypto.KeyPairUtilities
@ -54,6 +56,7 @@ object SessionUtilModule {
@Singleton @Singleton
fun providePollerFactory(@Named(POLLER_SCOPE) coroutineScope: CoroutineScope, fun providePollerFactory(@Named(POLLER_SCOPE) coroutineScope: CoroutineScope,
@Named(POLLER_SCOPE) dispatcher: CoroutineDispatcher, @Named(POLLER_SCOPE) dispatcher: CoroutineDispatcher,
configFactory: ConfigFactory) = PollerFactory(coroutineScope, dispatcher, configFactory) configFactory: ConfigFactory,
groupManagerV2: Lazy<GroupManagerV2>) = PollerFactory(coroutineScope, dispatcher, configFactory, groupManagerV2)
} }

View File

@ -218,9 +218,12 @@ class EditGroupViewModel @AssistedInject constructor(
fun onEditNameConfirmClicked() { fun onEditNameConfirmClicked() {
val newName = mutableEditingName.value val newName = mutableEditingName.value
if (newName != null) {
storage.setName(groupSessionId, newName.trim()) performGroupOperation {
mutableEditingName.value = null if (!newName.isNullOrBlank()) {
groupManager.setName(AccountId(groupSessionId), newName)
mutableEditingName.value = null
}
} }
} }