From 52d05b373cb2e69fc16ae7401911f36cf298a36a Mon Sep 17 00:00:00 2001 From: Maxime NATUREL Date: Fri, 2 Sep 2022 16:45:00 +0200 Subject: [PATCH] Fix post rebase --- .../devices/v2/overview/GetDeviceFullInfoUseCase.kt | 7 ++++++- vector/src/main/res/layout/fragment_settings_devices.xml | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/settings/devices/v2/overview/GetDeviceFullInfoUseCase.kt b/vector/src/main/java/im/vector/app/features/settings/devices/v2/overview/GetDeviceFullInfoUseCase.kt index 3cde519385..07d29fc4e8 100644 --- a/vector/src/main/java/im/vector/app/features/settings/devices/v2/overview/GetDeviceFullInfoUseCase.kt +++ b/vector/src/main/java/im/vector/app/features/settings/devices/v2/overview/GetDeviceFullInfoUseCase.kt @@ -21,6 +21,7 @@ import im.vector.app.core.di.ActiveSessionHolder import im.vector.app.features.settings.devices.DeviceFullInfo import im.vector.app.features.settings.devices.GetCurrentSessionCrossSigningInfoUseCase import im.vector.app.features.settings.devices.GetEncryptionTrustLevelForDeviceUseCase +import im.vector.app.features.settings.devices.v2.list.CheckIfSessionIsInactiveUseCase import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.emptyFlow @@ -32,8 +33,10 @@ class GetDeviceFullInfoUseCase @Inject constructor( private val activeSessionHolder: ActiveSessionHolder, private val getCurrentSessionCrossSigningInfoUseCase: GetCurrentSessionCrossSigningInfoUseCase, private val getEncryptionTrustLevelForDeviceUseCase: GetEncryptionTrustLevelForDeviceUseCase, + private val checkIfSessionIsInactiveUseCase: CheckIfSessionIsInactiveUseCase, ) { + // TODO update unit tests fun execute(deviceId: String): Flow> { return activeSessionHolder.getSafeActiveSession()?.let { session -> val currentSessionCrossSigningInfo = getCurrentSessionCrossSigningInfoUseCase.execute() @@ -45,10 +48,12 @@ class GetDeviceFullInfoUseCase @Inject constructor( val cryptoInfo = cryptoDeviceInfo.getOrNull() val fullInfo = if (info != null && cryptoInfo != null) { val roomEncryptionTrustLevel = getEncryptionTrustLevelForDeviceUseCase.execute(currentSessionCrossSigningInfo, cryptoInfo) + val isInactive = checkIfSessionIsInactiveUseCase.execute(info.lastSeenTs ?: 0) DeviceFullInfo( deviceInfo = info, cryptoDeviceInfo = cryptoInfo, - trustLevelForShield = roomEncryptionTrustLevel + trustLevelForShield = roomEncryptionTrustLevel, + isInactive = isInactive ) } else { null diff --git a/vector/src/main/res/layout/fragment_settings_devices.xml b/vector/src/main/res/layout/fragment_settings_devices.xml index b4f47302e1..9cefd6aa24 100644 --- a/vector/src/main/res/layout/fragment_settings_devices.xml +++ b/vector/src/main/res/layout/fragment_settings_devices.xml @@ -8,7 +8,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content"> -