From a2aafb9b6bbb9ee52ff53f2e2389191efb0d76a2 Mon Sep 17 00:00:00 2001 From: Maxime NATUREL Date: Thu, 28 Apr 2022 17:16:13 +0200 Subject: [PATCH] Fixing code quality issues --- .../LiveLocationAggregatedSummary.kt | 2 +- .../LiveLocationAggregatedSummaryMapper.kt | 2 +- .../LiveLocationAggregatedSummaryEntity.kt | 2 +- ...iveLocationAggregatedSummaryEntityQuery.kt | 20 +++++++++++++++---- .../room/send/LocalEchoEventFactory.kt | 1 - 5 files changed, 19 insertions(+), 8 deletions(-) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/livelocation/LiveLocationAggregatedSummary.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/livelocation/LiveLocationAggregatedSummary.kt index e879c569ea..8b24ab32bc 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/livelocation/LiveLocationAggregatedSummary.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/room/model/livelocation/LiveLocationAggregatedSummary.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 New Vector Ltd + * Copyright (c) 2022 The Matrix.org Foundation C.I.C. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/mapper/LiveLocationAggregatedSummaryMapper.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/mapper/LiveLocationAggregatedSummaryMapper.kt index a8ca9fb759..d4f55b92c7 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/mapper/LiveLocationAggregatedSummaryMapper.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/mapper/LiveLocationAggregatedSummaryMapper.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 New Vector Ltd + * Copyright (c) 2022 The Matrix.org Foundation C.I.C. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/livelocation/LiveLocationAggregatedSummaryEntity.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/livelocation/LiveLocationAggregatedSummaryEntity.kt index 59356a29d2..45a7e4d46b 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/livelocation/LiveLocationAggregatedSummaryEntity.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/model/livelocation/LiveLocationAggregatedSummaryEntity.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 New Vector Ltd + * Copyright (c) 2022 The Matrix.org Foundation C.I.C. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/query/LiveLocationAggregatedSummaryEntityQuery.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/query/LiveLocationAggregatedSummaryEntityQuery.kt index 3be2ae9117..07f7106876 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/query/LiveLocationAggregatedSummaryEntityQuery.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/query/LiveLocationAggregatedSummaryEntityQuery.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 New Vector Ltd + * Copyright (c) 2022 The Matrix.org Foundation C.I.C. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,13 +23,21 @@ import org.matrix.android.sdk.internal.database.model.EventAnnotationsSummaryEnt import org.matrix.android.sdk.internal.database.model.livelocation.LiveLocationAggregatedSummaryEntity import org.matrix.android.sdk.internal.database.model.livelocation.LiveLocationAggregatedSummaryEntityFields -internal fun LiveLocationAggregatedSummaryEntity.Companion.where(realm: Realm, roomId: String, eventId: String): RealmQuery { +internal fun LiveLocationAggregatedSummaryEntity.Companion.where( + realm: Realm, + roomId: String, + eventId: String, +): RealmQuery { return realm.where() .equalTo(LiveLocationAggregatedSummaryEntityFields.ROOM_ID, roomId) .equalTo(LiveLocationAggregatedSummaryEntityFields.EVENT_ID, eventId) } -internal fun LiveLocationAggregatedSummaryEntity.Companion.create(realm: Realm, roomId: String, eventId: String): LiveLocationAggregatedSummaryEntity { +internal fun LiveLocationAggregatedSummaryEntity.Companion.create( + realm: Realm, + roomId: String, + eventId: String, +): LiveLocationAggregatedSummaryEntity { val obj = realm.createObject(LiveLocationAggregatedSummaryEntity::class.java).apply { this.eventId = eventId this.roomId = roomId @@ -40,7 +48,11 @@ internal fun LiveLocationAggregatedSummaryEntity.Companion.create(realm: Realm, return obj } -internal fun LiveLocationAggregatedSummaryEntity.Companion.getOrCreate(realm: Realm, roomId: String, eventId: String): LiveLocationAggregatedSummaryEntity { +internal fun LiveLocationAggregatedSummaryEntity.Companion.getOrCreate( + realm: Realm, + roomId: String, + eventId: String, +): LiveLocationAggregatedSummaryEntity { return LiveLocationAggregatedSummaryEntity.where(realm, roomId, eventId).findFirst() ?: LiveLocationAggregatedSummaryEntity.create(realm, roomId, eventId) } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/send/LocalEchoEventFactory.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/send/LocalEchoEventFactory.kt index 10d237e249..1b8cd8b116 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/send/LocalEchoEventFactory.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/send/LocalEchoEventFactory.kt @@ -71,7 +71,6 @@ import org.matrix.android.sdk.internal.session.content.ThumbnailExtractor import org.matrix.android.sdk.internal.session.permalinks.PermalinkFactory import org.matrix.android.sdk.internal.session.room.send.pills.TextPillsUtils import java.util.UUID -import java.util.concurrent.TimeUnit import javax.inject.Inject /**