feat: fix group persist and select contact list search for lowercase on name and query

This commit is contained in:
0x330a 2023-11-06 12:16:20 +11:00
parent 5a2fdb0e83
commit 0eadfeaaca
No known key found for this signature in database
GPG Key ID: 267811D6E6A2698C
6 changed files with 11 additions and 8 deletions

View File

@ -316,7 +316,7 @@ class ConfigFactory(
)
}
override fun persist(forConfigObject: Config, timestamp: Long) {
override fun persist(forConfigObject: Config, timestamp: Long, forPublicKey: String?) {
try {
listeners.forEach { listener ->
listener.notifyUpdates(forConfigObject)
@ -326,6 +326,8 @@ class ConfigFactory(
is Contacts -> persistContactsConfigDump(timestamp)
is ConversationVolatileConfig -> persistConvoVolatileConfigDump(timestamp)
is UserGroupsConfig -> persistUserGroupsConfigDump(timestamp)
is GroupMembersConfig -> persistGroupConfigDump(forConfigObject, SessionId.from(forPublicKey!!), timestamp)
is GroupInfoConfig -> persistGroupConfigDump(forConfigObject, SessionId.from(forPublicKey!!), timestamp)
else -> throw UnsupportedOperationException("Can't support type of ${forConfigObject::class.simpleName} yet")
}
} catch (e: Exception) {

View File

@ -146,7 +146,6 @@ fun CreateGroup(
}
}
}
}
}
// Group list
@ -182,7 +181,8 @@ fun CreateGroup(
.fillMaxSize()
.background(Color.Gray.copy(alpha = 0.5f))) {
CircularProgressIndicator(
modifier = Modifier.align(Alignment.Center)
modifier = Modifier.align(Alignment.Center),
color = MaterialTheme.colors.secondary
)
}
}

View File

@ -41,7 +41,7 @@ fun SelectContacts(
contactListState
.filter { contact ->
contact.getSearchName().lowercase()
.contains(queryFilter)
.contains(queryFilter.lowercase())
}
.toList()
}

View File

@ -252,8 +252,9 @@ data class ConfigurationSyncJob(val destination: Destination) : Job {
"Successfully removed the deleted hashes from ${config.javaClass.simpleName}"
)
// dump and write config after successful
if (config is ConfigBase && config.needsDump()) { // usually this will be true?
configFactory.persist(config, (message.params["timestamp"] as String).toLong())
if (config is ConfigBase && config.needsDump()) { // usually this will be true? ))
val groupPubKey = if (destination is Destination.ClosedGroup) destination.publicKey else null
configFactory.persist(config, (message.params["timestamp"] as String).toLong(), groupPubKey)
} else if (config is GroupKeysConfig && config.needsDump()) {
Log.d("Loki", "Should persist the GroupKeysConfig")
}

View File

@ -59,7 +59,7 @@ class ClosedGroupPoller(private val scope: CoroutineScope,
companion object {
const val POLL_INTERVAL = 3_000L
const val ENABLE_LOGGING = true
const val ENABLE_LOGGING = false
}
private var isRunning: Boolean = false

View File

@ -26,7 +26,7 @@ interface ConfigFactoryProtocol {
free: Boolean = true): GroupKeysConfig?
fun getUserConfigs(): List<ConfigBase>
fun persist(forConfigObject: Config, timestamp: Long)
fun persist(forConfigObject: Config, timestamp: Long, forPublicKey: String? = null)
fun conversationInConfig(publicKey: String?, groupPublicKey: String?, openGroupId: String?, visibleOnly: Boolean): Boolean
fun canPerformChange(variant: String, publicKey: String, changeTimestampMs: Long): Boolean