diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 92049353..e5cda012 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -181,6 +181,7 @@ kotlin { all { languageSettings { optIn("kotlinx.cinterop.ExperimentalForeignApi") + optIn("kotlin.time.ExperimentalTime") } } diff --git a/core/src/commonMain/kotlin/com/powersync/attachments/implementation/AttachmentContextImpl.kt b/core/src/commonMain/kotlin/com/powersync/attachments/implementation/AttachmentContextImpl.kt index de64fbad..2002be6c 100644 --- a/core/src/commonMain/kotlin/com/powersync/attachments/implementation/AttachmentContextImpl.kt +++ b/core/src/commonMain/kotlin/com/powersync/attachments/implementation/AttachmentContextImpl.kt @@ -7,9 +7,9 @@ import com.powersync.attachments.AttachmentContext import com.powersync.attachments.AttachmentState import com.powersync.db.getString import com.powersync.db.internal.ConnectionContext -import kotlinx.datetime.Clock import kotlinx.serialization.encodeToString import kotlinx.serialization.json.Json +import kotlin.time.Clock /** * Default implementation of [AttachmentContext]. diff --git a/core/src/commonMain/kotlin/com/powersync/db/PowerSyncDatabaseImpl.kt b/core/src/commonMain/kotlin/com/powersync/db/PowerSyncDatabaseImpl.kt index 51880ee1..704cada8 100644 --- a/core/src/commonMain/kotlin/com/powersync/db/PowerSyncDatabaseImpl.kt +++ b/core/src/commonMain/kotlin/com/powersync/db/PowerSyncDatabaseImpl.kt @@ -42,11 +42,11 @@ import kotlinx.coroutines.flow.flow import kotlinx.coroutines.launch import kotlinx.coroutines.sync.Mutex import kotlinx.coroutines.sync.withLock -import kotlinx.datetime.Instant import kotlinx.datetime.LocalDateTime import kotlinx.datetime.TimeZone import kotlinx.datetime.toInstant import kotlin.time.Duration.Companion.milliseconds +import kotlin.time.Instant /** * A PowerSync managed database. diff --git a/core/src/commonMain/kotlin/com/powersync/sync/Instruction.kt b/core/src/commonMain/kotlin/com/powersync/sync/Instruction.kt index 1fe66704..ced90401 100644 --- a/core/src/commonMain/kotlin/com/powersync/sync/Instruction.kt +++ b/core/src/commonMain/kotlin/com/powersync/sync/Instruction.kt @@ -1,7 +1,6 @@ package com.powersync.sync import com.powersync.bucket.BucketPriority -import kotlinx.datetime.Instant import kotlinx.serialization.KSerializer import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @@ -16,6 +15,7 @@ import kotlinx.serialization.encoding.decodeStructure import kotlinx.serialization.json.JsonElement import kotlinx.serialization.json.JsonObject import kotlinx.serialization.serializer +import kotlin.time.Instant /** * An instruction sent to this SDK by the core extension to implement sync behavior. diff --git a/core/src/commonMain/kotlin/com/powersync/sync/SyncStatus.kt b/core/src/commonMain/kotlin/com/powersync/sync/SyncStatus.kt index 06710b7a..180e1429 100644 --- a/core/src/commonMain/kotlin/com/powersync/sync/SyncStatus.kt +++ b/core/src/commonMain/kotlin/com/powersync/sync/SyncStatus.kt @@ -5,8 +5,8 @@ import com.powersync.connectors.PowerSyncBackendConnector import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.SharedFlow import kotlinx.coroutines.flow.asSharedFlow -import kotlinx.datetime.Clock -import kotlinx.datetime.Instant +import kotlin.time.Clock +import kotlin.time.Instant @ConsistentCopyVisibility public data class PriorityStatusEntry internal constructor( diff --git a/core/src/commonMain/kotlin/com/powersync/sync/SyncStream.kt b/core/src/commonMain/kotlin/com/powersync/sync/SyncStream.kt index 826cdd24..f525b074 100644 --- a/core/src/commonMain/kotlin/com/powersync/sync/SyncStream.kt +++ b/core/src/commonMain/kotlin/com/powersync/sync/SyncStream.kt @@ -50,10 +50,10 @@ import kotlinx.coroutines.flow.emitAll import kotlinx.coroutines.flow.flow import kotlinx.coroutines.launch import kotlinx.coroutines.withContext -import kotlinx.datetime.Clock import kotlinx.serialization.json.JsonElement import kotlinx.serialization.json.JsonObject import kotlinx.serialization.json.encodeToJsonElement +import kotlin.time.Clock @OptIn(ExperimentalPowerSyncAPI::class) internal class SyncStream( diff --git a/demos/android-supabase-todolist/app/build.gradle.kts b/demos/android-supabase-todolist/app/build.gradle.kts index a8011368..03c4b37c 100644 --- a/demos/android-supabase-todolist/app/build.gradle.kts +++ b/demos/android-supabase-todolist/app/build.gradle.kts @@ -81,6 +81,14 @@ android { } } +kotlin { + sourceSets.all { + languageSettings { + optIn("kotlin.time.ExperimentalTime") + } + } +} + dependencies { implementation(libs.androidx.core.splashscreen) implementation(libs.androidx.core.ktx) diff --git a/demos/android-supabase-todolist/app/src/main/java/com/powersync/androidexample/powersync/Todo.kt b/demos/android-supabase-todolist/app/src/main/java/com/powersync/androidexample/powersync/Todo.kt index 5e141e29..974f2be3 100644 --- a/demos/android-supabase-todolist/app/src/main/java/com/powersync/androidexample/powersync/Todo.kt +++ b/demos/android-supabase-todolist/app/src/main/java/com/powersync/androidexample/powersync/Todo.kt @@ -15,7 +15,7 @@ import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.launch -import kotlinx.datetime.Clock +import kotlin.time.Clock internal class Todo( private val db: PowerSyncDatabase, diff --git a/demos/hello-powersync/composeApp/src/commonMain/kotlin/com/powersync/demos/util.kt b/demos/hello-powersync/composeApp/src/commonMain/kotlin/com/powersync/demos/util.kt index eaaddcf0..41ec740a 100644 --- a/demos/hello-powersync/composeApp/src/commonMain/kotlin/com/powersync/demos/util.kt +++ b/demos/hello-powersync/composeApp/src/commonMain/kotlin/com/powersync/demos/util.kt @@ -1,6 +1,5 @@ package com.powersync.demos -import kotlinx.datetime.Clock import kotlin.random.Random fun generateRandomPerson(): Pair { diff --git a/demos/supabase-todolist/shared/build.gradle.kts b/demos/supabase-todolist/shared/build.gradle.kts index 11ebc379..020e9ace 100644 --- a/demos/supabase-todolist/shared/build.gradle.kts +++ b/demos/supabase-todolist/shared/build.gradle.kts @@ -38,6 +38,12 @@ kotlin { } } sourceSets { + all { + languageSettings { + optIn("kotlin.time.ExperimentalTime") + } + } + commonMain.dependencies { // Need to use api here otherwise Database driver can't be accessed // When copying this example, replace "latest.release" with the current version available diff --git a/demos/supabase-todolist/shared/src/commonMain/kotlin/com/powersync/demos/powersync/Todo.kt b/demos/supabase-todolist/shared/src/commonMain/kotlin/com/powersync/demos/powersync/Todo.kt index 06cbf4ff..3ba47e98 100644 --- a/demos/supabase-todolist/shared/src/commonMain/kotlin/com/powersync/demos/powersync/Todo.kt +++ b/demos/supabase-todolist/shared/src/commonMain/kotlin/com/powersync/demos/powersync/Todo.kt @@ -11,7 +11,7 @@ import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.launch -import kotlinx.datetime.Clock +import kotlin.time.Clock internal class Todo( private val db: PowerSyncDatabase, diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index f0551878..75b720f4 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -13,7 +13,7 @@ idea = "243.22562.218" # Meerkat | 2024.3.1 (see https://plugins.jetbrains.com/d kermit = "2.0.5" kotlin = "2.1.21" coroutines = "1.8.1" -kotlinx-datetime = "0.6.2" +kotlinx-datetime = "0.7.1" kotlinx-io = "0.5.4" ktor = "3.1.0" rsocket = "0.20.0"