mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-23 01:45:52 +03:00
Rename getLocalUserAccount to getLocalDirectMessages
This commit is contained in:
parent
00911a7f7e
commit
6d47fdf3d3
4 changed files with 5 additions and 4 deletions
|
@ -123,7 +123,7 @@ internal class DefaultCreateRoomTask @Inject constructor(
|
||||||
this.isDirect = true
|
this.isDirect = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val directChats = directChatsHelper.getLocalUserAccount()
|
val directChats = directChatsHelper.getLocalDirectMessages()
|
||||||
updateUserAccountDataTask.execute(UpdateUserAccountDataTask.DirectChatParams(directMessages = directChats))
|
updateUserAccountDataTask.execute(UpdateUserAccountDataTask.DirectChatParams(directMessages = directChats))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ internal class UserAccountDataSyncHandler @Inject constructor(
|
||||||
// If we get some direct chat invites, we synchronize the user account data including those.
|
// If we get some direct chat invites, we synchronize the user account data including those.
|
||||||
suspend fun synchronizeWithServerIfNeeded(invites: Map<String, InvitedRoomSync>) {
|
suspend fun synchronizeWithServerIfNeeded(invites: Map<String, InvitedRoomSync>) {
|
||||||
if (invites.isNullOrEmpty()) return
|
if (invites.isNullOrEmpty()) return
|
||||||
val directChats = directChatsHelper.getLocalUserAccount()
|
val directChats = directChatsHelper.getLocalDirectMessages()
|
||||||
var hasUpdate = false
|
var hasUpdate = false
|
||||||
monarchy.doWithRealm { realm ->
|
monarchy.doWithRealm { realm ->
|
||||||
invites.forEach { (roomId, _) ->
|
invites.forEach { (roomId, _) ->
|
||||||
|
|
|
@ -19,4 +19,4 @@ package org.matrix.android.sdk.internal.session.sync.model.accountdata
|
||||||
/**
|
/**
|
||||||
* Keys are userIds, values are list of roomIds
|
* Keys are userIds, values are list of roomIds
|
||||||
*/
|
*/
|
||||||
internal typealias DirectMessagesContent = Map<String, List<String>>
|
internal typealias DirectMessagesContent = MutableMap<String, MutableList<String>>
|
||||||
|
|
|
@ -21,6 +21,7 @@ import org.matrix.android.sdk.internal.database.query.getDirectRooms
|
||||||
import org.matrix.android.sdk.internal.di.SessionDatabase
|
import org.matrix.android.sdk.internal.di.SessionDatabase
|
||||||
import io.realm.Realm
|
import io.realm.Realm
|
||||||
import io.realm.RealmConfiguration
|
import io.realm.RealmConfiguration
|
||||||
|
import org.matrix.android.sdk.internal.session.sync.model.accountdata.DirectMessagesContent
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
internal class DirectChatsHelper @Inject constructor(@SessionDatabase
|
internal class DirectChatsHelper @Inject constructor(@SessionDatabase
|
||||||
|
@ -29,7 +30,7 @@ internal class DirectChatsHelper @Inject constructor(@SessionDatabase
|
||||||
/**
|
/**
|
||||||
* @return a map of userId <-> list of roomId
|
* @return a map of userId <-> list of roomId
|
||||||
*/
|
*/
|
||||||
fun getLocalUserAccount(filterRoomId: String? = null): MutableMap<String, MutableList<String>> {
|
fun getLocalDirectMessages(filterRoomId: String? = null): DirectMessagesContent {
|
||||||
return Realm.getInstance(realmConfiguration).use { realm ->
|
return Realm.getInstance(realmConfiguration).use { realm ->
|
||||||
// Makes sure we have the latest realm updates, this is important as we sent this information to the server.
|
// Makes sure we have the latest realm updates, this is important as we sent this information to the server.
|
||||||
realm.refresh()
|
realm.refresh()
|
||||||
|
|
Loading…
Reference in a new issue