Code quality

This commit is contained in:
Valere 2021-03-16 09:36:56 +01:00
parent 0c5ca9f51b
commit 48fef45ce3
3 changed files with 13 additions and 21 deletions

View File

@ -205,20 +205,14 @@ class RealmSessionStoreMigration @Inject constructor() : RealmMigration {
?.addField(SpaceChildSummaryEntityFields.AUTO_JOIN, Boolean::class.java)
?.setNullable(SpaceChildSummaryEntityFields.AUTO_JOIN, true)
?.addRealmObjectField(SpaceChildSummaryEntityFields.CHILD_SUMMARY_ENTITY.`$`, realm.schema.get("RoomSummaryEntity")!!)
// realm.schema.create("SpaceSummaryEntity")
// ?.addField(SpaceSummaryEntityFields.SPACE_ID, String::class.java, FieldAttribute.PRIMARY_KEY)
// ?.setRequired(SpaceSummaryEntityFields.SPACE_ID, true)
// ?.addRealmObjectField(SpaceSummaryEntityFields.ROOM_SUMMARY_ENTITY.`$`, realm.schema.get("RoomSummaryEntity")!!)
// ?.addRealmListField(SpaceSummaryEntityFields.CHILDREN.`$`, spaceChildInfoSchema!!)
?.addRealmListField(SpaceChildSummaryEntityFields.VIA_SERVERS.`$`, String::class.java)
realm.schema.create("SpaceParentSummaryEntity")
?.addField(SpaceParentSummaryEntityFields.PARENT_ROOM_ID, String::class.java)
?.addField(SpaceParentSummaryEntityFields.CANONICAL, Boolean::class.java)
?.setNullable(SpaceParentSummaryEntityFields.CANONICAL, true)
// ?.addRealmListField(RoomParentRelationInfoEntityFields.VIA_SERVERS.`$`, String::class.java)
// ?.addRealmObjectField(RoomParentRelationInfoEntityFields.SPACE_SUMMARY_ENTITY.`$`, realm.schema.get("SpaceSummaryEntity")!!)
?.addRealmObjectField(SpaceParentSummaryEntityFields.PARENT_SUMMARY_ENTITY.`$`, realm.schema.get("RoomSummaryEntity")!!)
?.addRealmListField(SpaceParentSummaryEntityFields.VIA_SERVERS.`$`, String::class.java)
realm.schema.get("RoomSummaryEntity")
?.addField(RoomSummaryEntityFields.ROOM_TYPE, String::class.java)

View File

@ -274,14 +274,13 @@ internal class RoomSummaryDataSource @Inject constructor(@SessionDatabase privat
}
fun getFlattenOrphanRooms(): List<RoomSummary> {
return getRoomSummaries(roomSummaryQueryParams {
return getRoomSummaries(
roomSummaryQueryParams {
memberships = Membership.activeMemberships()
excludeType = listOf(RoomType.SPACE)
roomCategoryFilter = RoomCategoryFilter.ONLY_ROOMS
}).filter {
// we need to check if orphan
isOrphan(it)
}
).filter { isOrphan(it) }
}
fun getFlattenOrphanRoomsLive(): LiveData<List<RoomSummary>> {
@ -290,10 +289,9 @@ internal class RoomSummaryDataSource @Inject constructor(@SessionDatabase privat
memberships = Membership.activeMemberships()
excludeType = listOf(RoomType.SPACE)
roomCategoryFilter = RoomCategoryFilter.ONLY_ROOMS
})) {
it.filter {
isOrphan(it)
}
})
) {
it.filter { isOrphan(it) }
}
}

View File

@ -161,7 +161,7 @@ Formatter\.formatShortFileSize===1
# android\.text\.TextUtils
### This is not a rule, but a warning: the number of "enum class" has changed. For Json classes, it is mandatory that they have `@JsonClass(generateAdapter = false)`. If the enum is not used as a Json class, change the value in file forbidden_strings_in_code.txt
enum class===94
enum class===97
### Do not import temporary legacy classes
import org.matrix.android.sdk.internal.legacy.riot===3