Skip to content

Commit b7e545a

Browse files
kraenhansenkneth
andauthored
[bindgen] Adding a app_user_as_sync_user helper (#7684)
* Adding app_user_as_sync_user * Update CHANGELOG.md Co-authored-by: Kenneth Geisshirt <[email protected]> --------- Co-authored-by: Kenneth Geisshirt <[email protected]>
1 parent 889d26d commit b7e545a

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
-----------
2020

2121
### Internals
22-
* None.
22+
* (bindgen) Exposing a function `app_user_as_sync_user` to cast the opposite way as `sync_user_as_app_user`. ([PR #7684](https://github.com/realm/realm-core/pull/7684) as a follow-up to [PR #7634](https://github.com/realm/realm-core/pull/7634))
2323

2424
----------------------------------------------
2525

bindgen/spec.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -740,6 +740,7 @@ classes:
740740
make_ssl_verify_callback: '(callback: (server_address: const std::string&, server_port: int, pem_data: std::string_view, preverify_ok: int, depth: int) off_thread -> bool) -> SSLVerifyCallback'
741741
needs_file_format_upgrade: '(config: const RealmConfig&) -> bool'
742742
sync_user_as_app_user: '(sync_user: Nullable<std::shared_ptr<SyncUser>>) -> Nullable<std::shared_ptr<User>>'
743+
app_user_as_sync_user: '(sync_user: Nullable<std::shared_ptr<User>>) -> Nullable<std::shared_ptr<SyncUser>>'
743744

744745
LogCategoryRef:
745746
cppName: util::LogCategoryRef
@@ -1208,13 +1209,13 @@ classes:
12081209
SyncUser:
12091210
cppName: SyncUser
12101211
sharedPtrWrapped: SharedSyncUser
1212+
properties:
1213+
is_logged_in: bool
12111214

12121215
User:
1213-
base: SyncUser
12141216
cppName: app::User
12151217
sharedPtrWrapped: SharedUser
12161218
properties:
1217-
is_logged_in: bool
12181219
user_id: std::string
12191220
app_id: std::string
12201221
legacy_identities: std::vector<std::string>

bindgen/src/realm_helpers.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,11 @@ struct Helpers {
290290
{
291291
return std::dynamic_pointer_cast<app::User>(sync_user);
292292
}
293+
294+
static std::shared_ptr<SyncUser> app_user_as_sync_user(std::shared_ptr<app::User> app_user)
295+
{
296+
return std::dynamic_pointer_cast<SyncUser>(app_user);
297+
}
293298
};
294299

295300
struct ObjectChangeSet {

0 commit comments

Comments
 (0)