feat: implement the default user config list

This commit is contained in:
0x330a 2023-03-06 17:19:39 +11:00
parent 8d8325f16e
commit c0a6137818
No known key found for this signature in database
GPG Key ID: 267811D6E6A2698C

View File

@ -11,7 +11,6 @@ import org.session.libsession.utilities.ConfigFactoryUpdateListener
import org.session.libsignal.protos.SignalServiceProtos.SharedConfigMessage import org.session.libsignal.protos.SignalServiceProtos.SharedConfigMessage
import org.thoughtcrime.securesms.database.ConfigDatabase import org.thoughtcrime.securesms.database.ConfigDatabase
import org.thoughtcrime.securesms.util.ConfigurationMessageUtilities import org.thoughtcrime.securesms.util.ConfigurationMessageUtilities
import java.util.concurrent.ConcurrentSkipListSet
class ConfigFactory(private val context: Context, class ConfigFactory(private val context: Context,
private val configDatabase: ConfigDatabase, private val configDatabase: ConfigDatabase,
@ -29,10 +28,8 @@ class ConfigFactory(private val context: Context,
private val userLock = Object() private val userLock = Object()
private var _userConfig: UserProfile? = null private var _userConfig: UserProfile? = null
private val userHashes = ConcurrentSkipListSet<String>()
private val contactsLock = Object() private val contactsLock = Object()
private var _contacts: Contacts? = null private var _contacts: Contacts? = null
private val contactsHashes = ConcurrentSkipListSet<String>()
private val convoVolatileLock = Object() private val convoVolatileLock = Object()
private var _convoVolatileConfig: ConversationVolatileConfig? = null private var _convoVolatileConfig: ConversationVolatileConfig? = null
private val userGroupsLock = Object() private val userGroupsLock = Object()
@ -102,6 +99,8 @@ class ConfigFactory(private val context: Context,
_userGroups _userGroups
} }
override fun getUserConfigs(): List<ConfigBase> = listOfNotNull(user, contacts, convoVolatile, userGroups)
private fun persistUserConfigDump() = synchronized(userLock) { private fun persistUserConfigDump() = synchronized(userLock) {
val dumped = user?.dump() ?: return val dumped = user?.dump() ?: return