From 09a760a3f9a76bd614b8ebf7d88eed11f1603dea Mon Sep 17 00:00:00 2001 From: ganfra Date: Tue, 16 Apr 2024 15:49:07 +0200 Subject: [PATCH] Room list invites : clean and format --- .../io/element/android/x/intent/IntentProviderImpl.kt | 1 - .../kotlin/io/element/android/appnav/LoggedInFlowNode.kt | 4 ---- .../android/features/roomlist/impl/RoomListStateProvider.kt | 2 +- .../element/android/features/roomlist/impl/RoomListView.kt | 1 - .../features/roomlist/impl/components/RoomSummaryRow.kt | 5 +++-- .../android/features/roomlist/impl/model/InviteSender.kt | 1 - .../features/roomlist/impl/model/RoomListRoomSummary.kt | 1 - .../features/roomlist/impl/RoomListPresenterTests.kt | 2 -- .../android/features/roomlist/impl/RoomListViewTest.kt | 6 +++--- .../io/element/android/libraries/deeplink/DeeplinkData.kt | 1 - .../android/libraries/deeplink/DeepLinkCreatorTest.kt | 1 - .../android/libraries/push/impl/intent/IntentProvider.kt | 1 - .../impl/notifications/factories/PendingIntentFactory.kt | 1 - 13 files changed, 7 insertions(+), 20 deletions(-) diff --git a/app/src/main/kotlin/io/element/android/x/intent/IntentProviderImpl.kt b/app/src/main/kotlin/io/element/android/x/intent/IntentProviderImpl.kt index 0e8e9b5f29..bdadf1e3ef 100644 --- a/app/src/main/kotlin/io/element/android/x/intent/IntentProviderImpl.kt +++ b/app/src/main/kotlin/io/element/android/x/intent/IntentProviderImpl.kt @@ -45,5 +45,4 @@ class IntentProviderImpl @Inject constructor( data = deepLinkCreator.room(sessionId, roomId, threadId).toUri() } } - } diff --git a/appnav/src/main/kotlin/io/element/android/appnav/LoggedInFlowNode.kt b/appnav/src/main/kotlin/io/element/android/appnav/LoggedInFlowNode.kt index 46f84a73eb..1bde7c5b28 100644 --- a/appnav/src/main/kotlin/io/element/android/appnav/LoggedInFlowNode.kt +++ b/appnav/src/main/kotlin/io/element/android/appnav/LoggedInFlowNode.kt @@ -60,7 +60,6 @@ import io.element.android.features.securebackup.api.SecureBackupEntryPoint import io.element.android.libraries.architecture.BackstackView import io.element.android.libraries.architecture.BaseFlowNode import io.element.android.libraries.architecture.createNode -import io.element.android.libraries.deeplink.DeeplinkData import io.element.android.libraries.designsystem.utils.snackbar.SnackbarDispatcher import io.element.android.libraries.di.AppScope import io.element.android.libraries.di.SessionScope @@ -68,7 +67,6 @@ import io.element.android.libraries.matrix.api.MatrixClient import io.element.android.libraries.matrix.api.core.MAIN_SPACE import io.element.android.libraries.matrix.api.core.RoomId import io.element.android.libraries.matrix.api.sync.SyncState -import io.element.android.libraries.push.api.notifications.NotificationDrawerManager import io.element.android.services.appnavstate.api.AppNavigationStateService import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.FlowPreview @@ -77,7 +75,6 @@ import kotlinx.coroutines.flow.debounce import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.launch -import kotlinx.coroutines.withContext import kotlinx.parcelize.Parcelize import timber.log.Timber import java.util.Optional @@ -94,7 +91,6 @@ class LoggedInFlowNode @AssistedInject constructor( private val ftueEntryPoint: FtueEntryPoint, private val coroutineScope: CoroutineScope, private val networkMonitor: NetworkMonitor, - private val notificationDrawerManager: NotificationDrawerManager, private val ftueService: FtueService, private val lockScreenEntryPoint: LockScreenEntryPoint, private val lockScreenStateService: LockScreenService, diff --git a/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListStateProvider.kt b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListStateProvider.kt index 3b53723565..bdc8938503 100644 --- a/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListStateProvider.kt +++ b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListStateProvider.kt @@ -23,9 +23,9 @@ import io.element.android.features.leaveroom.api.LeaveRoomState import io.element.android.features.leaveroom.api.aLeaveRoomState import io.element.android.features.roomlist.impl.filters.RoomListFiltersState import io.element.android.features.roomlist.impl.filters.aRoomListFiltersState -import io.element.android.features.roomlist.impl.model.RoomSummaryDisplayType import io.element.android.features.roomlist.impl.model.InviteSender import io.element.android.features.roomlist.impl.model.RoomListRoomSummary +import io.element.android.features.roomlist.impl.model.RoomSummaryDisplayType import io.element.android.features.roomlist.impl.model.aRoomListRoomSummary import io.element.android.features.roomlist.impl.search.RoomListSearchState import io.element.android.features.roomlist.impl.search.aRoomListSearchState diff --git a/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListView.kt b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListView.kt index fe874a037b..22506fe49b 100644 --- a/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListView.kt +++ b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListView.kt @@ -66,7 +66,6 @@ fun RoomListView( isOnline = state.hasNetworkConnection, ) { topPadding -> Box { - if (state.contextMenu is RoomListState.ContextMenu.Shown) { RoomListContextMenu( contextMenu = state.contextMenu, diff --git a/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/components/RoomSummaryRow.kt b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/components/RoomSummaryRow.kt index 0d30d93f47..ce27d3b916 100644 --- a/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/components/RoomSummaryRow.kt +++ b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/components/RoomSummaryRow.kt @@ -47,10 +47,10 @@ import androidx.compose.ui.unit.dp import io.element.android.compound.theme.ElementTheme import io.element.android.compound.tokens.generated.CompoundIcons import io.element.android.features.roomlist.impl.RoomListEvents -import io.element.android.features.roomlist.impl.model.RoomSummaryDisplayType import io.element.android.features.roomlist.impl.model.InviteSender import io.element.android.features.roomlist.impl.model.RoomListRoomSummary import io.element.android.features.roomlist.impl.model.RoomListRoomSummaryProvider +import io.element.android.features.roomlist.impl.model.RoomSummaryDisplayType import io.element.android.libraries.core.extensions.orEmpty import io.element.android.libraries.designsystem.atomic.atoms.UnreadIndicatorAtom import io.element.android.libraries.designsystem.components.avatar.Avatar @@ -104,7 +104,8 @@ internal fun RoomSummaryRow( }, onDeclineClicked = { eventSink(RoomListEvents.DeclineInvite(room)) - }) + } + ) } } RoomSummaryDisplayType.ROOM -> { diff --git a/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/model/InviteSender.kt b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/model/InviteSender.kt index 137ab4797a..64a47d5072 100644 --- a/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/model/InviteSender.kt +++ b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/model/InviteSender.kt @@ -34,7 +34,6 @@ data class InviteSender( val displayName: String, val avatarData: AvatarData, ) { - @Composable fun annotatedString(): AnnotatedString { return stringResource(R.string.screen_invites_invited_you, displayName, userId.value).let { text -> diff --git a/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummary.kt b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummary.kt index c149bc8b2b..607303f84c 100644 --- a/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummary.kt +++ b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummary.kt @@ -40,7 +40,6 @@ data class RoomListRoomSummary( val isDirect: Boolean, val isFavorite: Boolean, val inviteSender: InviteSender?, - ) { val isHighlighted = userDefinedNotificationMode != RoomNotificationMode.MUTE && (numberOfUnreadNotifications > 0 || numberOfUnreadMentions > 0) || diff --git a/features/roomlist/impl/src/test/kotlin/io/element/android/features/roomlist/impl/RoomListPresenterTests.kt b/features/roomlist/impl/src/test/kotlin/io/element/android/features/roomlist/impl/RoomListPresenterTests.kt index 2a6867b033..bc511d0270 100644 --- a/features/roomlist/impl/src/test/kotlin/io/element/android/features/roomlist/impl/RoomListPresenterTests.kt +++ b/features/roomlist/impl/src/test/kotlin/io/element/android/features/roomlist/impl/RoomListPresenterTests.kt @@ -87,12 +87,10 @@ import io.element.android.tests.testutils.testCoroutineDispatchers import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.SupervisorJob import kotlinx.coroutines.cancel -import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.runTest import org.junit.Rule import org.junit.Test -import java.util.Optional class RoomListPresenterTests { @get:Rule diff --git a/features/roomlist/impl/src/test/kotlin/io/element/android/features/roomlist/impl/RoomListViewTest.kt b/features/roomlist/impl/src/test/kotlin/io/element/android/features/roomlist/impl/RoomListViewTest.kt index c21a3a9410..7507ab466b 100644 --- a/features/roomlist/impl/src/test/kotlin/io/element/android/features/roomlist/impl/RoomListViewTest.kt +++ b/features/roomlist/impl/src/test/kotlin/io/element/android/features/roomlist/impl/RoomListViewTest.kt @@ -94,7 +94,7 @@ class RoomListViewTest { val state = aRoomListState( eventSink = eventsRecorder, ) - val room0 = state.contentAsRooms().summaries.first{ + val room0 = state.contentAsRooms().summaries.first { it.displayType == RoomSummaryDisplayType.ROOM } ensureCalledOnceWithParam(room0.roomId) { callback -> @@ -112,7 +112,7 @@ class RoomListViewTest { val state = aRoomListState( eventSink = eventsRecorder, ) - val room0 = state.contentAsRooms().summaries.first{ + val room0 = state.contentAsRooms().summaries.first { it.displayType == RoomSummaryDisplayType.ROOM } rule.setRoomListView( @@ -153,7 +153,7 @@ class RoomListViewTest { rule.clickOn(CommonStrings.action_accept) rule.clickOn(CommonStrings.action_decline) eventsRecorder.assertList( - listOf(RoomListEvents.AcceptInvite(invitedRoom),RoomListEvents.DeclineInvite(invitedRoom)), + listOf(RoomListEvents.AcceptInvite(invitedRoom), RoomListEvents.DeclineInvite(invitedRoom)), ) } } diff --git a/libraries/deeplink/src/main/kotlin/io/element/android/libraries/deeplink/DeeplinkData.kt b/libraries/deeplink/src/main/kotlin/io/element/android/libraries/deeplink/DeeplinkData.kt index 85fa57d413..4f12cd4e3e 100644 --- a/libraries/deeplink/src/main/kotlin/io/element/android/libraries/deeplink/DeeplinkData.kt +++ b/libraries/deeplink/src/main/kotlin/io/element/android/libraries/deeplink/DeeplinkData.kt @@ -29,5 +29,4 @@ sealed interface DeeplinkData { /** The target is a room, with the given [sessionId], [roomId] and optionally a [threadId]. */ data class Room(override val sessionId: SessionId, val roomId: RoomId, val threadId: ThreadId?) : DeeplinkData - } diff --git a/libraries/deeplink/src/test/kotlin/io/element/android/libraries/deeplink/DeepLinkCreatorTest.kt b/libraries/deeplink/src/test/kotlin/io/element/android/libraries/deeplink/DeepLinkCreatorTest.kt index 664b61cbdc..1c603713ab 100644 --- a/libraries/deeplink/src/test/kotlin/io/element/android/libraries/deeplink/DeepLinkCreatorTest.kt +++ b/libraries/deeplink/src/test/kotlin/io/element/android/libraries/deeplink/DeepLinkCreatorTest.kt @@ -33,5 +33,4 @@ class DeepLinkCreatorTest { assertThat(sut.room(A_SESSION_ID, A_ROOM_ID, A_THREAD_ID)) .isEqualTo("elementx://open/@alice:server.org/!aRoomId:domain/\$aThreadId") } - } diff --git a/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/intent/IntentProvider.kt b/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/intent/IntentProvider.kt index 22d745d92a..e23adbd26a 100644 --- a/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/intent/IntentProvider.kt +++ b/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/intent/IntentProvider.kt @@ -30,5 +30,4 @@ interface IntentProvider { roomId: RoomId?, threadId: ThreadId?, ): Intent - } diff --git a/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/factories/PendingIntentFactory.kt b/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/factories/PendingIntentFactory.kt index f51eea74dd..e564cf622e 100644 --- a/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/factories/PendingIntentFactory.kt +++ b/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/factories/PendingIntentFactory.kt @@ -19,7 +19,6 @@ package io.element.android.libraries.push.impl.notifications.factories import android.app.PendingIntent import android.content.Context import android.content.Intent -import androidx.core.app.PendingIntentCompat import io.element.android.libraries.androidutils.uri.createIgnoredUri import io.element.android.libraries.di.ApplicationContext import io.element.android.libraries.matrix.api.core.EventId