1717#import " PFHash.h"
1818#import " PFObjectUtilities.h"
1919
20+ NSString *const _ParseDefaultServerURLString = @" https://api.parse.com/1" ;
21+
2022@implementation ParseClientConfiguration
2123
2224// /--------------------------------------
@@ -32,6 +34,7 @@ - (instancetype)initEmpty {
3234 if (!self) return nil ;
3335
3436 _networkRetryAttempts = PFCommandRunningDefaultMaxAttemptsCount;
37+ _server = [_ParseDefaultServerURLString copy ];
3538
3639 return self;
3740}
@@ -57,28 +60,34 @@ + (instancetype)configurationWithBlock:(void (^)(id<ParseMutableClientConfigurat
5760// /--------------------------------------
5861
5962- (void )setApplicationId : (NSString *)applicationId {
60- PFConsistencyAssert (applicationId.length , @" 'applicationId' should not be nil." );
63+ PFParameterAssert (applicationId.length , @" 'applicationId' should not be nil." );
6164 _applicationId = [applicationId copy ];
6265}
6366
6467- (void )setClientKey : (NSString *)clientKey {
65- PFConsistencyAssert (clientKey.length , @" 'clientKey' should not be nil." );
68+ PFParameterAssert (clientKey.length , @" 'clientKey' should not be nil." );
6669 _clientKey = [clientKey copy ];
6770}
6871
72+ - (void )setServer : (NSString *)server {
73+ PFParameterAssert (server.length , @" Server should not be `nil`." );
74+ PFParameterAssert ([NSURL URLWithString: server], @" Server should be a valid URL." );
75+ _server = [server copy ];
76+ }
77+
6978- (void )setApplicationGroupIdentifier : (NSString *)applicationGroupIdentifier {
70- PFConsistencyAssert (applicationGroupIdentifier == nil ||
71- [PFFileManager isApplicationGroupContainerReachableForGroupIdentifier: applicationGroupIdentifier],
72- @" ApplicationGroupContainer is unreachable. Please double check your Xcode project settings." );
79+ PFParameterAssert (applicationGroupIdentifier == nil ||
80+ [PFFileManager isApplicationGroupContainerReachableForGroupIdentifier: applicationGroupIdentifier],
81+ @" ApplicationGroupContainer is unreachable. Please double check your Xcode project settings." );
7382
7483 _applicationGroupIdentifier = [applicationGroupIdentifier copy ];
7584}
7685
7786- (void )setContainingApplicationBundleIdentifier : (NSString *)containingApplicationBundleIdentifier {
78- PFConsistencyAssert ([PFApplication currentApplication ].extensionEnvironment ,
79- @" 'containingApplicationBundleIdentifier' cannot be set in non-extension environment" );
80- PFConsistencyAssert (containingApplicationBundleIdentifier.length ,
81- @" 'containingApplicationBundleIdentifier' should not be nil." );
87+ PFParameterAssert ([PFApplication currentApplication ].extensionEnvironment ,
88+ @" 'containingApplicationBundleIdentifier' cannot be set in non-extension environment" );
89+ PFParameterAssert (containingApplicationBundleIdentifier.length ,
90+ @" 'containingApplicationBundleIdentifier' should not be nil." );
8291
8392 _containingApplicationBundleIdentifier = containingApplicationBundleIdentifier;
8493}
@@ -104,6 +113,7 @@ - (BOOL)isEqual:(id)object {
104113 ParseClientConfiguration *other = object;
105114 return ([PFObjectUtilities isObject: self .applicationId equalToObject: other.applicationId] &&
106115 [PFObjectUtilities isObject: self .clientKey equalToObject: other.clientKey] &&
116+ [self .server isEqualToString: other.server] &&
107117 self.localDatastoreEnabled == other.localDatastoreEnabled &&
108118 [PFObjectUtilities isObject: self .applicationGroupIdentifier equalToObject: other.applicationGroupIdentifier] &&
109119 [PFObjectUtilities isObject: self .containingApplicationBundleIdentifier equalToObject: other.containingApplicationBundleIdentifier] &&
@@ -119,6 +129,7 @@ - (instancetype)copyWithZone:(NSZone *)zone {
119129 // Use direct assignment to skip over all of the assertions that may fail if we're not fully initialized yet.
120130 configuration->_applicationId = [self ->_applicationId copy ];
121131 configuration->_clientKey = [self ->_clientKey copy ];
132+ configuration->_server = [self .server copy ];
122133 configuration->_localDatastoreEnabled = self->_localDatastoreEnabled ;
123134 configuration->_applicationGroupIdentifier = [self ->_applicationGroupIdentifier copy ];
124135 configuration->_containingApplicationBundleIdentifier = [self ->_containingApplicationBundleIdentifier copy ];
0 commit comments