mirror of
https://github.com/element-hq/element-android
synced 2024-11-27 11:59:12 +03:00
Code review fixes.
This commit is contained in:
parent
38cd2be332
commit
6d459a0bc9
9 changed files with 52 additions and 61 deletions
|
@ -18,7 +18,7 @@ package im.vector.app.features.settings.devices.v2
|
|||
|
||||
import im.vector.app.features.settings.devices.v2.list.DeviceType
|
||||
|
||||
data class DeviceUserAgent(
|
||||
data class DeviceExtendedInfo(
|
||||
/**
|
||||
* One of MOBILE, WEB, DESKTOP or UNKNOWN.
|
||||
*/
|
|
@ -26,5 +26,5 @@ data class DeviceFullInfo(
|
|||
val roomEncryptionTrustLevel: RoomEncryptionTrustLevel,
|
||||
val isInactive: Boolean,
|
||||
val isCurrentDevice: Boolean,
|
||||
val deviceUserAgent: DeviceUserAgent,
|
||||
val deviceExtendedInfo: DeviceExtendedInfo,
|
||||
)
|
||||
|
|
|
@ -22,7 +22,7 @@ import javax.inject.Inject
|
|||
|
||||
class ParseDeviceUserAgentUseCase @Inject constructor() {
|
||||
|
||||
fun execute(userAgent: String?): DeviceUserAgent {
|
||||
fun execute(userAgent: String?): DeviceExtendedInfo {
|
||||
if (userAgent == null) return createUnknownUserAgent()
|
||||
|
||||
return when {
|
||||
|
@ -34,7 +34,7 @@ class ParseDeviceUserAgentUseCase @Inject constructor() {
|
|||
}
|
||||
}
|
||||
|
||||
private fun parseAndroidUserAgent(userAgent: String): DeviceUserAgent {
|
||||
private fun parseAndroidUserAgent(userAgent: String): DeviceExtendedInfo {
|
||||
val appName = userAgent.substringBefore("/")
|
||||
val appVersion = userAgent.substringAfter("/").substringBefore(" (")
|
||||
val deviceInfoSegments = userAgent.substringAfter("(").substringBeforeLast(")").split("; ")
|
||||
|
@ -48,19 +48,19 @@ class ParseDeviceUserAgentUseCase @Inject constructor() {
|
|||
deviceModel = deviceInfoSegments.getOrNull(0)
|
||||
deviceOperatingSystem = deviceInfoSegments.getOrNull(1)
|
||||
}
|
||||
return DeviceUserAgent(DeviceType.MOBILE, deviceModel, deviceOperatingSystem, appName, appVersion)
|
||||
return DeviceExtendedInfo(DeviceType.MOBILE, deviceModel, deviceOperatingSystem, appName, appVersion)
|
||||
}
|
||||
|
||||
private fun parseIosUserAgent(userAgent: String): DeviceUserAgent {
|
||||
private fun parseIosUserAgent(userAgent: String): DeviceExtendedInfo {
|
||||
val appName = userAgent.substringBefore("/")
|
||||
val appVersion = userAgent.substringAfter("/").substringBefore(" (")
|
||||
val deviceInfoSegments = userAgent.substringAfter("(").substringBeforeLast(")").split("; ")
|
||||
val deviceModel = deviceInfoSegments.getOrNull(0)
|
||||
val deviceOperatingSystem = deviceInfoSegments.getOrNull(1)
|
||||
return DeviceUserAgent(DeviceType.MOBILE, deviceModel, deviceOperatingSystem, appName, appVersion)
|
||||
return DeviceExtendedInfo(DeviceType.MOBILE, deviceModel, deviceOperatingSystem, appName, appVersion)
|
||||
}
|
||||
|
||||
private fun parseDesktopUserAgent(userAgent: String): DeviceUserAgent {
|
||||
private fun parseDesktopUserAgent(userAgent: String): DeviceExtendedInfo {
|
||||
val browserSegments = userAgent.split(" ")
|
||||
val browserName = when {
|
||||
isFirefox(browserSegments) -> {
|
||||
|
@ -86,17 +86,17 @@ class ParseDeviceUserAgentUseCase @Inject constructor() {
|
|||
} else {
|
||||
deviceOperatingSystemSegments.getOrNull(0)
|
||||
}
|
||||
return DeviceUserAgent(DeviceType.DESKTOP, browserName, deviceOperatingSystem, null, null)
|
||||
return DeviceExtendedInfo(DeviceType.DESKTOP, browserName, deviceOperatingSystem, null, null)
|
||||
}
|
||||
|
||||
private fun parseWebUserAgent(userAgent: String): DeviceUserAgent {
|
||||
private fun parseWebUserAgent(userAgent: String): DeviceExtendedInfo {
|
||||
return parseDesktopUserAgent(userAgent).copy(
|
||||
deviceType = DeviceType.WEB
|
||||
)
|
||||
}
|
||||
|
||||
private fun createUnknownUserAgent(): DeviceUserAgent {
|
||||
return DeviceUserAgent(DeviceType.UNKNOWN)
|
||||
private fun createUnknownUserAgent(): DeviceExtendedInfo {
|
||||
return DeviceExtendedInfo(DeviceType.UNKNOWN)
|
||||
}
|
||||
|
||||
private fun isFirefox(browserSegments: List<String>): Boolean {
|
||||
|
|
|
@ -58,7 +58,7 @@ class GetDeviceFullInfoUseCase @Inject constructor(
|
|||
roomEncryptionTrustLevel = roomEncryptionTrustLevel,
|
||||
isInactive = isInactive,
|
||||
isCurrentDevice = isCurrentDevice,
|
||||
deviceUserAgent = deviceUserAgent,
|
||||
deviceExtendedInfo = deviceUserAgent,
|
||||
)
|
||||
} else {
|
||||
null
|
||||
|
|
|
@ -244,7 +244,7 @@ class DevicesViewModelTest {
|
|||
roomEncryptionTrustLevel = RoomEncryptionTrustLevel.Trusted,
|
||||
isInactive = false,
|
||||
isCurrentDevice = true,
|
||||
deviceUserAgent = DeviceUserAgent(DeviceType.MOBILE)
|
||||
deviceExtendedInfo = DeviceExtendedInfo(DeviceType.MOBILE)
|
||||
)
|
||||
val deviceFullInfo2 = DeviceFullInfo(
|
||||
deviceInfo = mockk(),
|
||||
|
@ -252,7 +252,7 @@ class DevicesViewModelTest {
|
|||
roomEncryptionTrustLevel = RoomEncryptionTrustLevel.Warning,
|
||||
isInactive = true,
|
||||
isCurrentDevice = false,
|
||||
deviceUserAgent = DeviceUserAgent(DeviceType.MOBILE)
|
||||
deviceExtendedInfo = DeviceExtendedInfo(DeviceType.MOBILE)
|
||||
)
|
||||
val deviceFullInfoList = listOf(deviceFullInfo1, deviceFullInfo2)
|
||||
val deviceFullInfoListFlow = flowOf(deviceFullInfoList)
|
||||
|
|
|
@ -46,7 +46,6 @@ private const val A_DEVICE_ID_3 = "device-id-3"
|
|||
private const val A_TIMESTAMP_1 = 100L
|
||||
private const val A_TIMESTAMP_2 = 200L
|
||||
private const val A_TIMESTAMP_3 = 300L
|
||||
private const val A_USER_AGENT = "Element dbg/1.5.0-dev (Xiaomi Mi 9T; Android 11; RKQ1.200826.002 test-keys; Flavour GooglePlay; MatrixAndroidSdk2 1.5.2)"
|
||||
|
||||
class GetDeviceFullInfoListUseCaseTest {
|
||||
|
||||
|
@ -92,7 +91,6 @@ class GetDeviceFullInfoListUseCaseTest {
|
|||
isInactive = true,
|
||||
roomEncryptionTrustLevel = RoomEncryptionTrustLevel.Trusted,
|
||||
cryptoDeviceInfo = cryptoDeviceInfo1,
|
||||
lastSeenUserAgent = A_USER_AGENT
|
||||
)
|
||||
val deviceInfo2 = givenADevicesInfo(
|
||||
deviceId = A_DEVICE_ID_2,
|
||||
|
@ -100,7 +98,6 @@ class GetDeviceFullInfoListUseCaseTest {
|
|||
isInactive = false,
|
||||
roomEncryptionTrustLevel = RoomEncryptionTrustLevel.Trusted,
|
||||
cryptoDeviceInfo = cryptoDeviceInfo2,
|
||||
lastSeenUserAgent = A_USER_AGENT
|
||||
)
|
||||
val deviceInfo3 = givenADevicesInfo(
|
||||
deviceId = A_DEVICE_ID_3,
|
||||
|
@ -108,7 +105,6 @@ class GetDeviceFullInfoListUseCaseTest {
|
|||
isInactive = false,
|
||||
roomEncryptionTrustLevel = RoomEncryptionTrustLevel.Warning,
|
||||
cryptoDeviceInfo = cryptoDeviceInfo3,
|
||||
lastSeenUserAgent = A_USER_AGENT
|
||||
)
|
||||
val deviceInfoList = listOf(deviceInfo1, deviceInfo2, deviceInfo3)
|
||||
every { fakeFlowSession.liveMyDevicesInfo() } returns flowOf(deviceInfoList)
|
||||
|
@ -118,7 +114,7 @@ class GetDeviceFullInfoListUseCaseTest {
|
|||
roomEncryptionTrustLevel = RoomEncryptionTrustLevel.Trusted,
|
||||
isInactive = true,
|
||||
isCurrentDevice = true,
|
||||
deviceUserAgent = DeviceUserAgent(DeviceType.MOBILE)
|
||||
deviceExtendedInfo = DeviceExtendedInfo(DeviceType.MOBILE)
|
||||
)
|
||||
val expectedResult2 = DeviceFullInfo(
|
||||
deviceInfo = deviceInfo2,
|
||||
|
@ -126,7 +122,7 @@ class GetDeviceFullInfoListUseCaseTest {
|
|||
roomEncryptionTrustLevel = RoomEncryptionTrustLevel.Trusted,
|
||||
isInactive = false,
|
||||
isCurrentDevice = false,
|
||||
deviceUserAgent = DeviceUserAgent(DeviceType.MOBILE)
|
||||
deviceExtendedInfo = DeviceExtendedInfo(DeviceType.MOBILE)
|
||||
)
|
||||
val expectedResult3 = DeviceFullInfo(
|
||||
deviceInfo = deviceInfo3,
|
||||
|
@ -134,7 +130,7 @@ class GetDeviceFullInfoListUseCaseTest {
|
|||
roomEncryptionTrustLevel = RoomEncryptionTrustLevel.Warning,
|
||||
isInactive = false,
|
||||
isCurrentDevice = false,
|
||||
deviceUserAgent = DeviceUserAgent(DeviceType.MOBILE)
|
||||
deviceExtendedInfo = DeviceExtendedInfo(DeviceType.MOBILE)
|
||||
)
|
||||
val expectedResult = listOf(expectedResult3, expectedResult2, expectedResult1)
|
||||
every { filterDevicesUseCase.execute(any(), any()) } returns expectedResult
|
||||
|
@ -192,20 +188,15 @@ class GetDeviceFullInfoListUseCaseTest {
|
|||
isInactive: Boolean,
|
||||
roomEncryptionTrustLevel: RoomEncryptionTrustLevel,
|
||||
cryptoDeviceInfo: CryptoDeviceInfo,
|
||||
lastSeenUserAgent: String,
|
||||
): DeviceInfo {
|
||||
val deviceInfo = mockk<DeviceInfo>()
|
||||
every { deviceInfo.deviceId } returns deviceId
|
||||
every { deviceInfo.lastSeenTs } returns lastSeenTs
|
||||
every { deviceInfo.getBestLastSeenUserAgent() } returns lastSeenUserAgent
|
||||
every { deviceInfo.getBestLastSeenUserAgent() } returns ""
|
||||
every { getEncryptionTrustLevelForDeviceUseCase.execute(any(), cryptoDeviceInfo) } returns roomEncryptionTrustLevel
|
||||
every { checkIfSessionIsInactiveUseCase.execute(lastSeenTs) } returns isInactive
|
||||
every { parseDeviceUserAgentUseCase.execute(lastSeenUserAgent) } returns DeviceUserAgent(
|
||||
every { parseDeviceUserAgentUseCase.execute(any()) } returns DeviceExtendedInfo(
|
||||
DeviceType.MOBILE,
|
||||
"Xiaomi Mi 9T",
|
||||
"Android 11",
|
||||
"Element dbg",
|
||||
"1.5.0-dev"
|
||||
)
|
||||
|
||||
return deviceInfo
|
||||
|
|
|
@ -32,13 +32,13 @@ private val A_USER_AGENT_LIST_FOR_ANDROID = listOf(
|
|||
"Element/1.0.0 (Linux; Android 7.0; SM-G610M Build/NRD90M; Flavour GPlay; MatrixAndroidSdk2 1.0)",
|
||||
)
|
||||
private val AN_EXPECTED_RESULT_LIST_FOR_ANDROID = listOf(
|
||||
DeviceUserAgent(DeviceType.MOBILE, "Xiaomi Mi 9T", "Android 11", "Element dbg", "1.5.0-dev"),
|
||||
DeviceUserAgent(DeviceType.MOBILE, "Samsung SM-G960F", "Android 6.0.1", "Element", "1.5.0"),
|
||||
DeviceUserAgent(DeviceType.MOBILE, "Google Nexus 5", "Android 7.0", "Element", "1.5.0"),
|
||||
DeviceUserAgent(DeviceType.MOBILE, "Google (Nexus) 5", "Android 7.0", "Element", "1.5.0"),
|
||||
DeviceUserAgent(DeviceType.MOBILE, "Google (Nexus) (5)", "Android 7.0", "Element", "1.5.0"),
|
||||
DeviceUserAgent(DeviceType.MOBILE, "SM-A510F Build/MMB29", "Android 6.0.1", "Element", "1.0.0"),
|
||||
DeviceUserAgent(DeviceType.MOBILE, "SM-G610M Build/NRD90M", "Android 7.0", "Element", "1.0.0"),
|
||||
DeviceExtendedInfo(DeviceType.MOBILE, "Xiaomi Mi 9T", "Android 11", "Element dbg", "1.5.0-dev"),
|
||||
DeviceExtendedInfo(DeviceType.MOBILE, "Samsung SM-G960F", "Android 6.0.1", "Element", "1.5.0"),
|
||||
DeviceExtendedInfo(DeviceType.MOBILE, "Google Nexus 5", "Android 7.0", "Element", "1.5.0"),
|
||||
DeviceExtendedInfo(DeviceType.MOBILE, "Google (Nexus) 5", "Android 7.0", "Element", "1.5.0"),
|
||||
DeviceExtendedInfo(DeviceType.MOBILE, "Google (Nexus) (5)", "Android 7.0", "Element", "1.5.0"),
|
||||
DeviceExtendedInfo(DeviceType.MOBILE, "SM-A510F Build/MMB29", "Android 6.0.1", "Element", "1.0.0"),
|
||||
DeviceExtendedInfo(DeviceType.MOBILE, "SM-G610M Build/NRD90M", "Android 7.0", "Element", "1.0.0"),
|
||||
)
|
||||
|
||||
private val A_USER_AGENT_LIST_FOR_IOS = listOf(
|
||||
|
@ -48,10 +48,10 @@ private val A_USER_AGENT_LIST_FOR_IOS = listOf(
|
|||
"Element/1.8.21 (iPad Pro (12.9-inch) (3rd generation); iOS 15.2; Scale/3.00)",
|
||||
)
|
||||
private val AN_EXPECTED_RESULT_LIST_FOR_IOS = listOf(
|
||||
DeviceUserAgent(DeviceType.MOBILE, "iPhone", "iOS 15.2", "Element", "1.8.21"),
|
||||
DeviceUserAgent(DeviceType.MOBILE, "iPhone XS Max", "iOS 15.2", "Element", "1.8.21"),
|
||||
DeviceUserAgent(DeviceType.MOBILE, "iPad Pro (11-inch)", "iOS 15.2", "Element", "1.8.21"),
|
||||
DeviceUserAgent(DeviceType.MOBILE, "iPad Pro (12.9-inch) (3rd generation)", "iOS 15.2",
|
||||
DeviceExtendedInfo(DeviceType.MOBILE, "iPhone", "iOS 15.2", "Element", "1.8.21"),
|
||||
DeviceExtendedInfo(DeviceType.MOBILE, "iPhone XS Max", "iOS 15.2", "Element", "1.8.21"),
|
||||
DeviceExtendedInfo(DeviceType.MOBILE, "iPad Pro (11-inch)", "iOS 15.2", "Element", "1.8.21"),
|
||||
DeviceExtendedInfo(DeviceType.MOBILE, "iPad Pro (12.9-inch) (3rd generation)", "iOS 15.2",
|
||||
"Element", "1.8.21"),
|
||||
)
|
||||
|
||||
|
@ -61,8 +61,8 @@ private val A_USER_AGENT_LIST_FOR_DESKTOP = listOf(
|
|||
"Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) ElementNightly/2022091301 Chrome/104.0.5112.102 Electron/20.1.1 Safari/537.36",
|
||||
)
|
||||
private val AN_EXPECTED_RESULT_LIST_FOR_DESKTOP = listOf(
|
||||
DeviceUserAgent(DeviceType.DESKTOP, "Electron", "Macintosh", null, null),
|
||||
DeviceUserAgent(DeviceType.DESKTOP, "Electron", "Windows NT 10.0", null, null),
|
||||
DeviceExtendedInfo(DeviceType.DESKTOP, "Electron", "Macintosh", null, null),
|
||||
DeviceExtendedInfo(DeviceType.DESKTOP, "Electron", "Windows NT 10.0", null, null),
|
||||
)
|
||||
|
||||
private val A_USER_AGENT_LIST_FOR_WEB = listOf(
|
||||
|
@ -77,15 +77,15 @@ private val A_USER_AGENT_LIST_FOR_WEB = listOf(
|
|||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.246",
|
||||
)
|
||||
private val AN_EXPECTED_RESULT_LIST_FOR_WEB = listOf(
|
||||
DeviceUserAgent(DeviceType.WEB, "Chrome", "Macintosh", null, null),
|
||||
DeviceUserAgent(DeviceType.WEB, "Chrome", "Windows NT 10.0", null, null),
|
||||
DeviceUserAgent(DeviceType.WEB, "Firefox", "Macintosh", null, null),
|
||||
DeviceUserAgent(DeviceType.WEB, "Safari", "Macintosh", null, null),
|
||||
DeviceUserAgent(DeviceType.WEB, "Chrome", "Android 9", null, null),
|
||||
DeviceUserAgent(DeviceType.WEB, "Safari", "iPad", null, null),
|
||||
DeviceUserAgent(DeviceType.WEB, "Safari", "iPhone", null, null),
|
||||
DeviceUserAgent(DeviceType.WEB, "Firefox", "Windows NT 6.0", null, null),
|
||||
DeviceUserAgent(DeviceType.WEB, "Edge", "Windows NT 10.0", null, null),
|
||||
DeviceExtendedInfo(DeviceType.WEB, "Chrome", "Macintosh", null, null),
|
||||
DeviceExtendedInfo(DeviceType.WEB, "Chrome", "Windows NT 10.0", null, null),
|
||||
DeviceExtendedInfo(DeviceType.WEB, "Firefox", "Macintosh", null, null),
|
||||
DeviceExtendedInfo(DeviceType.WEB, "Safari", "Macintosh", null, null),
|
||||
DeviceExtendedInfo(DeviceType.WEB, "Chrome", "Android 9", null, null),
|
||||
DeviceExtendedInfo(DeviceType.WEB, "Safari", "iPad", null, null),
|
||||
DeviceExtendedInfo(DeviceType.WEB, "Safari", "iPhone", null, null),
|
||||
DeviceExtendedInfo(DeviceType.WEB, "Firefox", "Windows NT 6.0", null, null),
|
||||
DeviceExtendedInfo(DeviceType.WEB, "Edge", "Windows NT 10.0", null, null),
|
||||
)
|
||||
|
||||
private val AN_UNKNOWN_USER_AGENT_LIST = listOf(
|
||||
|
@ -93,8 +93,8 @@ private val AN_UNKNOWN_USER_AGENT_LIST = listOf(
|
|||
"Curl Client/1.0",
|
||||
)
|
||||
private val AN_UNKNOWN_USER_AGENT_EXPECTED_RESULT_LIST = listOf(
|
||||
DeviceUserAgent(DeviceType.UNKNOWN, null, null, null, null),
|
||||
DeviceUserAgent(DeviceType.UNKNOWN, null, null, null, null),
|
||||
DeviceExtendedInfo(DeviceType.UNKNOWN, null, null, null, null),
|
||||
DeviceExtendedInfo(DeviceType.UNKNOWN, null, null, null, null),
|
||||
)
|
||||
|
||||
class ParseDeviceUserAgentUseCaseTest {
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
package im.vector.app.features.settings.devices.v2.filter
|
||||
|
||||
import im.vector.app.features.settings.devices.v2.DeviceFullInfo
|
||||
import im.vector.app.features.settings.devices.v2.DeviceUserAgent
|
||||
import im.vector.app.features.settings.devices.v2.DeviceExtendedInfo
|
||||
import im.vector.app.features.settings.devices.v2.list.DeviceType
|
||||
import org.amshove.kluent.shouldBeEqualTo
|
||||
import org.amshove.kluent.shouldContainAll
|
||||
|
@ -37,7 +37,7 @@ private val activeVerifiedDevice = DeviceFullInfo(
|
|||
roomEncryptionTrustLevel = RoomEncryptionTrustLevel.Trusted,
|
||||
isInactive = false,
|
||||
isCurrentDevice = true,
|
||||
deviceUserAgent = DeviceUserAgent(DeviceType.MOBILE)
|
||||
deviceExtendedInfo = DeviceExtendedInfo(DeviceType.MOBILE)
|
||||
)
|
||||
private val inactiveVerifiedDevice = DeviceFullInfo(
|
||||
deviceInfo = DeviceInfo(deviceId = "INACTIVE_VERIFIED_DEVICE"),
|
||||
|
@ -49,7 +49,7 @@ private val inactiveVerifiedDevice = DeviceFullInfo(
|
|||
roomEncryptionTrustLevel = RoomEncryptionTrustLevel.Trusted,
|
||||
isInactive = true,
|
||||
isCurrentDevice = false,
|
||||
deviceUserAgent = DeviceUserAgent(DeviceType.MOBILE)
|
||||
deviceExtendedInfo = DeviceExtendedInfo(DeviceType.MOBILE)
|
||||
)
|
||||
private val activeUnverifiedDevice = DeviceFullInfo(
|
||||
deviceInfo = DeviceInfo(deviceId = "ACTIVE_UNVERIFIED_DEVICE"),
|
||||
|
@ -61,7 +61,7 @@ private val activeUnverifiedDevice = DeviceFullInfo(
|
|||
roomEncryptionTrustLevel = RoomEncryptionTrustLevel.Warning,
|
||||
isInactive = false,
|
||||
isCurrentDevice = false,
|
||||
deviceUserAgent = DeviceUserAgent(DeviceType.MOBILE)
|
||||
deviceExtendedInfo = DeviceExtendedInfo(DeviceType.MOBILE)
|
||||
)
|
||||
private val inactiveUnverifiedDevice = DeviceFullInfo(
|
||||
deviceInfo = DeviceInfo(deviceId = "INACTIVE_UNVERIFIED_DEVICE"),
|
||||
|
@ -73,7 +73,7 @@ private val inactiveUnverifiedDevice = DeviceFullInfo(
|
|||
roomEncryptionTrustLevel = RoomEncryptionTrustLevel.Warning,
|
||||
isInactive = true,
|
||||
isCurrentDevice = false,
|
||||
deviceUserAgent = DeviceUserAgent(DeviceType.MOBILE)
|
||||
deviceExtendedInfo = DeviceExtendedInfo(DeviceType.MOBILE)
|
||||
)
|
||||
|
||||
private val devices = listOf(
|
||||
|
|
|
@ -19,7 +19,7 @@ package im.vector.app.features.settings.devices.v2.overview
|
|||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.asFlow
|
||||
import im.vector.app.features.settings.devices.v2.DeviceFullInfo
|
||||
import im.vector.app.features.settings.devices.v2.DeviceUserAgent
|
||||
import im.vector.app.features.settings.devices.v2.DeviceExtendedInfo
|
||||
import im.vector.app.features.settings.devices.v2.ParseDeviceUserAgentUseCase
|
||||
import im.vector.app.features.settings.devices.v2.list.CheckIfSessionIsInactiveUseCase
|
||||
import im.vector.app.features.settings.devices.v2.list.DeviceType
|
||||
|
@ -92,7 +92,7 @@ class GetDeviceFullInfoUseCaseTest {
|
|||
val isInactive = false
|
||||
val isCurrentDevice = true
|
||||
every { checkIfSessionIsInactiveUseCase.execute(any()) } returns isInactive
|
||||
every { parseDeviceUserAgentUseCase.execute(any()) } returns DeviceUserAgent(DeviceType.MOBILE)
|
||||
every { parseDeviceUserAgentUseCase.execute(any()) } returns DeviceExtendedInfo(DeviceType.MOBILE)
|
||||
|
||||
// When
|
||||
val deviceFullInfo = getDeviceFullInfoUseCase.execute(A_DEVICE_ID).firstOrNull()
|
||||
|
@ -104,7 +104,7 @@ class GetDeviceFullInfoUseCaseTest {
|
|||
roomEncryptionTrustLevel = trustLevel,
|
||||
isInactive = isInactive,
|
||||
isCurrentDevice = isCurrentDevice,
|
||||
deviceUserAgent = DeviceUserAgent(DeviceType.MOBILE)
|
||||
deviceExtendedInfo = DeviceExtendedInfo(DeviceType.MOBILE)
|
||||
)
|
||||
verify { fakeActiveSessionHolder.instance.getSafeActiveSession() }
|
||||
verify { getCurrentSessionCrossSigningInfoUseCase.execute() }
|
||||
|
|
Loading…
Reference in a new issue