mirror of
https://github.com/oxen-io/session-android.git
synced 2025-12-30 15:46:30 +00:00
feat: notify updates for closed group info polling to set recipient name
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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>()
|
||||
|
||||
|
||||
Submodule libsession-util/libsession-util updated: e21302b598...9a46cd6332
@@ -10,6 +10,7 @@ import network.loki.messenger.libsession_util.GroupInfoConfig
|
||||
import network.loki.messenger.libsession_util.GroupKeysConfig
|
||||
import network.loki.messenger.libsession_util.GroupMembersConfig
|
||||
import network.loki.messenger.libsession_util.util.GroupInfo
|
||||
import org.session.libsession.messaging.MessagingModuleConfiguration
|
||||
import org.session.libsession.messaging.jobs.BatchMessageReceiveJob
|
||||
import org.session.libsession.messaging.jobs.JobQueue
|
||||
import org.session.libsession.messaging.jobs.MessageReceiveParameters
|
||||
@@ -190,10 +191,14 @@ class ClosedGroupPoller(private val executor: CoroutineScope,
|
||||
|
||||
private fun handleInfo(response: RawResponse,
|
||||
infoConfig: GroupInfoConfig) {
|
||||
parseMessages(response).forEach { (message, hash, _) ->
|
||||
val messages = parseMessages(response)
|
||||
messages.forEach { (message, hash, _) ->
|
||||
infoConfig.merge(hash to message)
|
||||
if (ENABLE_LOGGING) Log.d("ClosedGroupPoller", "Merged $hash for info on ${closedGroupSessionId.hexString()}")
|
||||
}
|
||||
if (messages.isNotEmpty()) {
|
||||
MessagingModuleConfiguration.shared.storage.notifyConfigUpdates(infoConfig) // TODO: figure this out
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleMembers(response: RawResponse,
|
||||
|
||||
Reference in New Issue
Block a user