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
import dagger.Lazy
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.plus
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.libsignal.utilities.AccountId
import java.util.concurrent.ConcurrentHashMap
class PollerFactory(private val scope: CoroutineScope,
private val executor: CoroutineDispatcher,
private val configFactory: ConfigFactory) {
class PollerFactory(
private val scope: CoroutineScope,
private val executor: CoroutineDispatcher,
private val configFactory: ConfigFactory,
private val groupManagerV2: Lazy<GroupManagerV2>,
) {
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
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
import android.content.Context
import dagger.Lazy
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
@ -11,6 +12,7 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.GlobalScope
import org.session.libsession.messaging.groups.GroupManagerV2
import org.session.libsession.utilities.ConfigFactoryUpdateListener
import org.session.libsession.utilities.TextSecurePreferences
import org.thoughtcrime.securesms.crypto.KeyPairUtilities
@ -54,6 +56,7 @@ object SessionUtilModule {
@Singleton
fun providePollerFactory(@Named(POLLER_SCOPE) coroutineScope: CoroutineScope,
@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() {
val newName = mutableEditingName.value
if (newName != null) {
storage.setName(groupSessionId, newName.trim())
mutableEditingName.value = null
performGroupOperation {
if (!newName.isNullOrBlank()) {
groupManager.setName(AccountId(groupSessionId), newName)
mutableEditingName.value = null
}
}
}