From cb62ab547c57eefaa2abfe459cb32ef20f02847e Mon Sep 17 00:00:00 2001 From: Michael Wilkerson-Barker Date: Fri, 21 Oct 2022 15:14:08 -0400 Subject: [PATCH] Added realm core version to app login request (#5961) * Added core version to app login request * Updated changelog * Updated changelog after pulling in master --- CHANGELOG.md | 4 ++-- src/realm/object-store/sync/app.cpp | 11 ++++++++++- test/object-store/sync/app.cpp | 3 ++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e572e96618..71659e4a08e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ ### Fixed * ([#????](https://github.com/realm/realm-core/issues/????), since v?.?.?) * None. - + ### Breaking changes * None. @@ -17,7 +17,7 @@ ----------- ### Internals -* None. +* Added realm core version to the app login request ([#5959](https://github.com/realm/realm-core/issues/5959)) ---------------------------------------------- diff --git a/src/realm/object-store/sync/app.cpp b/src/realm/object-store/sync/app.cpp index 484c5e1188d..90e7700e077 100644 --- a/src/realm/object-store/sync/app.cpp +++ b/src/realm/object-store/sync/app.cpp @@ -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}}); } @@ -564,7 +567,13 @@ void App::log_in_with_credentials( const AppCredentials& credentials, const std::shared_ptr& linking_user, UniqueFunction&, Optional)>&& 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) { diff --git a/test/object-store/sync/app.cpp b/test/object-store/sync/app.cpp index 5d702822622..4d22e547729 100644 --- a/test/object-store/sync/app.cpp +++ b/test/object-store/sync/app.cpp @@ -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);