Skip to content

Commit a53d424

Browse files
committed
Fix UUID thingy
1 parent 4025194 commit a53d424

File tree

5 files changed

+14
-17
lines changed

5 files changed

+14
-17
lines changed

android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/RemoveDeviceConfirmationDialog.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import net.mullvad.mullvadvpn.lib.theme.Dimens
3333
@Composable
3434
private fun PreviewRemoveDeviceConfirmationDialog() {
3535
AppTheme {
36-
RemoveDeviceConfirmationDialog(EmptyResultBackNavigator(), device = generateDevice())
36+
RemoveDeviceConfirmationDialog(EmptyResultBackNavigator(), device = generateDevice(0))
3737
}
3838
}
3939

android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/util/PreviewData.kt

+6-4
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,18 @@ private fun generateHostname(city: GeoLocationId.City, index: Int) =
8181

8282
private const val CITY_CODE_LENGTH = 3
8383

84-
fun generateDevices(count: Int) = List(count) { generateDevice() }
84+
fun generateDevices(count: Int) = List(count) { index -> generateDevice(index) }
8585

8686
fun generateDevice(
87-
id: DeviceId = DeviceId(UUID.randomUUID()),
87+
index: Int,
88+
id: String = UUID,
8889
name: String? = null,
8990
) =
9091
Device(
91-
id = id,
92-
name = name ?: "Device ${id.value.toString().take(DEVICE_SUFFIX_LENGTH)}",
92+
id = DeviceId.fromString(id),
93+
name = name ?: "Device $index-${id.take(DEVICE_SUFFIX_LENGTH)}",
9394
DateTime.now()
9495
)
9596

9697
private const val DEVICE_SUFFIX_LENGTH = 4
98+
private const val UUID = "12345678-1234-5678-1234-567812345678"

android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/InAppNotificationController.kt

-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package net.mullvad.mullvadvpn.repository
22

3-
import java.util.UUID
43
import kotlinx.coroutines.CoroutineScope
54
import kotlinx.coroutines.flow.SharingStarted
65
import kotlinx.coroutines.flow.combine
@@ -21,7 +20,6 @@ enum class StatusLevel {
2120
}
2221

2322
sealed class InAppNotification {
24-
val uuid: UUID = UUID.randomUUID()
2523
abstract val statusLevel: StatusLevel
2624
abstract val priority: Long
2725

android/app/src/test/kotlin/net/mullvad/mullvadvpn/usecase/NewDeviceUseNotificationCaseTest.kt

+5-5
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,7 @@ class NewDeviceUseNotificationCaseTest {
2727
private val deviceName = "Frank Zebra"
2828
private val deviceState =
2929
MutableStateFlow<Device?>(
30-
Device(
31-
id = DeviceId.fromString(UUID.randomUUID().toString()),
32-
name = deviceName,
33-
creationDate = DateTime.now()
34-
)
30+
Device(id = DeviceId.fromString(UUID), name = deviceName, creationDate = DateTime.now())
3531
)
3632
private lateinit var newDeviceNotificationUseCase: NewDeviceNotificationUseCase
3733

@@ -82,4 +78,8 @@ class NewDeviceUseNotificationCaseTest {
8278
assertEquals(awaitItem(), emptyList())
8379
}
8480
}
81+
82+
companion object {
83+
private const val UUID = "12345678-1234-5678-1234-567812345678"
84+
}
8585
}

android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/AccountViewModelTest.kt

+2-5
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,7 @@ class AccountViewModelTest {
4343
private val accountExpiryState = MutableStateFlow(null)
4444

4545
private val dummyDevice =
46-
Device(
47-
id = DeviceId.fromString(java.util.UUID.randomUUID().toString()),
48-
name = "fake_name",
49-
creationDate = DateTime.now()
50-
)
46+
Device(id = DeviceId.fromString(UUID), name = "fake_name", creationDate = DateTime.now())
5147
private val dummyAccountToken: AccountToken =
5248
AccountToken(
5349
DUMMY_DEVICE_NAME,
@@ -215,5 +211,6 @@ class AccountViewModelTest {
215211
private const val PURCHASE_RESULT_EXTENSIONS_CLASS =
216212
"net.mullvad.mullvadvpn.util.PurchaseResultExtensionsKt"
217213
private const val DUMMY_DEVICE_NAME = "fake_name"
214+
private const val UUID = "12345678-1234-5678-1234-567812345678"
218215
}
219216
}

0 commit comments

Comments
 (0)