Skip to content

Commit

Permalink
Added realm core version to app login request (#5961)
Browse files Browse the repository at this point in the history
* Added core version to app login request

* Updated changelog

* Updated changelog after pulling in master
  • Loading branch information
Michael Wilkerson-Barker authored Oct 21, 2022
1 parent c0b253d commit cb62ab5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
### Fixed
* <How do the end-user experience this issue? what was the impact?> ([#????](https://github.com/realm/realm-core/issues/????), since v?.?.?)
* None.

### Breaking changes
* None.

Expand All @@ -17,7 +17,7 @@
-----------

### Internals
* None.
* Added realm core version to the app login request ([#5959](https://github.com/realm/realm-core/issues/5959))

----------------------------------------------

Expand Down
11 changes: 10 additions & 1 deletion src/realm/object-store/sync/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -552,10 +552,13 @@ void App::attach_auth_options(BsonDocument& body)
options["appVersion"] = *m_config.local_app_version;
}

log("App: version info: platform: %1 version: %1 - sdk version: %3 - core version: %4", m_config.platform,
m_config.platform_version, m_config.sdk_version, REALM_VERSION_STRING);
options["appId"] = m_config.app_id;
options["platform"] = m_config.platform;
options["platformVersion"] = m_config.platform_version;
options["sdkVersion"] = m_config.sdk_version;
options["coreVersion"] = REALM_VERSION_STRING;

body["options"] = BsonDocument({{"device", options}});
}
Expand All @@ -564,7 +567,13 @@ void App::log_in_with_credentials(
const AppCredentials& credentials, const std::shared_ptr<SyncUser>& linking_user,
UniqueFunction<void(const std::shared_ptr<SyncUser>&, Optional<AppError>)>&& completion)
{
log("App: log_in_with_credentials");
if (would_log()) {
auto app_info = util::format("app_id: %1", m_config.app_id);
if (m_config.local_app_version) {
app_info += util::format(" - app_version: %1", *m_config.local_app_version);
}
log("App: log_in_with_credentials: %1", app_info);
}
// if we try logging in with an anonymous user while there
// is already an anonymous session active, reuse it
if (credentials.provider() == AuthProvider::ANONYMOUS) {
Expand Down
3 changes: 2 additions & 1 deletion test/object-store/sync/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3206,7 +3206,8 @@ class UnitTestTransport : public GenericNetworkTransport {
{"appVersion", "A Local App Version"},
{"platform", "Object Store Test Platform"},
{"platformVersion", "Object Store Test Platform Version"},
{"sdkVersion", "SDK Version"}}}}));
{"sdkVersion", "SDK Version"},
{"coreVersion", REALM_VERSION_STRING}}}}));

CHECK(request.timeout_ms == 60000);

Expand Down

0 comments on commit cb62ab5

Please sign in to comment.