mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-28 20:45:17 +00:00
fix: open group sync persistence
This commit is contained in:
parent
61e8935725
commit
2af0cc7bb2
@ -104,7 +104,7 @@ object OpenGroupManager {
|
||||
val storage = MessagingModuleConfiguration.shared.storage
|
||||
val configFactory = MessagingModuleConfiguration.shared.configFactory
|
||||
val threadDB = DatabaseComponent.get(context).threadDatabase()
|
||||
val openGroupID = "$server.$room"
|
||||
val openGroupID = "${server.removeSuffix("/")}.$room"
|
||||
val threadID = GroupManager.getOpenGroupThreadID(openGroupID, context)
|
||||
val recipient = threadDB.getRecipientForThreadId(threadID) ?: return
|
||||
threadDB.setThreadArchived(threadID)
|
||||
|
@ -74,10 +74,12 @@ object ConfigurationMessageUtilities {
|
||||
if (ConfigBase.isNewConfigEnabled) {
|
||||
// schedule job if none exist
|
||||
// don't schedule job if we already have one
|
||||
Log.d("Loki-DBG", "Forcing config sync")
|
||||
val ourDestination = Destination.Contact(userPublicKey)
|
||||
val currentStorageJob = storage.getConfigSyncJob(ourDestination)
|
||||
if (currentStorageJob != null) {
|
||||
(currentStorageJob as ConfigurationSyncJob).shouldRunAgain.set(true)
|
||||
Log.d("Loki-DBG", "Not scheduling another one")
|
||||
return Promise.ofFail(NullPointerException("A job is already pending or in progress, don't schedule another job"))
|
||||
}
|
||||
val newConfigSync = ConfigurationSyncJob(ourDestination)
|
||||
|
@ -18,7 +18,12 @@ class GroupAvatarDownloadJob(val server: String, val room: String, val imageId:
|
||||
return
|
||||
}
|
||||
val storage = MessagingModuleConfiguration.shared.storage
|
||||
val storedImageId = storage.getOpenGroup(room, server)?.imageId
|
||||
val openGroup = storage.getOpenGroup(room, server)
|
||||
if (openGroup == null) {
|
||||
delegate?.handleJobFailedPermanently(this, dispatcherName, Exception("GroupAvatarDownloadJob openGroup is null"))
|
||||
return
|
||||
}
|
||||
val storedImageId = openGroup.imageId
|
||||
|
||||
if (storedImageId == null || storedImageId != imageId) {
|
||||
delegate?.handleJobFailedPermanently(this, dispatcherName, Exception("GroupAvatarDownloadJob imageId does not match the OpenGroup"))
|
||||
|
Loading…
Reference in New Issue
Block a user