From 3345c95da3902977f87ab6513b99a5c58c75b470 Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Sun, 7 Apr 2024 04:17:27 +0200 Subject: [PATCH 1/6] Update base url to point to services.cloud... --- CHANGELOG.md | 12 +++++++----- Package.swift | 2 +- Realm/ObjectServerTests/SwiftObjectServerTests.swift | 5 +++++ Realm/RLMApp.h | 2 +- Realm/RLMApp.mm | 2 +- Realm/RLMAsyncTask.mm | 6 ++++-- Realm/RLMSyncSession.mm | 2 +- dependencies.list | 2 +- 8 files changed, 21 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d7f5b4c515..e6373e0a4e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,13 @@ x.y.z Release notes (yyyy-MM-dd) ============================================================= ### Enhancements -* None. +* The default base url in `AppConfiguration` has been updated to point to `services.cloud.mongodb.com`. See https://www.mongodb.com/docs/atlas/app-services/domain-migration/ for more information. ([#8512](https://github.com/realm/realm-swift/issues/8512)) ### Fixed * ([#????](https://github.com/realm/realm-swift/issues/????), since v?.?.?) -* None. +* Fix an assertion failure "m_lock_info && m_lock_info->m_file.get_path() == m_filename" that appears to be related to opening a Realm while the file is in the process of being closed on another thread ([#8507](https://github.com/realm/realm-swift/issues/8507)). +* Fixed diverging history due to a bug in the replication code when setting default null values (embedded objects included) ([Core #7536](https://github.com/realm/realm-core/issues/7536)). +* Null pointer exception may be triggered when logging out and async commits callbacks not executed ([Core #7434](https://github.com/realm/realm-core/issues/7434)) @@ -17,7 +19,7 @@ x.y.z Release notes (yyyy-MM-dd) * Xcode: 14.2-15.3.0. ### Internal -* Upgraded realm-core from ? to ? +* Upgraded realm-core from 14.4.1 to 14.5.0 10.49.1 Release notes (2024-03-22) ============================================================= @@ -35,7 +37,7 @@ x.y.z Release notes (yyyy-MM-dd) ### Compatibility -* Realm Studio: 14.0.1 or later. +* Realm Studio: 15.0.0 or later. * APIs are backwards compatible with all previous releases in the 10.x.y series. * Carthage release for Swift is built with Xcode 15.3.0. * CocoaPods: 1.10 or later. @@ -97,7 +99,7 @@ restore the backup, or it will be deleted after three months. ### Compatibility -* Realm Studio: 14.0.1 or later. +* Realm Studio: 15.0.0 or later. * APIs are backwards compatible with all previous releases in the 10.x.y series. * Carthage release for Swift is built with Xcode 15.3.0. * CocoaPods: 1.10 or later. diff --git a/Package.swift b/Package.swift index ad31db0abb..28c3c2e1c8 100644 --- a/Package.swift +++ b/Package.swift @@ -3,7 +3,7 @@ import PackageDescription import Foundation -let coreVersion = Version("14.4.1") +let coreVersion = Version("14.5.0") let cocoaVersion = Version("10.49.1") let cxxSettings: [CXXSetting] = [ diff --git a/Realm/ObjectServerTests/SwiftObjectServerTests.swift b/Realm/ObjectServerTests/SwiftObjectServerTests.swift index cdd0b5ab92..8797b3cf1e 100644 --- a/Realm/ObjectServerTests/SwiftObjectServerTests.swift +++ b/Realm/ObjectServerTests/SwiftObjectServerTests.swift @@ -631,6 +631,11 @@ class SwiftObjectServerTests: SwiftSyncTestCase { RLMCredentials.anonymous()) } + func testAppBaseUrl() { + let appConfig = AppConfiguration() + XCTAssertEqual(appConfig.baseURL, "https://services.cloud.mongodb.com") + } + // MARK: - Authentication func testInvalidCredentials() throws { diff --git a/Realm/RLMApp.h b/Realm/RLMApp.h index 87b8aeda1d..d1cb0908dc 100644 --- a/Realm/RLMApp.h +++ b/Realm/RLMApp.h @@ -42,7 +42,7 @@ typedef void(^RLMOptionalErrorBlock)(NSError * _Nullable); @interface RLMAppConfiguration : NSObject /// A custom base URL to request against. -@property (nonatomic, strong, nullable) NSString *baseURL; +@property (nonatomic, strong, null_resettable) NSString *baseURL; /// The custom transport for network calls to the server. @property (nonatomic, strong, nullable) id transport; diff --git a/Realm/RLMApp.mm b/Realm/RLMApp.mm index 1eabff0140..f8d42f20eb 100644 --- a/Realm/RLMApp.mm +++ b/Realm/RLMApp.mm @@ -223,7 +223,7 @@ static void setOptionalString(std::optional& dst, NSString *src) { } - (NSString *)baseURL { - return getOptionalString(_config.base_url); + return getOptionalString(_config.base_url) ?: RLMStringViewToNSString(app::App::default_base_url()); } - (void)setBaseURL:(nullable NSString *)baseURL { diff --git a/Realm/RLMAsyncTask.mm b/Realm/RLMAsyncTask.mm index fe5833c99f..70754cfefb 100644 --- a/Realm/RLMAsyncTask.mm +++ b/Realm/RLMAsyncTask.mm @@ -41,11 +41,13 @@ void RLMSetAsyncOpenQueue(dispatch_queue_t queue) { NSLocalizedDescriptionKey: @"Operation canceled" }]; +typedef void(^CoreProgressNotificationBlock)(NSUInteger transferredBytes, NSUInteger transferrableBytes, double estimate); + __attribute__((objc_direct_members)) @implementation RLMAsyncOpenTask { RLMUnfairMutex _mutex; std::shared_ptr _task; - std::vector _progressBlocks; + std::vector _progressBlocks; bool _cancel; RLMRealmConfiguration *_configuration; @@ -57,7 +59,7 @@ @implementation RLMAsyncOpenTask { } - (void)addProgressNotificationOnQueue:(dispatch_queue_t)queue block:(RLMProgressNotificationBlock)block { - auto wrappedBlock = ^(NSUInteger transferred_bytes, NSUInteger transferrable_bytes) { + auto wrappedBlock = ^(NSUInteger transferred_bytes, NSUInteger transferrable_bytes, double estimate) { dispatch_async(queue, ^{ @autoreleasepool { block(transferred_bytes, transferrable_bytes); diff --git a/Realm/RLMSyncSession.mm b/Realm/RLMSyncSession.mm index 97e05a8c84..bd5dfb80e0 100644 --- a/Realm/RLMSyncSession.mm +++ b/Realm/RLMSyncSession.mm @@ -217,7 +217,7 @@ - (RLMProgressNotificationToken *)addProgressNotificationForDirection:(RLMSyncPr ? SyncSession::ProgressDirection::upload : SyncSession::ProgressDirection::download); bool is_streaming = (mode == RLMSyncProgressModeReportIndefinitely); - uint64_t token = session->register_progress_notifier([=](uint64_t transferred, uint64_t transferrable) { + uint64_t token = session->register_progress_notifier([=](uint64_t transferred, uint64_t transferrable, double progress) { dispatch_async(queue, ^{ block((NSUInteger)transferred, (NSUInteger)transferrable); }); diff --git a/dependencies.list b/dependencies.list index 03a63c9649..01921e52d7 100755 --- a/dependencies.list +++ b/dependencies.list @@ -1,3 +1,3 @@ VERSION=10.49.1 -REALM_CORE_VERSION=v14.4.1 +REALM_CORE_VERSION=v14.5.0 STITCH_VERSION=8bf8ebcff6e804586c30a6ccbadb060753071a42 From 8bba0950fa6957122825df52a1de8eae2531bf6e Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Sun, 7 Apr 2024 04:19:49 +0200 Subject: [PATCH 2/6] Update changelog --- CHANGELOG.md | 1 + Realm/ObjectServerTests/SwiftObjectServerTests.swift | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e6373e0a4e..d89f2c7259 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ x.y.z Release notes (yyyy-MM-dd) * Fix an assertion failure "m_lock_info && m_lock_info->m_file.get_path() == m_filename" that appears to be related to opening a Realm while the file is in the process of being closed on another thread ([#8507](https://github.com/realm/realm-swift/issues/8507)). * Fixed diverging history due to a bug in the replication code when setting default null values (embedded objects included) ([Core #7536](https://github.com/realm/realm-core/issues/7536)). * Null pointer exception may be triggered when logging out and async commits callbacks not executed ([Core #7434](https://github.com/realm/realm-core/issues/7434)) +* `AppConfiguration.baseUrl` will now return the default value of the url when not set rather than `nil`. ([#8512](https://github.com/realm/realm-swift/issues/8512)) diff --git a/Realm/ObjectServerTests/SwiftObjectServerTests.swift b/Realm/ObjectServerTests/SwiftObjectServerTests.swift index 8797b3cf1e..41a0bcc20a 100644 --- a/Realm/ObjectServerTests/SwiftObjectServerTests.swift +++ b/Realm/ObjectServerTests/SwiftObjectServerTests.swift @@ -634,6 +634,12 @@ class SwiftObjectServerTests: SwiftSyncTestCase { func testAppBaseUrl() { let appConfig = AppConfiguration() XCTAssertEqual(appConfig.baseURL, "https://services.cloud.mongodb.com") + + appConfig.baseURL = "https://foo.bar" + XCTAssertEqual(appConfig.baseURL, "https://foo.bar") + + appConfig.baseURL = nil + XCTAssertEqual(appConfig.baseURL, "https://services.cloud.mongodb.com") } // MARK: - Authentication From 7c5a25d3618b38fd69e8bed9c4c8b5606175bfcb Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Sun, 7 Apr 2024 04:50:27 +0200 Subject: [PATCH 3/6] Force rebuild --- CHANGELOG.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d89f2c7259..747d397728 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,9 +5,9 @@ x.y.z Release notes (yyyy-MM-dd) ### Fixed * ([#????](https://github.com/realm/realm-swift/issues/????), since v?.?.?) -* Fix an assertion failure "m_lock_info && m_lock_info->m_file.get_path() == m_filename" that appears to be related to opening a Realm while the file is in the process of being closed on another thread ([#8507](https://github.com/realm/realm-swift/issues/8507)). -* Fixed diverging history due to a bug in the replication code when setting default null values (embedded objects included) ([Core #7536](https://github.com/realm/realm-core/issues/7536)). -* Null pointer exception may be triggered when logging out and async commits callbacks not executed ([Core #7434](https://github.com/realm/realm-core/issues/7434)) +* Fix an assertion failure "m_lock_info && m_lock_info->m_file.get_path() == m_filename" that appears to be related to opening a Realm while the file is in the process of being closed on another thread. ([#8507](https://github.com/realm/realm-swift/issues/8507)) +* Fixed diverging history due to a bug in the replication code when setting default null values (embedded objects included). ([Core #7536](https://github.com/realm/realm-core/issues/7536)) +* Null pointer exception may be triggered when logging out and async commits callbacks not executed. ([Core #7434](https://github.com/realm/realm-core/issues/7434)) * `AppConfiguration.baseUrl` will now return the default value of the url when not set rather than `nil`. ([#8512](https://github.com/realm/realm-swift/issues/8512)) From 0426ca814da608a29269d36237c60ff91341dbe9 Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Mon, 8 Apr 2024 14:12:16 +0200 Subject: [PATCH 4/6] un-name progress --- Realm/RLMAsyncTask.mm | 2 +- Realm/RLMSyncSession.mm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Realm/RLMAsyncTask.mm b/Realm/RLMAsyncTask.mm index 70754cfefb..a1fd240e0c 100644 --- a/Realm/RLMAsyncTask.mm +++ b/Realm/RLMAsyncTask.mm @@ -59,7 +59,7 @@ @implementation RLMAsyncOpenTask { } - (void)addProgressNotificationOnQueue:(dispatch_queue_t)queue block:(RLMProgressNotificationBlock)block { - auto wrappedBlock = ^(NSUInteger transferred_bytes, NSUInteger transferrable_bytes, double estimate) { + auto wrappedBlock = ^(NSUInteger transferred_bytes, NSUInteger transferrable_bytes, double) { dispatch_async(queue, ^{ @autoreleasepool { block(transferred_bytes, transferrable_bytes); diff --git a/Realm/RLMSyncSession.mm b/Realm/RLMSyncSession.mm index bd5dfb80e0..cc9cc8a34c 100644 --- a/Realm/RLMSyncSession.mm +++ b/Realm/RLMSyncSession.mm @@ -217,7 +217,7 @@ - (RLMProgressNotificationToken *)addProgressNotificationForDirection:(RLMSyncPr ? SyncSession::ProgressDirection::upload : SyncSession::ProgressDirection::download); bool is_streaming = (mode == RLMSyncProgressModeReportIndefinitely); - uint64_t token = session->register_progress_notifier([=](uint64_t transferred, uint64_t transferrable, double progress) { + uint64_t token = session->register_progress_notifier([=](uint64_t transferred, uint64_t transferrable, double) { dispatch_async(queue, ^{ block((NSUInteger)transferred, (NSUInteger)transferrable); }); From ae3926288a8785ad9cf4c9f30bc495a72f904957 Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Mon, 8 Apr 2024 22:57:26 +0200 Subject: [PATCH 5/6] Update docstring --- Realm/RLMApp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Realm/RLMApp.h b/Realm/RLMApp.h index d1cb0908dc..6ad37d6eb0 100644 --- a/Realm/RLMApp.h +++ b/Realm/RLMApp.h @@ -41,7 +41,7 @@ typedef void(^RLMOptionalErrorBlock)(NSError * _Nullable); /// will not have any effect. @interface RLMAppConfiguration : NSObject -/// A custom base URL to request against. +/// A custom base URL to request against. If not set or set to nil, the default base url for app services will be returned. @property (nonatomic, strong, null_resettable) NSString *baseURL; /// The custom transport for network calls to the server. From 1b7a3889644648bb8aacd742dcb6e0fea215bdb2 Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Tue, 9 Apr 2024 10:50:58 +0200 Subject: [PATCH 6/6] Fix lint --- Realm/ObjectServerTests/SwiftObjectServerTests.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Realm/ObjectServerTests/SwiftObjectServerTests.swift b/Realm/ObjectServerTests/SwiftObjectServerTests.swift index c03643bbef..0e8f1d2a31 100644 --- a/Realm/ObjectServerTests/SwiftObjectServerTests.swift +++ b/Realm/ObjectServerTests/SwiftObjectServerTests.swift @@ -634,7 +634,7 @@ class SwiftObjectServerTests: SwiftSyncTestCase { func testAppBaseUrl() { let appConfig = AppConfiguration() XCTAssertEqual(appConfig.baseURL, "https://services.cloud.mongodb.com") - + appConfig.baseURL = "https://foo.bar" XCTAssertEqual(appConfig.baseURL, "https://foo.bar")