- ADD isFacebookUser

- MOD isFacebookUser Property to facebookUser
This commit is contained in:
Giuseppe Nucifora 2016-04-21 12:29:24 +02:00
parent a62ec71f98
commit 531bd9966a
3 changed files with 25 additions and 5 deletions

View File

@ -8,7 +8,7 @@
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = "PNObject" s.name = "PNObject"
s.version = "0.7.2" s.version = "0.7.3"
s.summary = "PNObject is a simple replica of the more complex ParseObject" s.summary = "PNObject is a simple replica of the more complex ParseObject"
# This description is used to generate tags and improve search results. # This description is used to generate tags and improve search results.

View File

@ -122,6 +122,8 @@
- (UIImage* _Nonnull) userProfileImage:(BOOL) forceReload; - (UIImage* _Nonnull) userProfileImage:(BOOL) forceReload;
- (BOOL) isFacebookUser;
//- (void) setPassword:(NSString * _Nonnull)password inBackGroundWithBlock:(nullable void (^)(BOOL saveStatus, id responseObject, NSError * error)) responseBlock; //- (void) setPassword:(NSString * _Nonnull)password inBackGroundWithBlock:(nullable void (^)(BOOL saveStatus, id responseObject, NSError * error)) responseBlock;
///-------------------------------------- ///--------------------------------------
@ -200,10 +202,8 @@
* <#Description#> * <#Description#>
*/ */
@property (nonatomic, strong, nullable) NSNumber * loginCount; @property (nonatomic, strong, nullable) NSNumber * loginCount;
/**
* <#Description#> @property (nonatomic) BOOL facebookUser;
*/
@property (nonatomic) BOOL isFacebookUser;
/** /**
* <#Description#> * <#Description#>
*/ */

View File

@ -154,6 +154,7 @@ static bool isFirstAccess = YES;
NSLogDebug(@"%@",[responseObject objectForKey:@"user"]); NSLogDebug(@"%@",[responseObject objectForKey:@"user"]);
[[[self class] currentUser] populateObjectFromJSON:[responseObject objectForKey:@"user"]]; [[[self class] currentUser] populateObjectFromJSON:[responseObject objectForKey:@"user"]];
[[[self class] currentUser] updateFacebookData];
[[[self class] currentUser] saveLocally]; [[[self class] currentUser] saveLocally];
[[NSNotificationCenter defaultCenter] postNotificationName:PNObjectLocalNotificationUserReloadFromServerSuccess object:nil]; [[NSNotificationCenter defaultCenter] postNotificationName:PNObjectLocalNotificationUserReloadFromServerSuccess object:nil];
@ -234,6 +235,7 @@ static bool isFirstAccess = YES;
[user setFacebookId:[result objectForKey:@"id"]]; [user setFacebookId:[result objectForKey:@"id"]];
[user setAuthenticated:YES]; [user setAuthenticated:YES];
[user setFacebookUser:YES];
[user saveLocally]; [user saveLocally];
[user reloadFormServer]; [user reloadFormServer];
@ -343,6 +345,24 @@ static bool isFirstAccess = YES;
return self.authenticated; return self.authenticated;
} }
- (BOOL) isFacebookUser {
[self updateFacebookData];
return self.facebookUser;
}
- (void) updateFacebookData {
if (self.facebookId || self.facebookAccessToken) {
self.facebookUser = YES;
}
else {
self.facebookUser = NO;
}
}
- (UIImage* _Nonnull) userProfileImage { - (UIImage* _Nonnull) userProfileImage {
return [self userProfileImage:NO]; return [self userProfileImage:NO];
} }