Hot fix LL not working

This commit is contained in:
ganfra 2019-05-15 11:11:38 +02:00
parent 8929898397
commit 8d0322c0c3
4 changed files with 4 additions and 13 deletions

View File

@ -21,6 +21,7 @@ import androidx.lifecycle.ProcessLifecycleOwner
import com.zhuinden.monarchy.Monarchy
import im.vector.matrix.android.api.auth.Authenticator
import im.vector.matrix.android.api.session.Session
import im.vector.matrix.android.api.session.sync.FilterService
import im.vector.matrix.android.internal.auth.AuthModule
import im.vector.matrix.android.internal.di.MatrixKoinComponent
import im.vector.matrix.android.internal.di.MatrixKoinHolder
@ -53,6 +54,7 @@ class Matrix private constructor(context: Context) : MatrixKoinComponent {
authenticator.getLastActiveSession()?.also {
currentSession = it
it.open()
it.setFilter(FilterService.FilterPreset.RiotFilter)
it.startSync()
}
}

View File

@ -27,7 +27,6 @@ import io.realm.kotlin.where
*/
internal fun FilterEntity.Companion.getFilter(realm: Realm): FilterEntity {
var filter = realm.where<FilterEntity>().findFirst()
if (filter == null) {
realm.executeTransaction {
realm.createObject<FilterEntity>().apply {
@ -36,7 +35,6 @@ internal fun FilterEntity.Companion.getFilter(realm: Realm): FilterEntity {
filterId = ""
}
}
filter = realm.where<FilterEntity>().findFirst()!!
}

View File

@ -23,19 +23,15 @@ internal object FilterFactory {
fun createDefaultFilterBody(): FilterBody {
val filterBody = FilterBody()
FilterUtil.enableLazyLoading(filterBody, true)
return filterBody
}
fun createRiotFilterBody(): FilterBody {
val filterBody = FilterBody()
filterBody.room = RoomFilter().apply {
timeline = createRiotTimelineFilter()
// TODO Enable this for optimization
// state = createRiotStateFilter()
state = createRiotStateFilter()
}
return filterBody
}
@ -55,7 +51,6 @@ internal object FilterFactory {
private fun createRiotTimelineFilter(): RoomEventFilter {
return RoomEventFilter().apply {
lazyLoadMembers = true
// TODO Enable this for optimization
// types = listOfSupportedEventTypes.toMutableList()
}
@ -63,7 +58,7 @@ internal object FilterFactory {
private fun createRiotStateFilter(): RoomEventFilter {
return RoomEventFilter().apply {
types = listOfSupportedStateEventTypes.toMutableList()
lazyLoadMembers = true
}
}

View File

@ -60,10 +60,6 @@ class HomeActivityViewModel(state: EmptyState,
init {
session.addListener(this)
// TODO Move this else where, it's too late when we are here to change the filter
session.setFilter(FilterService.FilterPreset.RiotFilter)
val lastSelectedRoomId = roomSelectionRepository.lastSelectedRoom()
if (lastSelectedRoomId == null || session.getRoom(lastSelectedRoomId) == null) {
getTheFirstRoomWhenAvailable()