feat: notify updates for closed group info polling to set recipient name

This commit is contained in:
0x330a
2023-09-14 17:11:56 +10:00
parent 51c3020049
commit 915fa5bc2b
4 changed files with 13 additions and 4 deletions

View File

@@ -478,7 +478,7 @@ open class Storage(
return configFactory.user?.getCommunityMessageRequests() == true
}
fun notifyUpdates(forConfigObject: ConfigBase) {
private fun notifyUpdates(forConfigObject: ConfigBase) {
when (forConfigObject) {
is UserProfile -> updateUser(forConfigObject)
is Contacts -> updateContacts(forConfigObject)
@@ -525,6 +525,9 @@ open class Storage(
private fun updateGroupInfo(groupInfoConfig: GroupInfoConfig) {
val threadId = getOrCreateThreadIdFor(Address.fromSerialized(groupInfoConfig.id().hexString()))
val recipient = getRecipientForThread(threadId) ?: return
val db = DatabaseComponent.get(context).recipientDatabase()
db.setProfileName(recipient, groupInfoConfig.getName())
// TODO: handle deleted group, handle delete attachment / message before a certain time
}

View File

@@ -7,7 +7,8 @@ import org.session.libsession.messaging.sending_receiving.pollers.ClosedGroupPol
import org.session.libsignal.utilities.SessionId
import java.util.concurrent.ConcurrentHashMap
class PollerFactory(private val scope: CoroutineScope, private val configFactory: ConfigFactory) {
class PollerFactory(private val scope: CoroutineScope,
private val configFactory: ConfigFactory) {
private val pollers = ConcurrentHashMap<SessionId, ClosedGroupPoller>()