diff --git a/common/build.gradle.kts b/common/build.gradle.kts index 46249ed..e25c9d8 100644 --- a/common/build.gradle.kts +++ b/common/build.gradle.kts @@ -91,6 +91,7 @@ kotlin { all { languageSettings.optIn("kotlin.ExperimentalStdlibApi") languageSettings.optIn("kotlin.time.ExperimentalTime") + languageSettings.optIn("kotlin.uuid.ExperimentalUuidApi") languageSettings.optIn("androidx.compose.animation.ExperimentalAnimationApi") languageSettings.optIn("androidx.compose.material.ExperimentalMaterialApi") languageSettings.optIn("androidx.compose.foundation.ExperimentalFoundationApi") diff --git a/common/src/androidMain/kotlin/com/artemchep/keyguard/android/PasskeyCredentialId.kt b/common/src/androidMain/kotlin/com/artemchep/keyguard/android/PasskeyCredentialId.kt index 49b5662..7bc12b0 100644 --- a/common/src/androidMain/kotlin/com/artemchep/keyguard/android/PasskeyCredentialId.kt +++ b/common/src/androidMain/kotlin/com/artemchep/keyguard/android/PasskeyCredentialId.kt @@ -1,7 +1,7 @@ package com.artemchep.keyguard.android import java.nio.ByteBuffer -import java.util.UUID +import kotlin.uuid.Uuid object PasskeyCredentialId { private const val UUID_SIZE_BYTES = Long.SIZE_BYTES * 2 @@ -11,7 +11,7 @@ object PasskeyCredentialId { ): ByteArray { val uuid = kotlin .runCatching { - UUID.fromString(credentialId) + Uuid.parse(credentialId) } // The credential id is not conforming to UUID rules, // this is fine for us (although should not happen), we @@ -20,8 +20,13 @@ object PasskeyCredentialId { return PasskeyBase64.decode(credentialId) } return ByteBuffer.allocate(UUID_SIZE_BYTES) - .putLong(uuid.mostSignificantBits) - .putLong(uuid.leastSignificantBits) + .apply { + uuid.toLongs { m, l -> + putLong(m) + putLong(l) + Unit + } + } .array() } @@ -30,7 +35,7 @@ object PasskeyCredentialId { ): String { if (data.size == UUID_SIZE_BYTES) { val bb = ByteBuffer.wrap(data) - return UUID( + return Uuid.fromLongs( bb.getLong(), bb.getLong(), ).toString() diff --git a/common/src/androidMain/kotlin/com/artemchep/keyguard/feature/yubikey/Yubi.kt b/common/src/androidMain/kotlin/com/artemchep/keyguard/feature/yubikey/Yubi.kt index 069997e..fd7e10a 100644 --- a/common/src/androidMain/kotlin/com/artemchep/keyguard/feature/yubikey/Yubi.kt +++ b/common/src/androidMain/kotlin/com/artemchep/keyguard/feature/yubikey/Yubi.kt @@ -37,7 +37,7 @@ import kotlinx.collections.immutable.PersistentMap import kotlinx.collections.immutable.persistentMapOf import kotlinx.collections.immutable.toImmutableSet import java.io.IOException -import java.util.UUID +import kotlin.uuid.Uuid @Composable actual fun rememberYubiKey( @@ -127,7 +127,7 @@ private fun YubiKitManager.rememberYubiKeyUsbState( DisposableEffect(context, this) { val callback = Callback { device: UsbYubiKeyDevice -> val info = ActiveDevice( - id = UUID.randomUUID().toString(), + id = Uuid.random().toString(), pid = device.pid, ) diff --git a/common/src/commonMain/kotlin/com/artemchep/keyguard/common/model/ToastMessage.kt b/common/src/commonMain/kotlin/com/artemchep/keyguard/common/model/ToastMessage.kt index 410faba..51b12f9 100644 --- a/common/src/commonMain/kotlin/com/artemchep/keyguard/common/model/ToastMessage.kt +++ b/common/src/commonMain/kotlin/com/artemchep/keyguard/common/model/ToastMessage.kt @@ -1,9 +1,9 @@ package com.artemchep.keyguard.common.model -import java.util.UUID +import kotlin.uuid.Uuid data class ToastMessage( - val id: String = UUID.randomUUID().toString(), + val id: String = Uuid.random().toString(), val type: Type? = null, val title: String, val text: String? = null, diff --git a/common/src/commonMain/kotlin/com/artemchep/keyguard/common/usecase/DeviceIdUseCase.kt b/common/src/commonMain/kotlin/com/artemchep/keyguard/common/usecase/DeviceIdUseCase.kt index ec56eb9..e7a33e2 100644 --- a/common/src/commonMain/kotlin/com/artemchep/keyguard/common/usecase/DeviceIdUseCase.kt +++ b/common/src/commonMain/kotlin/com/artemchep/keyguard/common/usecase/DeviceIdUseCase.kt @@ -7,7 +7,7 @@ import com.artemchep.keyguard.common.io.io import com.artemchep.keyguard.common.service.id.IdRepository import org.kodein.di.DirectDI import org.kodein.di.instance -import java.util.UUID +import kotlin.uuid.Uuid class DeviceIdUseCase( private val deviceIdRepository: IdRepository, @@ -45,4 +45,4 @@ class DeviceIdUseCase( } } -private fun getDeviceId() = UUID.randomUUID().toString() +private fun getDeviceId() = Uuid.random().toString() diff --git a/common/src/commonMain/kotlin/com/artemchep/keyguard/common/usecase/impl/MessageHub.kt b/common/src/commonMain/kotlin/com/artemchep/keyguard/common/usecase/impl/MessageHub.kt index 24e067d..be112f6 100644 --- a/common/src/commonMain/kotlin/com/artemchep/keyguard/common/usecase/impl/MessageHub.kt +++ b/common/src/commonMain/kotlin/com/artemchep/keyguard/common/usecase/impl/MessageHub.kt @@ -4,7 +4,7 @@ import com.artemchep.keyguard.common.model.ToastMessage import com.artemchep.keyguard.common.usecase.MessageHub import com.artemchep.keyguard.common.usecase.ShowMessage import org.kodein.di.DirectDI -import java.util.UUID +import kotlin.uuid.Uuid class MessageHubImpl() : MessageHub, ShowMessage { constructor(directDI: DirectDI) : this() @@ -21,7 +21,7 @@ class MessageHubImpl() : MessageHub, ShowMessage { key: String, onMessage: (ToastMessage) -> Unit, ): () -> Unit { - val id = UUID.randomUUID().toString() + val id = Uuid.random().toString() val entry = Entry( id = id, key = key, diff --git a/common/src/commonMain/kotlin/com/artemchep/keyguard/core/store/bitwarden/BitwardenCipher.kt b/common/src/commonMain/kotlin/com/artemchep/keyguard/core/store/bitwarden/BitwardenCipher.kt index ab4ff0d..69af42e 100644 --- a/common/src/commonMain/kotlin/com/artemchep/keyguard/core/store/bitwarden/BitwardenCipher.kt +++ b/common/src/commonMain/kotlin/com/artemchep/keyguard/core/store/bitwarden/BitwardenCipher.kt @@ -5,8 +5,8 @@ import kotlinx.datetime.Clock import kotlinx.datetime.Instant import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable -import java.util.UUID import kotlin.time.Duration.Companion.days +import kotlin.uuid.Uuid @Serializable @optics @@ -317,7 +317,7 @@ fun BitwardenCipher.Companion.generated(): BitwardenCipher { "Cum ita esset affecta, secundum non recte, si voluptas esset bonum, fuisse desideraturam. Idcirco enim non desideraret, quia, quod dolore caret, id in hominum consuetudine facilius fieri poterit et iustius?", ) return BitwardenCipher( - cipherId = UUID.randomUUID().toString(), + cipherId = Uuid.random().toString(), accountId = accountIds.random(), folderId = folderIds.random(), revisionDate = Clock.System.now().minus(20L.days), diff --git a/common/src/commonMain/kotlin/com/artemchep/keyguard/core/store/bitwarden/BitwardenToken.kt b/common/src/commonMain/kotlin/com/artemchep/keyguard/core/store/bitwarden/BitwardenToken.kt index a24f157..8b0da55 100644 --- a/common/src/commonMain/kotlin/com/artemchep/keyguard/core/store/bitwarden/BitwardenToken.kt +++ b/common/src/commonMain/kotlin/com/artemchep/keyguard/core/store/bitwarden/BitwardenToken.kt @@ -5,11 +5,11 @@ import com.artemchep.keyguard.provider.bitwarden.ServerEnv import com.artemchep.keyguard.provider.bitwarden.ServerHeader import kotlinx.datetime.Instant import kotlinx.serialization.Serializable -import java.util.UUID +import kotlin.uuid.Uuid @Serializable data class BitwardenToken( - val id: String = UUID.randomUUID().toString(), + val id: String = Uuid.random().toString(), val key: Key, val token: Token? = null, val user: User, diff --git a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/auth/login/LoginStateProducer.kt b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/auth/login/LoginStateProducer.kt index 61b6ea9..081c9cd 100644 --- a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/auth/login/LoginStateProducer.kt +++ b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/auth/login/LoginStateProducer.kt @@ -64,7 +64,7 @@ import org.kodein.di.compose.localDI import org.kodein.di.direct import org.kodein.di.instance import java.io.Serializable -import java.util.UUID +import kotlin.uuid.Uuid private const val TAG = "login" @@ -850,7 +850,7 @@ suspend fun RememberStateFlowScope.foo3( val initialState = Foo2InitialState( items = initial .associateBy { - UUID.randomUUID().toString() + Uuid.random().toString() } .map { entry -> Foo2InitialState.Item( @@ -983,7 +983,7 @@ suspend fun RememberStateFlowScope.foo( } fun add(type: String, arg: Argument?) { - val key = "$scope.items." + UUID.randomUUID().toString() + val key = "$scope.items." + Uuid.random().toString() // Remember the argument, so we can grab it and construct something // persistent from it. if (arg != null) { diff --git a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/generator/history/GeneratorHistoryItem.kt b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/generator/history/GeneratorHistoryItem.kt index bc922be..10d204c 100644 --- a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/generator/history/GeneratorHistoryItem.kt +++ b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/generator/history/GeneratorHistoryItem.kt @@ -8,7 +8,7 @@ import com.artemchep.keyguard.ui.FlatItemAction import kotlinx.collections.immutable.PersistentList import kotlinx.coroutines.flow.StateFlow import kotlinx.datetime.Instant -import java.util.UUID +import kotlin.uuid.Uuid @Immutable @optics @@ -19,7 +19,7 @@ sealed interface GeneratorHistoryItem { @Immutable data class Section( - override val id: String = UUID.randomUUID().toString(), + override val id: String = Uuid.random().toString(), val text: String? = null, val caps: Boolean = true, ) : GeneratorHistoryItem { diff --git a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/settings/accounts/model/AccountItem.kt b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/settings/accounts/model/AccountItem.kt index da49c81..b2a8689 100644 --- a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/settings/accounts/model/AccountItem.kt +++ b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/settings/accounts/model/AccountItem.kt @@ -5,7 +5,7 @@ import androidx.compose.ui.text.AnnotatedString import arrow.optics.optics import com.artemchep.keyguard.feature.home.vault.model.VaultItemIcon import com.artemchep.keyguard.ui.FlatItemAction -import java.util.UUID +import kotlin.uuid.Uuid @optics sealed interface AccountItem { @@ -15,7 +15,7 @@ sealed interface AccountItem { @optics data class Section( - override val id: String = UUID.randomUUID().toString(), + override val id: String = Uuid.random().toString(), val text: String? = null, ) : AccountItem { companion object diff --git a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/settings/component/SettingEmitMessage.kt b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/settings/component/SettingEmitMessage.kt index 34aa45d..ee03d4e 100644 --- a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/settings/component/SettingEmitMessage.kt +++ b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/settings/component/SettingEmitMessage.kt @@ -11,7 +11,7 @@ import com.artemchep.keyguard.ui.icons.icon import kotlinx.coroutines.flow.flowOf import org.kodein.di.DirectDI import org.kodein.di.instance -import java.util.UUID +import kotlin.uuid.Uuid fun settingEmitMessageProvider( directDI: DirectDI, @@ -31,7 +31,7 @@ fun settingEmitMessageProvider( val model = ToastMessage( title = "Test message", type = type, - text = UUID.randomUUID().toString(), + text = Uuid.random().toString(), ) showMessage.copy(model) }, diff --git a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/settings/component/SettingLaunchAppPicker.kt b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/settings/component/SettingLaunchAppPicker.kt index 47d41d2..391ddd1 100644 --- a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/settings/component/SettingLaunchAppPicker.kt +++ b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/settings/component/SettingLaunchAppPicker.kt @@ -19,7 +19,7 @@ import com.artemchep.keyguard.ui.icons.icon import kotlinx.coroutines.flow.flow import org.kodein.di.DirectDI import org.kodein.di.instance -import java.util.UUID +import kotlin.uuid.Uuid fun settingLaunchAppPicker( directDI: DirectDI, @@ -39,7 +39,7 @@ fun settingLaunchAppPicker( if (result is AppPickerResult.Confirm) { val model = ToastMessage( title = result.uri, - text = UUID.randomUUID().toString(), + text = Uuid.random().toString(), ) showMessage.copy(model) } diff --git a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/vault/add/AddStateProducer.kt b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/vault/add/AddStateProducer.kt index 44f433b..3c333ad 100644 --- a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/vault/add/AddStateProducer.kt +++ b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/vault/add/AddStateProducer.kt @@ -178,7 +178,7 @@ import org.kodein.di.compose.localDI import org.kodein.di.direct import org.kodein.di.instance import java.io.Serializable -import java.util.UUID +import kotlin.uuid.Uuid // TODO: Support hide password option @Composable @@ -468,7 +468,7 @@ fun produceAddScreenState( if (info != null) { val model = SkeletonAttachment.Local( identity = SkeletonAttachment.Local.Identity( - id = UUID.randomUUID().toString(), + id = Uuid.random().toString(), uri = info.uri, size = info.size, ), @@ -1593,7 +1593,7 @@ suspend fun RememberStateFlowScope.foo3( val initialState = Foo2InitialState( items = initial .associateBy { - UUID.randomUUID().toString() + Uuid.random().toString() } .map { entry -> Foo2InitialState.Item( @@ -1760,7 +1760,7 @@ suspend fun RememberStateFlowScope.foo( } fun add(type: String, arg: Argument?) { - val key = "$scope.items." + UUID.randomUUID().toString() + val key = "$scope.items." + Uuid.random().toString() // Remember the argument, so we can grab it and construct something // persistent from it. if (arg != null) { diff --git a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/vault/collections/CollectionsStateProducer.kt b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/vault/collections/CollectionsStateProducer.kt index 331e3d4..67718b1 100644 --- a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/vault/collections/CollectionsStateProducer.kt +++ b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/vault/collections/CollectionsStateProducer.kt @@ -35,7 +35,7 @@ import kotlinx.coroutines.flow.shareIn import org.kodein.di.compose.localDI import org.kodein.di.direct import org.kodein.di.instance -import java.util.UUID +import kotlin.uuid.Uuid @Composable fun collectionsScreenState( @@ -358,7 +358,7 @@ private class OrganizationDecorator : Decorator { lastOrganization = organization if (organization != null) { val itemKey = if (organization.id in seenOrganizationIds) { - val randomId = UUID.randomUUID().toString() + val randomId = Uuid.random().toString() "duplicate.$randomId" } else { organization.id diff --git a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/vault/model/VaultItem.kt b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/vault/model/VaultItem.kt index ff4b798..e202971 100644 --- a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/vault/model/VaultItem.kt +++ b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/vault/model/VaultItem.kt @@ -18,7 +18,7 @@ import com.artemchep.keyguard.ui.icons.AccentColors import kotlinx.collections.immutable.ImmutableList import kotlinx.coroutines.flow.StateFlow import kotlinx.datetime.Instant -import java.util.UUID +import kotlin.uuid.Uuid @Immutable @optics @@ -35,7 +35,7 @@ sealed interface VaultItem2 { companion object; data class Item( - val key: String = UUID.randomUUID().toString(), + val key: String = Uuid.random().toString(), val leading: (@Composable () -> Unit)? = null, val imageVector: ImageVector? = null, val title: String, @@ -67,7 +67,7 @@ sealed interface VaultItem2 { @Immutable data class Section( - override val id: String = UUID.randomUUID().toString(), + override val id: String = Uuid.random().toString(), val text: TextHolder? = null, val caps: Boolean = true, ) : VaultItem2 { diff --git a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/logs/LogsItem.kt b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/logs/LogsItem.kt index 9c87dac..15afae0 100644 --- a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/logs/LogsItem.kt +++ b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/logs/LogsItem.kt @@ -4,7 +4,7 @@ import androidx.compose.runtime.Immutable import androidx.compose.ui.text.AnnotatedString import arrow.optics.optics import com.artemchep.keyguard.common.service.logging.LogLevel -import java.util.UUID +import kotlin.uuid.Uuid @Immutable @optics @@ -15,7 +15,7 @@ sealed interface LogsItem { @Immutable data class Section( - override val id: String = UUID.randomUUID().toString(), + override val id: String = Uuid.random().toString(), val text: String? = null, val caps: Boolean = true, ) : LogsItem { diff --git a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/navigation/NavigationEntry.kt b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/navigation/NavigationEntry.kt index 1356917..f219fe0 100644 --- a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/navigation/NavigationEntry.kt +++ b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/navigation/NavigationEntry.kt @@ -18,7 +18,7 @@ import kotlinx.coroutines.launch import kotlinx.coroutines.plus import kotlinx.coroutines.suspendCancellableCoroutine import kotlinx.coroutines.withContext -import java.util.UUID +import kotlin.uuid.Uuid interface NavigationEntry : BackPressInterceptorHost { companion object { @@ -83,7 +83,7 @@ data class NavigationEntryImpl( override fun interceptBackPress( block: () -> Unit, ): () -> Unit { - val id = UUID.randomUUID().toString() + val id = Uuid.random().toString() val entry = BackPressInterceptorRegistration( id = id, block = block, diff --git a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/navigation/NavigationRouter.kt b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/navigation/NavigationRouter.kt index f5c0e92..5635996 100644 --- a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/navigation/NavigationRouter.kt +++ b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/navigation/NavigationRouter.kt @@ -14,7 +14,7 @@ import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.flow.flatMapLatest import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.map -import java.util.UUID +import kotlin.uuid.Uuid @Composable fun NavigationRouter( @@ -295,7 +295,7 @@ private fun NavigationIntentScope.exec( val r = intent.route val e = NavigationEntryImpl( source = "router", - id = UUID.randomUUID().toString(), + id = Uuid.random().toString(), parent = scope, route = r, ) @@ -308,7 +308,7 @@ private fun NavigationIntentScope.exec( val r = intent.route val e = NavigationEntryImpl( source = "router", - id = UUID.randomUUID().toString(), + id = Uuid.random().toString(), parent = scope, route = r, ) @@ -343,7 +343,7 @@ private fun NavigationIntentScope.exec( val factory = fun(route: Route): NavigationEntry = NavigationEntryImpl( source = "router", - id = UUID.randomUUID().toString(), + id = Uuid.random().toString(), parent = scope, route = route, ) diff --git a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/navigation/NavigationRouterBackHandler.kt b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/navigation/NavigationRouterBackHandler.kt index 4f55f3a..8311547 100644 --- a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/navigation/NavigationRouterBackHandler.kt +++ b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/navigation/NavigationRouterBackHandler.kt @@ -7,7 +7,7 @@ import androidx.compose.runtime.remember import kotlinx.collections.immutable.PersistentMap import kotlinx.collections.immutable.persistentMapOf import kotlinx.coroutines.flow.MutableStateFlow -import java.util.UUID +import kotlin.uuid.Uuid /** * A definition of the distinct application component that @@ -48,7 +48,7 @@ class BackHandler( controller: NavigationController, backStack: List, ): () -> Unit { - val id = UUID.randomUUID().toString() + val id = Uuid.random().toString() eek.value = eek.value.put( key = id, value = Entry( @@ -67,7 +67,7 @@ class BackHandler( onBack: () -> Unit, priority: Int, ): () -> Unit { - val id = UUID.randomUUID().toString() + val id = Uuid.random().toString() eek2.value = eek2.value.put( key = id, value = Entry2( diff --git a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/send/SendItem.kt b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/send/SendItem.kt index 74782fa..72d0cd9 100644 --- a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/send/SendItem.kt +++ b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/send/SendItem.kt @@ -9,7 +9,7 @@ import com.artemchep.keyguard.feature.attachments.SelectableItemState import com.artemchep.keyguard.feature.home.vault.model.VaultItemIcon import kotlinx.coroutines.flow.StateFlow import kotlinx.datetime.Instant -import java.util.UUID +import kotlin.uuid.Uuid @Immutable @optics @@ -20,7 +20,7 @@ sealed interface SendItem { @Immutable data class Section( - override val id: String = UUID.randomUUID().toString(), + override val id: String = Uuid.random().toString(), val text: String? = null, val caps: Boolean = true, ) : SendItem { diff --git a/common/src/commonMain/kotlin/com/artemchep/keyguard/ui/surface/BackgroundManager.kt b/common/src/commonMain/kotlin/com/artemchep/keyguard/ui/surface/BackgroundManager.kt index 5468801..52cae28 100644 --- a/common/src/commonMain/kotlin/com/artemchep/keyguard/ui/surface/BackgroundManager.kt +++ b/common/src/commonMain/kotlin/com/artemchep/keyguard/ui/surface/BackgroundManager.kt @@ -6,7 +6,7 @@ import androidx.compose.runtime.DisposableEffect import androidx.compose.runtime.mutableStateMapOf import androidx.compose.runtime.staticCompositionLocalOf import androidx.compose.ui.graphics.Color -import java.util.UUID +import kotlin.uuid.Uuid class BackgroundManager { private val surfaceColorsState = mutableStateMapOf() @@ -42,7 +42,7 @@ class BackgroundManager { fun register( color: Color, ): () -> Unit { - val key = UUID.randomUUID().toString() + val key = Uuid.random().toString() surfaceColorsState[key] = color return { diff --git a/common/src/commonMain/kotlin/com/artemchep/keyguard/ui/text/AnnotatedResource.kt b/common/src/commonMain/kotlin/com/artemchep/keyguard/ui/text/AnnotatedResource.kt index 66a8044..9d0a633 100644 --- a/common/src/commonMain/kotlin/com/artemchep/keyguard/ui/text/AnnotatedResource.kt +++ b/common/src/commonMain/kotlin/com/artemchep/keyguard/ui/text/AnnotatedResource.kt @@ -9,7 +9,7 @@ import androidx.compose.ui.text.withStyle import com.artemchep.keyguard.feature.navigation.state.TranslatorScope import org.jetbrains.compose.resources.StringResource import org.jetbrains.compose.resources.stringResource -import java.util.UUID +import kotlin.uuid.Uuid @Composable fun annotatedResource( @@ -20,7 +20,7 @@ fun annotatedResource( // arguments. Later, we will replace those with // actual values. val placeholders = remember { - Array(args.size) { UUID.randomUUID().toString() } + Array(args.size) { Uuid.random().toString() } } val value = stringResource(resource, *placeholders) return remember(value) { @@ -40,7 +40,7 @@ suspend fun TranslatorScope.annotate( // arguments. Later, we will replace those with // actual values. val placeholders = - Array(args.size) { UUID.randomUUID().toString() } + Array(args.size) { Uuid.random().toString() } val value = translate(resource, *placeholders) return rebuild( value, diff --git a/common/src/jvmMain/kotlin/com/artemchep/keyguard/crypto/CryptoGeneratorImpl.kt b/common/src/jvmMain/kotlin/com/artemchep/keyguard/crypto/CryptoGeneratorImpl.kt index 7d5a643..887d53d 100644 --- a/common/src/jvmMain/kotlin/com/artemchep/keyguard/crypto/CryptoGeneratorImpl.kt +++ b/common/src/jvmMain/kotlin/com/artemchep/keyguard/crypto/CryptoGeneratorImpl.kt @@ -10,9 +10,9 @@ import org.bouncycastle.crypto.generators.Argon2BytesGenerator import org.bouncycastle.crypto.params.Argon2Parameters import java.security.MessageDigest import java.security.SecureRandom -import java.util.UUID import javax.crypto.Mac import javax.crypto.spec.SecretKeySpec +import kotlin.uuid.Uuid class CryptoGeneratorJvm() : CryptoGenerator { companion object { @@ -92,7 +92,7 @@ class CryptoGeneratorJvm() : CryptoGenerator { return md.digest() } - override fun uuid(): String = UUID.randomUUID().toString() + override fun uuid(): String = Uuid.random().toString() override fun random(): Int = secureRandom.nextInt() diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 8b87e76..c43e3bf 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -72,7 +72,7 @@ kdrag0nColorKt = "1.0.5" # https://github.com/Kodein-Framework/Kodein-DI kodeinDi = "7.22.0" # https://github.com/JetBrains/kotlin -kotlin = "2.0.10" +kotlin = "2.0.20" # https://github.com/Kotlin/kotlinx.collections.immutable kotlinCollections = "0.3.7" # https://github.com/Kotlin/kotlinx.coroutines @@ -81,9 +81,9 @@ kotlinCoroutines = "1.8.1" kotlinDatetime = "0.6.1" kotlinDsl = "4.3.0" # https://github.com/Kotlin/kotlinx.serialization -kotlinSerialization = "1.7.1" +kotlinSerialization = "1.7.2" # https://github.com/google/ksp/releases -kspPlugin = "2.0.10-1.0.24" +kspPlugin = "2.0.20-1.0.24" # https://github.com/pinterest/ktlint/releases # @keep ktlint = "0.50.0"