Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump core to version 13.23.1 #1545

Merged
merged 13 commits into from
Oct 19, 2023
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ GET requests. (Issue [#1517](https://github.com/realm/realm-kotlin/pull/1517))
* Minimum Android SDK: 16.

### Internal
* None.
* Updated to Realm Core 13.23.0, commit f8604b9fd3d2982008a1d3f5ff35e52ee9098d5b.


## 1.11.1 (2023-09-07)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,6 @@ expect object RealmInterop {
// User
fun realm_user_get_all_identities(user: RealmUserPointer): List<SyncUserIdentity>
fun realm_user_get_identity(user: RealmUserPointer): String
fun realm_user_get_auth_provider(user: RealmUserPointer): AuthProvider
fun realm_user_get_access_token(user: RealmUserPointer): String
fun realm_user_get_refresh_token(user: RealmUserPointer): String
fun realm_user_get_device_id(user: RealmUserPointer): String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1114,10 +1114,6 @@ actual object RealmInterop {
return realmc.realm_user_get_identity(user.cptr())
}

actual fun realm_user_get_auth_provider(user: RealmUserPointer): AuthProvider {
return AuthProvider.of(realmc.realm_user_get_auth_provider(user.cptr()))
}

actual fun realm_user_get_access_token(user: RealmUserPointer): String {
return realmc.realm_user_get_access_token(user.cptr())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2287,10 +2287,6 @@ actual object RealmInterop {
return realm_wrapper.realm_user_get_identity(user.cptr()).safeKString("identity")
}

actual fun realm_user_get_auth_provider(user: RealmUserPointer): AuthProvider {
return AuthProvider.of(realm_wrapper.realm_user_get_auth_provider(user.cptr()))
}

actual fun realm_user_is_logged_in(user: RealmUserPointer): Boolean {
return realm_wrapper.realm_user_is_logged_in(user.cptr())
}
Expand Down
2 changes: 1 addition & 1 deletion packages/external/core
Submodule core updated 193 files
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public interface User {
* Returns the provider type used to log the user in.
* If a user logs out, the authentication provider last used to log the user in will still be returned.
*/
@Deprecated("Property not stable, users might have multiple providers.", ReplaceWith("identities"))
clementetb marked this conversation as resolved.
Show resolved Hide resolved
public val provider: AuthenticationProvider

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class UserImpl(
override val loggedIn: Boolean
get() = RealmInterop.realm_user_is_logged_in(nativePointer)
override val provider: AuthenticationProvider
get() = AuthenticationProviderImpl.fromId(RealmInterop.realm_user_get_auth_provider(nativePointer))
get() = identities.first().provider
override val accessToken: String
get() = RealmInterop.realm_user_get_access_token(nativePointer)
override val refreshToken: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import io.realm.kotlin.TypedRealm
import io.realm.kotlin.internal.ConfigurationImpl
import io.realm.kotlin.internal.ContextLogger
import io.realm.kotlin.internal.ObjectIdImpl
import io.realm.kotlin.internal.REALM_FILE_EXTENSION
import io.realm.kotlin.internal.interop.RealmInterop
import io.realm.kotlin.internal.interop.SchemaMode
import io.realm.kotlin.internal.platform.PATH_SEPARATOR
Expand Down Expand Up @@ -606,12 +605,7 @@ public interface SyncConfiguration : Configuration {
)
}

// Remove .realm extension if user has overridden filename manually
return if (name != null) {
absolutePath.removeSuffix(REALM_FILE_EXTENSION)
} else {
absolutePath
}
return absolutePath
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ class AppTests {
Realm.open(syncConfig).close()

// Create a configuration pointing to the metadata Realm for that app
val lastSetSchemaVersion = 6L
val lastSetSchemaVersion = 7L
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. I don't really know the full consequence of this, but from this comment it seems that we should at least warn about not being able to downgrade 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are opening the metadata directly instead of opening a higher schema version with an app to trigger a schema downgrade.

I am going to create a ticket to validate what is the expected behavior when downgrading an App metadata schema.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh sorry, forgot the link to the comment I was referring to: #1528 (comment)

val metadataDir = "${app.configuration.syncRootDirectory}/mongodb-realm/${app.configuration.appId}/server-utility/metadata/"
val config = RealmConfiguration
.Builder(setOf())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1261,8 +1261,8 @@ class SyncConfigTests {
val config: SyncConfiguration = SyncConfiguration.Builder(user, partitionValue, setOf())
.name(fileName)
.build()
val suffix = pathOf("", "mongodb-realm", user.app.configuration.appId, user.id, fileName)
val suffix = pathOf("", "mongodb-realm", user.app.configuration.appId, user.id, "$fileName.realm")
assertTrue(config.path.endsWith(suffix), "${config.path} failed.")
assertEquals(fileName, config.name, "${config.name} failed.")
assertEquals("$fileName.realm", config.name, "${config.name} failed.")
}
}