@@ -70,7 +70,7 @@ @implementation PFUser (Private)
70
70
71
71
- (void )setDefaultValues {
72
72
[super setDefaultValues ];
73
- self.isCurrentUser = NO ;
73
+ self._current = NO ;
74
74
}
75
75
76
76
- (BOOL )needsDefaultACL {
@@ -136,7 +136,7 @@ + (void)_assertValidInstanceClassName:(NSString *)className {
136
136
// Checks the properties on the object before saving.
137
137
- (void )_checkSaveParametersWithCurrentUser : (PFUser *)currentUser {
138
138
@synchronized ([self lock ]) {
139
- PFConsistencyAssert (self.objectId || self.isLazy ,
139
+ PFConsistencyAssert (self.objectId || self._lazy ,
140
140
@" User cannot be saved unless they are already signed up. Call signUp first." );
141
141
142
142
PFConsistencyAssert ([self _isAuthenticatedWithCurrentUser: currentUser] ||
@@ -181,7 +181,7 @@ - (NSMutableDictionary *)_convertToDictionaryForSaving:(PFOperationSet *)changes
181
181
182
182
- (BFTask *)handleSaveResultAsync : (NSDictionary *)result {
183
183
return [[super handleSaveResultAsync: result] continueWithSuccessBlock: ^id (BFTask *saveTask) {
184
- if (self.isCurrentUser ) {
184
+ if (self._current ) {
185
185
[self cleanUpAuthData ];
186
186
PFCurrentUserController *controller = [[self class ] currentUserController ];
187
187
return [[controller saveCurrentObjectAsync: self ] continueWithBlock: ^id (BFTask *task) {
@@ -233,7 +233,7 @@ - (BFTask *)_handleServiceLoginCommandResult:(PFCommandResult *)result {
233
233
}];
234
234
}
235
235
if (resultDictionary) {
236
- self.isLazy = NO ;
236
+ self._lazy = NO ;
237
237
238
238
// Serialize the object to disk so we can later access it via currentUser
239
239
PFCurrentUserController *controller = [[self class ] currentUserController ];
@@ -271,7 +271,7 @@ - (BFTask *)handleSignUpResultAsync:(BFTask *)task {
271
271
state.sessionToken = result[PFUserSessionTokenRESTKey];
272
272
state.isNew = YES ;
273
273
}];
274
- self.isLazy = NO ;
274
+ self._lazy = NO ;
275
275
}
276
276
}
277
277
return signUpTask;
@@ -380,7 +380,7 @@ - (void)_mergeFromServerWithResult:(NSDictionary *)result decoder:(PFDecoder *)d
380
380
381
381
- (void )synchronizeAuthDataWithAuthType : (NSString *)authType {
382
382
@synchronized ([self lock ]) {
383
- if (!self.isCurrentUser ) {
383
+ if (!self._current ) {
384
384
return ;
385
385
}
386
386
@@ -407,13 +407,13 @@ - (void)synchronizeAllAuthData {
407
407
408
408
- (BFTask *)resolveLazinessAsync : (BFTask *)toAwait {
409
409
@synchronized ([self lock ]) {
410
- if (!self.isLazy ) {
410
+ if (!self._lazy ) {
411
411
return [BFTask taskWithResult: self ];
412
412
}
413
413
if (self.linkedServiceNames .count == 0 ) {
414
414
// If there are no linked services, treat this like a sign-up.
415
415
return [[self signUpAsync: toAwait] continueAsyncWithSuccessBlock: ^id (BFTask *task) {
416
- self.isLazy = NO ;
416
+ self._lazy = NO ;
417
417
return self;
418
418
}];
419
419
}
@@ -458,8 +458,8 @@ - (BFTask *)_logOutAsyncWithAuthType:(NSString *)authType {
458
458
+ (instancetype )logInLazyUserWithAuthType : (NSString *)authType authData : (NSDictionary *)authData {
459
459
PFUser *user = [self user ];
460
460
@synchronized ([user lock ]) {
461
- [ user setIsCurrentUser: YES ] ;
462
- user.isLazy = YES ;
461
+ user. _current = YES ;
462
+ user._lazy = YES ;
463
463
user.authData [authType] = authData;
464
464
[user.linkedServiceNames addObject: authType];
465
465
}
@@ -497,7 +497,7 @@ - (BFTask *)signUpAsync:(BFTask *)toAwait {
497
497
// self doesn't have any outstanding saves, so we can safely merge its operations
498
498
// into the current user.
499
499
500
- PFConsistencyAssert (!isCurrentUser , @" Attempt to merge currentUser with itself." );
500
+ PFConsistencyAssert (!self. _current , @" Attempt to merge currentUser with itself." );
501
501
502
502
@synchronized ([currentUser lock ]) {
503
503
NSString *oldUsername = [currentUser.username copy ];
@@ -603,7 +603,7 @@ - (PFRESTCommand *)_constructSaveCommandForChanges:(PFOperationSet *)changes
603
603
objectEncoder : (PFEncoder *)encoder {
604
604
// If we are curent user - use the latest available session token, as it might have been changed since
605
605
// this command was enqueued.
606
- if (self.isCurrentUser ) {
606
+ if (self._current ) {
607
607
token = self.sessionToken ;
608
608
}
609
609
return [super _constructSaveCommandForChanges: changes
@@ -770,9 +770,10 @@ @implementation PFUser
770
770
@dynamic password;
771
771
772
772
// PFUser (Private):
773
- @dynamic authData;
774
- @dynamic linkedServiceNames;
775
- @dynamic isLazy;
773
+ @synthesize authData = _authData;
774
+ @synthesize linkedServiceNames = _linkedServiceNames;
775
+ @synthesize _current = _current;
776
+ @synthesize _lazy = _lazy;
776
777
777
778
+ (NSString *)parseClassName {
778
779
return @" _User" ;
@@ -783,15 +784,15 @@ + (instancetype)currentUser {
783
784
return [[controller getCurrentObjectAsync ] waitForResult: nil withMainThreadWarning: NO ];
784
785
}
785
786
786
- - (BOOL )isCurrentUser {
787
+ - (BOOL )_current {
787
788
@synchronized (self.lock ) {
788
- return isCurrentUser ;
789
+ return _current ;
789
790
}
790
791
}
791
792
792
- - (void )setIsCurrentUser : (BOOL )aBool {
793
+ - (void )set_current : (BOOL )current {
793
794
@synchronized (self.lock ) {
794
- isCurrentUser = aBool ;
795
+ _current = current ;
795
796
}
796
797
}
797
798
@@ -985,7 +986,7 @@ - (BFTask *)_logOutAsync {
985
986
[tasks addObject: task];
986
987
}];
987
988
988
- self.isCurrentUser = NO ;
989
+ self._current = NO ;
989
990
990
991
token = [self .sessionToken copy ];
991
992
@@ -1025,20 +1026,20 @@ - (void)removeObjectForKey:(NSString *)key {
1025
1026
1026
1027
- (NSMutableDictionary *)authData {
1027
1028
@synchronized ([self lock ]) {
1028
- if (!authData ) {
1029
- authData = [[NSMutableDictionary alloc ] init ];
1029
+ if (!_authData ) {
1030
+ _authData = [[NSMutableDictionary alloc ] init ];
1030
1031
}
1031
1032
}
1032
- return authData ;
1033
+ return _authData ;
1033
1034
}
1034
1035
1035
1036
- (NSMutableSet *)linkedServiceNames {
1036
1037
@synchronized ([self lock ]) {
1037
- if (!linkedServiceNames ) {
1038
- linkedServiceNames = [[NSMutableSet alloc ] init ];
1038
+ if (!_linkedServiceNames ) {
1039
+ _linkedServiceNames = [[NSMutableSet alloc ] init ];
1039
1040
}
1040
1041
}
1041
- return linkedServiceNames ;
1042
+ return _linkedServiceNames ;
1042
1043
}
1043
1044
1044
1045
+ (instancetype )user {
@@ -1054,7 +1055,7 @@ - (BFTask *)saveAsync:(BFTask *)toAwait {
1054
1055
// but not always. Using continueAsyncWithBlock unlocks from the taskQueue, and solves the proplem.
1055
1056
return [toAwait continueAsyncWithBlock: ^id (BFTask *task) {
1056
1057
@synchronized ([self lock ]) {
1057
- if (self.isLazy ) {
1058
+ if (self._lazy ) {
1058
1059
return [[self resolveLazinessAsync: toAwait] continueAsyncWithSuccessBlock: ^id (BFTask *task) {
1059
1060
return @(!!task.result );
1060
1061
}];
@@ -1066,12 +1067,12 @@ - (BFTask *)saveAsync:(BFTask *)toAwait {
1066
1067
}
1067
1068
1068
1069
- (BFTask *)fetchAsync : (BFTask *)toAwait {
1069
- if (self.isLazy ) {
1070
+ if (self._lazy ) {
1070
1071
return [BFTask taskWithResult: @YES ];
1071
1072
}
1072
1073
1073
1074
return [[super fetchAsync: toAwait] continueAsyncWithSuccessBlock: ^id (BFTask *fetchAsyncTask) {
1074
- if (self.isCurrentUser ) {
1075
+ if (self._current ) {
1075
1076
[self cleanUpAuthData ];
1076
1077
PFCurrentUserController *controller = [[self class ] currentUserController ];
1077
1078
return [[controller saveCurrentObjectAsync: self ] continueAsyncWithBlock: ^id (BFTask *task) {
@@ -1083,14 +1084,14 @@ - (BFTask *)fetchAsync:(BFTask *)toAwait {
1083
1084
}
1084
1085
1085
1086
- (instancetype )fetch : (NSError **)error {
1086
- if (self.isLazy ) {
1087
+ if (self._lazy ) {
1087
1088
return self;
1088
1089
}
1089
1090
return [super fetch: error];
1090
1091
}
1091
1092
1092
1093
- (void )fetchInBackgroundWithBlock : (PFObjectResultBlock)block {
1093
- if (self.isLazy ) {
1094
+ if (self._lazy ) {
1094
1095
if (block) {
1095
1096
block (self, nil );
1096
1097
return ;
@@ -1116,11 +1117,11 @@ - (BOOL)isAuthenticated {
1116
1117
1117
1118
- (BOOL )_isAuthenticatedWithCurrentUser : (PFUser *)currentUser {
1118
1119
@synchronized ([self lock ]) {
1119
- BOOL authenticated = self.isLazy || self.sessionToken ;
1120
+ BOOL authenticated = self._lazy || self.sessionToken ;
1120
1121
if (!authenticated && currentUser != nil ) {
1121
1122
authenticated = [self .objectId isEqualToString: currentUser.objectId];
1122
1123
} else {
1123
- authenticated = self.isCurrentUser ;
1124
+ authenticated = self._current ;
1124
1125
}
1125
1126
return authenticated;
1126
1127
}
@@ -1140,7 +1141,7 @@ - (void)signUpInBackgroundWithBlock:(PFBooleanResultBlock)block {
1140
1141
// For anonymous users, there may be an objectId. Setting the userName
1141
1142
// will have removed the anonymous link and set the value in the authData
1142
1143
// object to [NSNull null], so we can just treat it like a save operation.
1143
- if (authData[PFAnonymousUserAuthenticationType] == [NSNull null ]) {
1144
+ if (self. authData [PFAnonymousUserAuthenticationType] == [NSNull null ]) {
1144
1145
[self saveInBackgroundWithBlock: block];
1145
1146
return ;
1146
1147
}
0 commit comments