diff --git a/vector/src/main/java/im/vector/app/features/settings/devices/v2/VectorSettingsDevicesFragment.kt b/vector/src/main/java/im/vector/app/features/settings/devices/v2/VectorSettingsDevicesFragment.kt index da1a9a2fbd..e1888d0672 100644 --- a/vector/src/main/java/im/vector/app/features/settings/devices/v2/VectorSettingsDevicesFragment.kt +++ b/vector/src/main/java/im/vector/app/features/settings/devices/v2/VectorSettingsDevicesFragment.kt @@ -135,7 +135,7 @@ class VectorSettingsDevicesFragment : requireActivity(), R.string.device_manager_header_section_security_recommendations_title, DeviceManagerFilterType.UNVERIFIED, - includeCurrentSession = true + excludeCurrentDevice = false ) } } @@ -145,7 +145,7 @@ class VectorSettingsDevicesFragment : requireActivity(), R.string.device_manager_header_section_security_recommendations_title, DeviceManagerFilterType.INACTIVE, - includeCurrentSession = true + excludeCurrentDevice = false ) } } @@ -290,7 +290,7 @@ class VectorSettingsDevicesFragment : context = requireActivity(), titleResourceId = R.string.device_manager_sessions_other_title, defaultFilter = DeviceManagerFilterType.ALL_SESSIONS, - includeCurrentSession = false + excludeCurrentDevice = true ) } } diff --git a/vector/src/main/java/im/vector/app/features/settings/devices/v2/VectorSettingsDevicesViewNavigator.kt b/vector/src/main/java/im/vector/app/features/settings/devices/v2/VectorSettingsDevicesViewNavigator.kt index 991de805e7..47e697822b 100644 --- a/vector/src/main/java/im/vector/app/features/settings/devices/v2/VectorSettingsDevicesViewNavigator.kt +++ b/vector/src/main/java/im/vector/app/features/settings/devices/v2/VectorSettingsDevicesViewNavigator.kt @@ -32,10 +32,10 @@ class VectorSettingsDevicesViewNavigator @Inject constructor() { context: Context, titleResourceId: Int, defaultFilter: DeviceManagerFilterType, - includeCurrentSession: Boolean, + excludeCurrentDevice: Boolean, ) { context.startActivity( - OtherSessionsActivity.newIntent(context, titleResourceId, defaultFilter, includeCurrentSession) + OtherSessionsActivity.newIntent(context, titleResourceId, defaultFilter, excludeCurrentDevice) ) } } diff --git a/vector/src/main/java/im/vector/app/features/settings/devices/v2/othersessions/OtherSessionsActivity.kt b/vector/src/main/java/im/vector/app/features/settings/devices/v2/othersessions/OtherSessionsActivity.kt index f56b838215..f146f77690 100644 --- a/vector/src/main/java/im/vector/app/features/settings/devices/v2/othersessions/OtherSessionsActivity.kt +++ b/vector/src/main/java/im/vector/app/features/settings/devices/v2/othersessions/OtherSessionsActivity.kt @@ -50,10 +50,10 @@ class OtherSessionsActivity : SimpleFragmentActivity() { @StringRes titleResourceId: Int, defaultFilter: DeviceManagerFilterType, - includeCurrentSession: Boolean, + excludeCurrentDevice: Boolean, ): Intent { return Intent(context, OtherSessionsActivity::class.java).apply { - putExtra(Mavericks.KEY_ARG, OtherSessionsArgs(titleResourceId, defaultFilter, includeCurrentSession)) + putExtra(Mavericks.KEY_ARG, OtherSessionsArgs(titleResourceId, defaultFilter, excludeCurrentDevice)) } } } diff --git a/vector/src/main/java/im/vector/app/features/settings/devices/v2/othersessions/OtherSessionsArgs.kt b/vector/src/main/java/im/vector/app/features/settings/devices/v2/othersessions/OtherSessionsArgs.kt index 55a7000c4f..61f89eaffa 100644 --- a/vector/src/main/java/im/vector/app/features/settings/devices/v2/othersessions/OtherSessionsArgs.kt +++ b/vector/src/main/java/im/vector/app/features/settings/devices/v2/othersessions/OtherSessionsArgs.kt @@ -17,12 +17,14 @@ package im.vector.app.features.settings.devices.v2.othersessions import android.os.Parcelable +import androidx.annotation.StringRes import im.vector.app.features.settings.devices.v2.filter.DeviceManagerFilterType import kotlinx.parcelize.Parcelize @Parcelize data class OtherSessionsArgs( + @StringRes val titleResourceId: Int, val defaultFilter: DeviceManagerFilterType, - val includeCurrentSession: Boolean, + val excludeCurrentDevice: Boolean, ) : Parcelable diff --git a/vector/src/main/java/im/vector/app/features/settings/devices/v2/othersessions/OtherSessionsViewModel.kt b/vector/src/main/java/im/vector/app/features/settings/devices/v2/othersessions/OtherSessionsViewModel.kt index 2ca24dd92a..e52953e2b6 100644 --- a/vector/src/main/java/im/vector/app/features/settings/devices/v2/othersessions/OtherSessionsViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/settings/devices/v2/othersessions/OtherSessionsViewModel.kt @@ -55,7 +55,7 @@ class OtherSessionsViewModel @AssistedInject constructor( observeDevicesJob?.cancel() observeDevicesJob = getDeviceFullInfoListUseCase.execute( filterType = currentFilter, - excludeCurrentDevice = !initialState.includeCurrentSession + excludeCurrentDevice = initialState.excludeCurrentDevice ) .execute { async -> copy( diff --git a/vector/src/main/java/im/vector/app/features/settings/devices/v2/othersessions/OtherSessionsViewState.kt b/vector/src/main/java/im/vector/app/features/settings/devices/v2/othersessions/OtherSessionsViewState.kt index cb30490845..5256a9b27a 100644 --- a/vector/src/main/java/im/vector/app/features/settings/devices/v2/othersessions/OtherSessionsViewState.kt +++ b/vector/src/main/java/im/vector/app/features/settings/devices/v2/othersessions/OtherSessionsViewState.kt @@ -25,8 +25,8 @@ import im.vector.app.features.settings.devices.v2.filter.DeviceManagerFilterType data class OtherSessionsViewState( val devices: Async> = Uninitialized, val currentFilter: DeviceManagerFilterType = DeviceManagerFilterType.ALL_SESSIONS, - val includeCurrentSession: Boolean = false, + val excludeCurrentDevice: Boolean = false, ) : MavericksState { - constructor(args: OtherSessionsArgs) : this(includeCurrentSession = args.includeCurrentSession) + constructor(args: OtherSessionsArgs) : this(excludeCurrentDevice = args.excludeCurrentDevice) } diff --git a/vector/src/test/java/im/vector/app/features/settings/devices/v2/DevicesViewModelTest.kt b/vector/src/test/java/im/vector/app/features/settings/devices/v2/DevicesViewModelTest.kt index 517f315553..bc5331568c 100644 --- a/vector/src/test/java/im/vector/app/features/settings/devices/v2/DevicesViewModelTest.kt +++ b/vector/src/test/java/im/vector/app/features/settings/devices/v2/DevicesViewModelTest.kt @@ -180,10 +180,8 @@ class DevicesViewModelTest { */ private fun givenDeviceFullInfoList(): List { val verifiedCryptoDeviceInfo = mockk() - every { verifiedCryptoDeviceInfo.isVerified } returns true every { verifiedCryptoDeviceInfo.trustLevel } returns DeviceTrustLevel(crossSigningVerified = true, locallyVerified = true) val unverifiedCryptoDeviceInfo = mockk() - every { unverifiedCryptoDeviceInfo.isVerified } returns false every { unverifiedCryptoDeviceInfo.trustLevel } returns DeviceTrustLevel(crossSigningVerified = false, locallyVerified = false) val deviceFullInfo1 = DeviceFullInfo( diff --git a/vector/src/test/java/im/vector/app/features/settings/devices/v2/VectorSettingsDevicesViewNavigatorTest.kt b/vector/src/test/java/im/vector/app/features/settings/devices/v2/VectorSettingsDevicesViewNavigatorTest.kt index 7b8b6ee82d..ec8019384a 100644 --- a/vector/src/test/java/im/vector/app/features/settings/devices/v2/VectorSettingsDevicesViewNavigatorTest.kt +++ b/vector/src/test/java/im/vector/app/features/settings/devices/v2/VectorSettingsDevicesViewNavigatorTest.kt @@ -80,9 +80,9 @@ class VectorSettingsDevicesViewNavigatorTest { return intent } - private fun givenIntentForOtherSessions(titleResourceId: Int, defaultFilter: DeviceManagerFilterType, includeCurrentSession: Boolean): Intent { + private fun givenIntentForOtherSessions(titleResourceId: Int, defaultFilter: DeviceManagerFilterType, excludeCurrentDevice: Boolean): Intent { val intent = mockk() - every { OtherSessionsActivity.newIntent(context.instance, titleResourceId, defaultFilter, includeCurrentSession) } returns intent + every { OtherSessionsActivity.newIntent(context.instance, titleResourceId, defaultFilter, excludeCurrentDevice) } returns intent return intent } }