From ed75a1632474df58b21c9a8331eec5b758cdb7cb Mon Sep 17 00:00:00 2001 From: Diamond Lewis Date: Thu, 31 Oct 2024 11:42:52 -0500 Subject: [PATCH 1/2] fix: Parse.server doesn't return server url --- Parse/Parse/Source/Parse.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Parse/Parse/Source/Parse.m b/Parse/Parse/Source/Parse.m index f00c1eed1..e97374513 100644 --- a/Parse/Parse/Source/Parse.m +++ b/Parse/Parse/Source/Parse.m @@ -135,7 +135,7 @@ + (nullable NSString *)getClientKey { + (nullable NSString *)server { ParseClientConfiguration *config = currentParseManager_ ? currentParseManager_.configuration : currentParseConfiguration_; - return currentParseManager_.configuration.server; + return config.server; } ///-------------------------------------- From 2ade0336e7d2b2921addd513b34edfcd2ef212a0 Mon Sep 17 00:00:00 2001 From: Diamond Lewis Date: Thu, 7 Nov 2024 15:13:28 -0600 Subject: [PATCH 2/2] properly handle config --- Parse/Parse/Source/Parse.m | 1 + .../Unit/ParseClientConfigurationTests.m | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/Parse/Parse/Source/Parse.m b/Parse/Parse/Source/Parse.m index e97374513..d324ea602 100644 --- a/Parse/Parse/Source/Parse.m +++ b/Parse/Parse/Source/Parse.m @@ -84,6 +84,7 @@ + (void)initializeWithConfigurationAllowingReinitialize:(ParseClientConfiguratio [manager startManaging]; currentParseManager_ = manager; + currentParseConfiguration_ = configuration; #if TARGET_OS_IOS [PFNetworkActivityIndicatorManager sharedManager].enabled = YES; diff --git a/Parse/Tests/Unit/ParseClientConfigurationTests.m b/Parse/Tests/Unit/ParseClientConfigurationTests.m index a76d7d8be..c614ca175 100644 --- a/Parse/Tests/Unit/ParseClientConfigurationTests.m +++ b/Parse/Tests/Unit/ParseClientConfigurationTests.m @@ -10,6 +10,7 @@ @import Foundation; #import "PFTestCase.h" +#import "Parse_Private.h" #import "ParseClientConfiguration.h" #import "ParseClientConfiguration_Private.h" #import "PFExtensionDataSharingTestHelper.h" @@ -145,4 +146,26 @@ - (void)testServerValidation { }]; } +- (void)testSetServerURL { + ParseClientConfiguration *config = [ParseClientConfiguration configurationWithBlock:^(id configuration) { + configuration.applicationId = @"foo"; + configuration.clientKey = @"bar"; + configuration.server = @"http://localhost"; + configuration.localDatastoreEnabled = YES; + configuration.networkRetryAttempts = 1337; + }]; + + [Parse initializeWithConfiguration:config]; + + XCTAssertEqualObjects(config.server, @"http://localhost"); + XCTAssertEqualObjects(config.server, [Parse server]); + + [Parse setServer:@"http://example.org"]; + XCTAssertEqualObjects([Parse server], @"http://example.org"); + + // Should get server from current config instead of manager + [Parse _clearCurrentManager]; + XCTAssertEqualObjects([Parse server], @"http://example.org"); +} + @end