Split long lines

This commit is contained in:
Benoit Marty 2021-10-01 14:24:07 +02:00
parent 920f467231
commit 6983e1be55
4 changed files with 31 additions and 9 deletions

View file

@ -1126,7 +1126,10 @@ internal class DefaultVerificationService @Inject constructor(
}
}
override fun requestKeyVerificationInDMs(methods: List<VerificationMethod>, otherUserId: String, roomId: String, localId: String?): PendingVerificationRequest {
override fun requestKeyVerificationInDMs(methods: List<VerificationMethod>,
otherUserId: String,
roomId: String,
localId: String?): PendingVerificationRequest {
Timber.i("## SAS Requesting verification to user: $otherUserId in room $roomId")
val requestsForUser = pendingRequests.getOrPut(otherUserId) { mutableListOf() }

View file

@ -23,26 +23,40 @@ import io.realm.kotlin.createObject
import org.matrix.android.sdk.internal.database.model.CurrentStateEventEntity
import org.matrix.android.sdk.internal.database.model.CurrentStateEventEntityFields
internal fun CurrentStateEventEntity.Companion.whereType(realm: Realm, roomId: String, type: String): RealmQuery<CurrentStateEventEntity> {
internal fun CurrentStateEventEntity.Companion.whereType(realm: Realm,
roomId: String,
type: String): RealmQuery<CurrentStateEventEntity> {
return realm.where(CurrentStateEventEntity::class.java)
.equalTo(CurrentStateEventEntityFields.ROOM_ID, roomId)
.equalTo(CurrentStateEventEntityFields.TYPE, type)
}
internal fun CurrentStateEventEntity.Companion.whereStateKey(realm: Realm, roomId: String, type: String, stateKey: String): RealmQuery<CurrentStateEventEntity> {
internal fun CurrentStateEventEntity.Companion.whereStateKey(realm: Realm,
roomId: String,
type: String,
stateKey: String): RealmQuery<CurrentStateEventEntity> {
return whereType(realm = realm, roomId = roomId, type = type)
.equalTo(CurrentStateEventEntityFields.STATE_KEY, stateKey)
}
internal fun CurrentStateEventEntity.Companion.getOrNull(realm: Realm, roomId: String, stateKey: String, type: String): CurrentStateEventEntity? {
internal fun CurrentStateEventEntity.Companion.getOrNull(realm: Realm,
roomId: String,
stateKey: String,
type: String): CurrentStateEventEntity? {
return whereStateKey(realm = realm, roomId = roomId, type = type, stateKey = stateKey).findFirst()
}
internal fun CurrentStateEventEntity.Companion.getOrCreate(realm: Realm, roomId: String, stateKey: String, type: String): CurrentStateEventEntity {
internal fun CurrentStateEventEntity.Companion.getOrCreate(realm: Realm,
roomId: String,
stateKey: String,
type: String): CurrentStateEventEntity {
return getOrNull(realm = realm, roomId = roomId, stateKey = stateKey, type = type) ?: create(realm, roomId, stateKey, type)
}
private fun create(realm: Realm, roomId: String, stateKey: String, type: String): CurrentStateEventEntity {
private fun create(realm: Realm,
roomId: String,
stateKey: String,
type: String): CurrentStateEventEntity {
return realm.createObject<CurrentStateEventEntity>().apply {
this.type = type
this.roomId = roomId

View file

@ -93,11 +93,15 @@ internal class DefaultRoomService @Inject constructor(
return roomSummaryDataSource.getRoomSummariesLive(queryParams)
}
override fun getPagedRoomSummariesLive(queryParams: RoomSummaryQueryParams, pagedListConfig: PagedList.Config, sortOrder: RoomSortOrder): LiveData<PagedList<RoomSummary>> {
override fun getPagedRoomSummariesLive(queryParams: RoomSummaryQueryParams,
pagedListConfig: PagedList.Config,
sortOrder: RoomSortOrder): LiveData<PagedList<RoomSummary>> {
return roomSummaryDataSource.getSortedPagedRoomSummariesLive(queryParams, pagedListConfig, sortOrder)
}
override fun getFilteredPagedRoomSummariesLive(queryParams: RoomSummaryQueryParams, pagedListConfig: PagedList.Config, sortOrder: RoomSortOrder): UpdatableLivePageResult {
override fun getFilteredPagedRoomSummariesLive(queryParams: RoomSummaryQueryParams,
pagedListConfig: PagedList.Config,
sortOrder: RoomSortOrder): UpdatableLivePageResult {
return roomSummaryDataSource.getUpdatablePagedRoomSummariesLive(queryParams, pagedListConfig, sortOrder)
}

View file

@ -91,7 +91,8 @@ class DeviceVerificationInfoBottomSheetViewModel @AssistedInject constructor(@As
companion object : MvRxViewModelFactory<DeviceVerificationInfoBottomSheetViewModel, DeviceVerificationInfoBottomSheetViewState> {
@JvmStatic
override fun create(viewModelContext: ViewModelContext, state: DeviceVerificationInfoBottomSheetViewState): DeviceVerificationInfoBottomSheetViewModel? {
override fun create(viewModelContext: ViewModelContext, state: DeviceVerificationInfoBottomSheetViewState):
DeviceVerificationInfoBottomSheetViewModel? {
val fragment: DeviceVerificationInfoBottomSheet = (viewModelContext as FragmentViewModelContext).fragment()
val args = viewModelContext.args<DeviceVerificationInfoArgs>()
return fragment.deviceVerificationInfoViewModelFactory.create(state, args.deviceId)