Code review fixes.
This commit is contained in:
parent
4ab798f88d
commit
8de9ef8c7d
|
@ -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
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -55,7 +55,7 @@ class OtherSessionsViewModel @AssistedInject constructor(
|
|||
observeDevicesJob?.cancel()
|
||||
observeDevicesJob = getDeviceFullInfoListUseCase.execute(
|
||||
filterType = currentFilter,
|
||||
excludeCurrentDevice = !initialState.includeCurrentSession
|
||||
excludeCurrentDevice = initialState.excludeCurrentDevice
|
||||
)
|
||||
.execute { async ->
|
||||
copy(
|
||||
|
|
|
@ -25,8 +25,8 @@ import im.vector.app.features.settings.devices.v2.filter.DeviceManagerFilterType
|
|||
data class OtherSessionsViewState(
|
||||
val devices: Async<List<DeviceFullInfo>> = 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)
|
||||
}
|
||||
|
|
|
@ -180,10 +180,8 @@ class DevicesViewModelTest {
|
|||
*/
|
||||
private fun givenDeviceFullInfoList(): List<DeviceFullInfo> {
|
||||
val verifiedCryptoDeviceInfo = mockk<CryptoDeviceInfo>()
|
||||
every { verifiedCryptoDeviceInfo.isVerified } returns true
|
||||
every { verifiedCryptoDeviceInfo.trustLevel } returns DeviceTrustLevel(crossSigningVerified = true, locallyVerified = true)
|
||||
val unverifiedCryptoDeviceInfo = mockk<CryptoDeviceInfo>()
|
||||
every { unverifiedCryptoDeviceInfo.isVerified } returns false
|
||||
every { unverifiedCryptoDeviceInfo.trustLevel } returns DeviceTrustLevel(crossSigningVerified = false, locallyVerified = false)
|
||||
|
||||
val deviceFullInfo1 = DeviceFullInfo(
|
||||
|
|
|
@ -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<Intent>()
|
||||
every { OtherSessionsActivity.newIntent(context.instance, titleResourceId, defaultFilter, includeCurrentSession) } returns intent
|
||||
every { OtherSessionsActivity.newIntent(context.instance, titleResourceId, defaultFilter, excludeCurrentDevice) } returns intent
|
||||
return intent
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue