Run ./gradlew ktlintFormat
This commit is contained in:
parent
5b58f6cfe5
commit
27bbd18a74
@ -16,7 +16,6 @@
|
||||
|
||||
package org.matrix.android.sdk.api.session.room.timeline
|
||||
|
||||
import io.realm.kotlin.types.ObjectId
|
||||
import org.matrix.android.sdk.BuildConfig
|
||||
import org.matrix.android.sdk.api.extensions.orFalse
|
||||
import org.matrix.android.sdk.api.session.events.model.Event
|
||||
|
@ -20,12 +20,10 @@ import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.flatMapConcat
|
||||
import kotlinx.coroutines.flow.flow
|
||||
import kotlinx.coroutines.flow.flowOf
|
||||
import kotlinx.coroutines.flow.map
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import kotlinx.coroutines.withContext
|
||||
import org.matrix.android.sdk.R
|
||||
import org.matrix.android.sdk.api.util.Optional
|
||||
import org.matrix.android.sdk.internal.database.pagedlist.RealmTiledDataSource
|
||||
|
||||
|
@ -21,7 +21,6 @@ import kotlinx.coroutines.CoroutineDispatcher
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.SupervisorJob
|
||||
import kotlinx.coroutines.cancelChildren
|
||||
import org.matrix.android.sdk.api.MatrixCoroutineDispatchers
|
||||
import org.matrix.android.sdk.api.session.Session
|
||||
import org.matrix.android.sdk.api.session.SessionLifecycleObserver
|
||||
|
||||
|
@ -83,7 +83,7 @@ internal class EventEntity : RealmObject {
|
||||
companion object
|
||||
|
||||
fun setDecryptionResult(result: MXEventDecryptionResult) {
|
||||
//assertIsManaged()
|
||||
// assertIsManaged()
|
||||
val decryptionResult = OlmDecryptionResult(
|
||||
payload = result.clearEvent,
|
||||
senderKey = result.senderCurve25519Key,
|
||||
|
@ -42,4 +42,3 @@ internal fun MutableRealm.deleteOnCascade(pushRulesEntity: PushRulesEntity) {
|
||||
pushRulesEntity.pushRules.clearWith { deleteOnCascade(it) }
|
||||
delete(pushRulesEntity)
|
||||
}
|
||||
|
||||
|
@ -55,8 +55,7 @@ internal class PusherEntity : RealmObject {
|
||||
companion object
|
||||
}
|
||||
|
||||
internal fun MutableRealm.deleteOnCascade(pusherEntity: PusherEntity){
|
||||
internal fun MutableRealm.deleteOnCascade(pusherEntity: PusherEntity) {
|
||||
pusherEntity.data?.also { delete(it) }
|
||||
delete(pusherEntity)
|
||||
}
|
||||
|
||||
|
@ -37,4 +37,3 @@ internal fun HomeServerCapabilitiesEntity.Companion.getOrCreate(realm: MutableRe
|
||||
internal fun HomeServerCapabilitiesEntity.Companion.create(realm: MutableRealm): HomeServerCapabilitiesEntity {
|
||||
return realm.copyToRealm(HomeServerCapabilitiesEntity())
|
||||
}
|
||||
|
||||
|
@ -41,4 +41,3 @@ internal fun PushRulesEntity.Companion.where(
|
||||
.query("scope == $0", scope)
|
||||
.query("kindStr == $0", kind.name)
|
||||
}
|
||||
|
||||
|
@ -36,4 +36,3 @@ internal fun ReadMarkerEntity.Companion.create(realm: MutableRealm, roomId: Stri
|
||||
}
|
||||
return realm.copyToRealm(readMarkerEntity)
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,6 @@ package org.matrix.android.sdk.internal.database.query
|
||||
import io.realm.kotlin.MutableRealm
|
||||
import io.realm.kotlin.TypedRealm
|
||||
import io.realm.kotlin.query.RealmQuery
|
||||
import io.realm.kotlin.types.RealmList
|
||||
import org.matrix.android.sdk.internal.database.model.threads.ThreadSummaryEntity
|
||||
|
||||
internal fun ThreadSummaryEntity.Companion.where(realm: TypedRealm, roomId: String): RealmQuery<ThreadSummaryEntity> {
|
||||
|
@ -87,7 +87,6 @@ internal fun TimelineEventEntity.Companion.latestEvent(
|
||||
includesSending: Boolean,
|
||||
filters: TimelineEventFilters = TimelineEventFilters()
|
||||
): TimelineEventEntity? {
|
||||
|
||||
val roomEntity = RoomEntity.where(realm, roomId).first().find() ?: return null
|
||||
val sendingTimelineEvents = roomEntity.sendingTimelineEvents
|
||||
val liveEvents = ChunkEntity.findLastForwardChunkOfRoom(realm, roomId)?.timelineEvents.orEmpty()
|
||||
|
@ -57,4 +57,3 @@ internal class QueryStringValueProcessor @Inject constructor(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -252,7 +252,6 @@ internal class IntegrationManager @Inject constructor(
|
||||
}
|
||||
|
||||
private fun observeWellknownConfig() {
|
||||
|
||||
fun mapConfig(entity: WellknownIntegrationManagerConfigEntity): IntegrationManagerConfig {
|
||||
return IntegrationManagerConfig(entity.uiUrl, entity.apiUrl, IntegrationManagerConfig.Kind.HOMESERVER)
|
||||
}
|
||||
|
@ -156,7 +156,6 @@ internal class DefaultPushRuleService @Inject constructor(
|
||||
}
|
||||
|
||||
override fun getKeywords(): LiveData<Set<String>> {
|
||||
|
||||
fun map(pushRulesEntity: PushRulesEntity): List<String> {
|
||||
return pushRulesEntity.pushRules
|
||||
.map(PushRuleEntity::ruleId)
|
||||
|
@ -22,12 +22,10 @@ import androidx.lifecycle.Transformations
|
||||
import androidx.lifecycle.asLiveData
|
||||
import io.realm.kotlin.TypedRealm
|
||||
import io.realm.kotlin.query.RealmQuery
|
||||
import kotlinx.coroutines.flow.map
|
||||
import org.matrix.android.sdk.api.session.room.accountdata.RoomAccountDataEvent
|
||||
import org.matrix.android.sdk.api.util.Optional
|
||||
import org.matrix.android.sdk.api.util.toOptional
|
||||
import org.matrix.android.sdk.internal.database.RealmInstance
|
||||
import org.matrix.android.sdk.internal.database.RealmObjectMapper
|
||||
import org.matrix.android.sdk.internal.database.andIf
|
||||
import org.matrix.android.sdk.internal.database.mapper.AccountDataMapper
|
||||
import org.matrix.android.sdk.internal.database.model.RoomEntity
|
||||
|
@ -17,7 +17,6 @@
|
||||
package org.matrix.android.sdk.internal.session.room.create
|
||||
|
||||
import io.realm.kotlin.MutableRealm
|
||||
import io.realm.kotlin.types.ObjectId
|
||||
import kotlinx.coroutines.TimeoutCancellationException
|
||||
import org.matrix.android.sdk.api.extensions.orFalse
|
||||
import org.matrix.android.sdk.api.extensions.tryOrNull
|
||||
|
@ -118,7 +118,6 @@ internal class DefaultFetchThreadTimelineTask @Inject constructor(
|
||||
val hasReachEnd = response.nextBatch == null
|
||||
|
||||
realmInstance.write {
|
||||
|
||||
val threadChunk = ChunkEntity.findLastForwardChunkOfThread(this, params.roomId, params.rootThreadEventId)
|
||||
?: run {
|
||||
return@write
|
||||
|
@ -25,7 +25,6 @@ import androidx.paging.PagedList
|
||||
import io.realm.kotlin.TypedRealm
|
||||
import io.realm.kotlin.query.RealmQuery
|
||||
import io.realm.kotlin.query.sum
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.map
|
||||
import org.matrix.android.sdk.api.query.QueryStringValue
|
||||
import org.matrix.android.sdk.api.query.RoomCategoryFilter
|
||||
@ -186,7 +185,6 @@ internal class RoomSummaryDataSource @Inject constructor(
|
||||
pagedListConfig: PagedList.Config,
|
||||
sortOrder: RoomSortOrder,
|
||||
): UpdatableLivePageResult {
|
||||
|
||||
val boundaries = MutableLiveData(ResultBoundaries())
|
||||
val boundaryCallback = object : PagedList.BoundaryCallback<RoomSummary>() {
|
||||
override fun onItemAtEndLoaded(itemAtEnd: RoomSummary) {
|
||||
|
@ -114,7 +114,6 @@ internal class LoadTimelineStrategy constructor(
|
||||
private var timelineChunk: TimelineChunk? = null
|
||||
|
||||
private suspend fun onChunkResultsChanged(resultsChange: ResultsChange<ChunkEntity>) {
|
||||
|
||||
suspend fun onUpdates(updatedResults: UpdatedResults<ChunkEntity>) {
|
||||
val shouldRebuildChunk = updatedResults.insertions.isNotEmpty()
|
||||
if (shouldRebuildChunk) {
|
||||
|
@ -464,7 +464,6 @@ internal class TimelineChunk(
|
||||
}
|
||||
|
||||
private fun handleChunkObjectChange(chunkChanged: ObjectChange<ChunkEntity>) {
|
||||
|
||||
fun onChunkUpdated(updatedObject: UpdatedObject<ChunkEntity>) {
|
||||
Timber.v("on chunk (${chunkEntity.identifier()}) changed: ${updatedObject.changedFields.joinToString(",")}")
|
||||
if (updatedObject.isFieldChanged("isLastForward")) {
|
||||
@ -499,7 +498,6 @@ internal class TimelineChunk(
|
||||
*
|
||||
*/
|
||||
private fun handleDatabaseChangeSet(resultChanges: ResultsChange<TimelineEventEntity>) {
|
||||
|
||||
fun validateInsertion(range: ListChangeSet.Range, results: RealmResults<TimelineEventEntity>): Boolean {
|
||||
// Insertion can only happen from LastForward chunk after a sync.
|
||||
if (isLastForward.get()) {
|
||||
|
@ -127,7 +127,7 @@ internal class UserAccountDataSyncHandler @Inject constructor(
|
||||
.query(PushRulesEntity::class)
|
||||
.find()
|
||||
.forEach {
|
||||
//it.deleteOnCascade()
|
||||
// it.deleteOnCascade()
|
||||
}
|
||||
|
||||
// Save only global rules for the moment
|
||||
@ -228,8 +228,8 @@ internal class UserAccountDataSyncHandler @Inject constructor(
|
||||
TimelineEventEntity.findAllFrom(realm, userIds)
|
||||
.also { Timber.d("Deleting ${it.size} TimelineEventEntity from ignored users") }
|
||||
.forEach {
|
||||
//TODO DELETE ON CASCADE
|
||||
//it.deleteOnCascade(true)
|
||||
// TODO DELETE ON CASCADE
|
||||
// it.deleteOnCascade(true)
|
||||
}
|
||||
|
||||
// Handle the case when some users are unignored from another session
|
||||
|
@ -85,7 +85,6 @@ internal class UserDataSource @Inject constructor(
|
||||
}
|
||||
|
||||
fun getIgnoredUsersLive(): LiveData<List<User>> {
|
||||
|
||||
fun mapper(ignoredUserEntity: IgnoredUserEntity): User {
|
||||
return getUser(ignoredUserEntity.userId) ?: User(userId = ignoredUserEntity.userId)
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ internal class UserAccountDataDataSource @Inject constructor(
|
||||
}
|
||||
|
||||
fun getLiveAccountDataEvents(types: Set<String>): LiveData<List<UserAccountDataEvent>> {
|
||||
return realmInstance.queryList(accountDataMapper::map){
|
||||
return realmInstance.queryList(accountDataMapper::map) {
|
||||
accountDataEventsQuery(it, types)
|
||||
}.asLiveData()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user