Skip to content

Commit 419af60

Browse files
committed
Merge releases in main
2 parents a442a4e + 6322233 commit 419af60

File tree

18 files changed

+180
-41
lines changed

18 files changed

+180
-41
lines changed

CHANGELOG.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,38 @@
2727
* None.
2828

2929

30+
## 1.10.2 (2023-07-21)
31+
32+
### Breaking Changes
33+
* None.
34+
35+
### Enhancements
36+
* None.
37+
38+
### Fixed
39+
* `RealmInstant` could be instantiated with invalid arguments. (Issue [#1443](https://github.com/realm/realm-kotlin/issues/1443))
40+
* `equals` and `hashCode` on unmanaged `RealmList` and `RealmSet` resulted in incorrect values. (Issue [#1454](https://github.com/realm/realm-kotlin/pull/1454))
41+
* [Sync] HTTP requests were not logged when the log level was set in `RealmLog.level`. (Issue [#1456](https://github.com/realm/realm-kotlin/pull/1456))
42+
* [Sync] `RealmLog.level` is set to `WARN` after creating an `App` or `Realm` configuration. (Issue [#1456](https://github.com/realm/realm-kotlin/pull/1459))
43+
44+
### Compatibility
45+
* File format: Generates Realms with file format v23.
46+
* Realm Studio 13.0.0 or above is required to open Realms created by this version.
47+
* This release is compatible with the following Kotlin releases:
48+
* Kotlin 1.8.0 and above. The K2 compiler is not supported yet.
49+
* Ktor 2.1.2 and above.
50+
* Coroutines 1.7.0 and above.
51+
* AtomicFu 0.18.3 and above.
52+
* The new memory model only. See https://github.com/realm/realm-kotlin#kotlin-memory-model-and-coroutine-compatibility
53+
* Minimum Kbson 0.3.0.
54+
* Minimum Gradle version: 6.8.3.
55+
* Minimum Android Gradle Plugin version: 4.1.3.
56+
* Minimum Android SDK: 16.
57+
58+
### Internal
59+
* Updated to Realm Core 13.17.0, commit f1e962cd447f8b69f8f7cf46a188b1c6246923c5.
60+
61+
3062
## 1.10.1 (2023-06-30)
3163

3264
### Breaking Changes

buildSrc/src/main/kotlin/Config.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ val HOST_OS: OperatingSystem = findHostOs()
6262

6363
object Realm {
6464
val ciBuild = (System.getenv("JENKINS_HOME") != null)
65-
const val version = "1.11.0-SNAPSHOT"
65+
const val version = "1.10.3-SNAPSHOT"
6666
const val group = "io.realm.kotlin"
6767
const val projectUrl = "https://realm.io"
6868
const val pluginPortalId = "io.realm.kotlin"

packages/external/core

Submodule core updated 86 files

packages/library-base/src/commonMain/kotlin/io/realm/kotlin/Configuration.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import io.realm.kotlin.internal.REALM_FILE_EXTENSION
2222
import io.realm.kotlin.internal.platform.PATH_SEPARATOR
2323
import io.realm.kotlin.internal.realmObjectCompanionOrNull
2424
import io.realm.kotlin.log.LogLevel
25+
import io.realm.kotlin.log.RealmLog
2526
import io.realm.kotlin.log.RealmLogger
2627
import io.realm.kotlin.types.BaseRealmObject
2728
import kotlinx.coroutines.CoroutineDispatcher
@@ -225,7 +226,7 @@ public interface Configuration {
225226

226227
// 'name' must be nullable as it is optional when getting SyncClient's default path!
227228
protected abstract var name: String?
228-
protected var logLevel: LogLevel = LogLevel.WARN
229+
protected var logLevel: LogLevel = RealmLog.level
229230
protected var appConfigLoggers: List<RealmLogger> = listOf()
230231
protected var realmConfigLoggers: List<RealmLogger> = listOf()
231232
protected var maxNumberOfActiveVersions: Long = Long.MAX_VALUE

packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmListInternal.kt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,21 @@ import kotlin.reflect.KClass
4646
/**
4747
* Implementation for unmanaged lists, backed by a [MutableList].
4848
*/
49-
internal class UnmanagedRealmList<E> : RealmList<E>, InternalDeleteable, MutableList<E> by mutableListOf() {
49+
internal class UnmanagedRealmList<E>(
50+
private val backingList: MutableList<E> = mutableListOf()
51+
) : RealmList<E>, InternalDeleteable, MutableList<E> by backingList {
5052
override fun asFlow(): Flow<ListChange<E>> =
5153
throw UnsupportedOperationException("Unmanaged lists cannot be observed.")
5254

5355
override fun delete() {
5456
throw UnsupportedOperationException("Unmanaged lists cannot be deleted.")
5557
}
58+
59+
override fun toString(): String = "UnmanagedRealmList{${joinToString()}}"
60+
61+
override fun equals(other: Any?): Boolean = backingList == other
62+
63+
override fun hashCode(): Int = backingList.hashCode()
5664
}
5765

5866
/**

packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmSetInternal.kt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,22 @@ import kotlin.reflect.KClass
4646
/**
4747
* Implementation for unmanaged sets, backed by a [MutableSet].
4848
*/
49-
internal class UnmanagedRealmSet<E> : RealmSet<E>, InternalDeleteable, MutableSet<E> by mutableSetOf() {
49+
internal class UnmanagedRealmSet<E>(
50+
private val backingSet: MutableSet<E> = mutableSetOf()
51+
) : RealmSet<E>, InternalDeleteable, MutableSet<E> by backingSet {
5052
override fun asFlow(): Flow<SetChange<E>> {
5153
throw UnsupportedOperationException("Unmanaged sets cannot be observed.")
5254
}
5355

5456
override fun delete() {
5557
throw UnsupportedOperationException("Unmanaged sets cannot be deleted.")
5658
}
59+
60+
override fun toString(): String = "UnmanagedRealmSet{${joinToString()}}"
61+
62+
override fun equals(other: Any?): Boolean = backingSet == other
63+
64+
override fun hashCode(): Int = backingSet.hashCode()
5765
}
5866

5967
/**

packages/library-base/src/commonMain/kotlin/io/realm/kotlin/types/RealmInstant.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,14 @@ public interface RealmInstant : Comparable<RealmInstant> {
6565
* to either [MIN] or [MAX].
6666
*/
6767
public fun from(epochSeconds: Long, nanosecondAdjustment: Int): RealmInstant {
68+
@Suppress("ComplexCondition")
69+
if ((epochSeconds > 0 && nanosecondAdjustment < 0) || (epochSeconds < 0 && nanosecondAdjustment > 0)) {
70+
throw IllegalArgumentException("Arguments must be both positive or negative.")
71+
}
6872
val secAdjustment: Long = (nanosecondAdjustment / SEC_AS_NANOSECOND).toLong()
6973
val nsAdjustment: Int = nanosecondAdjustment % SEC_AS_NANOSECOND
70-
var s: Long = epochSeconds + secAdjustment
71-
var ns: Int = nsAdjustment
74+
val s: Long = epochSeconds + secAdjustment
75+
val ns: Int = nsAdjustment
7276
if (((epochSeconds.xor(s)).and(secAdjustment.xor(s))) < 0) {
7377
return if (epochSeconds < 0) MIN else MAX
7478
}

packages/library-sync/src/commonMain/kotlin/io/realm/kotlin/mongodb/AppConfiguration.kt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public interface AppConfiguration {
125125
private var baseUrl: String = DEFAULT_BASE_URL
126126
private var dispatcher: CoroutineDispatcher? = null
127127
private var encryptionKey: ByteArray? = null
128-
private var logLevel: LogLevel = LogLevel.WARN
128+
private var logLevel: LogLevel? = null
129129
private var syncRootDirectory: String = appFilesDirectory()
130130
private var userLoggers: List<RealmLogger> = listOf()
131131
private var networkTransport: NetworkTransport? = null
@@ -309,8 +309,12 @@ public interface AppConfiguration {
309309
// configuring logging. This should be removed when `LogConfiguration` is removed.
310310
val allLoggers = mutableListOf<RealmLogger>()
311311
allLoggers.addAll(userLoggers)
312-
val logConfig = LogConfiguration(this.logLevel, allLoggers)
313-
RealmLog.level = logLevel
312+
313+
val logConfig = this.logLevel?.let {
314+
RealmLog.level = it
315+
LogConfiguration(it, allLoggers)
316+
}
317+
314318
userLoggers.forEach { RealmLog.add(it) }
315319

316320
val appNetworkDispatcherFactory = if (dispatcher != null) {
@@ -324,15 +328,11 @@ public interface AppConfiguration {
324328

325329
val appLogger = ContextLogger("Sdk")
326330
val networkTransport: (dispatcher: DispatcherHolder) -> NetworkTransport = { dispatcherHolder ->
327-
val logger: Logger? = if (logLevel <= LogLevel.DEBUG) {
328-
object : Logger {
329-
override fun log(message: String) {
330-
val obfuscatedMessage = httpLogObfuscator?.obfuscate(message)
331-
appLogger.debug(obfuscatedMessage ?: message)
332-
}
331+
val logger: Logger = object : Logger {
332+
override fun log(message: String) {
333+
val obfuscatedMessage = httpLogObfuscator?.obfuscate(message)
334+
appLogger.debug(obfuscatedMessage ?: message)
333335
}
334-
} else {
335-
null
336336
}
337337
networkTransport ?: KtorNetworkTransport(
338338
// FIXME Add AppConfiguration.Builder option to set timeout as a Duration with default \

packages/library-sync/src/commonMain/kotlin/io/realm/kotlin/mongodb/internal/AppConfigurationImpl.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public class AppConfigurationImpl @OptIn(ExperimentalKBsonSerializerApi::class)
4848
internal val networkTransportFactory: (dispatcher: DispatcherHolder) -> NetworkTransport,
4949
override val metadataMode: MetadataMode,
5050
override val syncRootDirectory: String,
51-
public val logger: LogConfiguration,
51+
public val logger: LogConfiguration?,
5252
override val appName: String?,
5353
override val appVersion: String?,
5454
internal val bundleId: String,

packages/library-sync/src/commonMain/kotlin/io/realm/kotlin/mongodb/internal/HttpClientCache.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ internal fun createClient(timeoutMs: Long, customLogger: Logger?): HttpClient {
3030
customLogger?.let {
3131
install(Logging) {
3232
logger = customLogger
33-
level = LogLevel.BODY
33+
level = LogLevel.ALL
3434
}
3535
}
3636

0 commit comments

Comments
 (0)