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

View file

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

View file

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

View file

@ -60,10 +60,6 @@ class HomeActivityViewModel(state: EmptyState,
init { init {
session.addListener(this) 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() val lastSelectedRoomId = roomSelectionRepository.lastSelectedRoom()
if (lastSelectedRoomId == null || session.getRoom(lastSelectedRoomId) == null) { if (lastSelectedRoomId == null || session.getRoom(lastSelectedRoomId) == null) {
getTheFirstRoomWhenAvailable() getTheFirstRoomWhenAvailable()