- Fix Vari

This commit is contained in:
giuseppenuc committed 2016-01-26 00:29:37 +01:00
1 parent f569c8545c
commit 7e5a6149a8
28 files changed
+1162 -862

No files matched your search

+2 -3
View File
@@ -26,8 +26,7 @@
@property (nonatomic, strong) NSString * _Nonnull username;
@property (nonatomic, strong) NSString * _Nonnull password;
@property (nonatomic) BOOL publicProfile;
@property (nonatomic) NSInteger loginCount;
@property (strong, nonatomic) NSDate * _Nonnull createdAt;
@property (nonatomic, strong) NSNumber * _Nonnull loginCount;
@property (nonatomic, strong) NSString * _Nullable facebookId;
@property (nonatomic, strong) NSString * _Nullable facebookAccessToken;
@@ -41,6 +40,6 @@
- (BOOL) isValidPassword:(NSString* _Nonnull) password;
- (void) setPassword:(NSString * _Nonnull)password withBlock:(id _Nonnull) object inBackGroundWithBlock:(nullable void (^)(BOOL saveStatus, id _Nullable responseObject, NSError * _Nullable error)) responseBlock;
//- (void) setPassword:(NSString * _Nonnull)password inBackGroundWithBlock:(nullable void (^)(BOOL saveStatus, id _Nullable responseObject, NSError * _Nullable error)) responseBlock;
@end
+24 -13
View File
@@ -9,6 +9,7 @@
#import "PNUser.h"
#import "NSString+Helper.h"
#import "PNObjectConstants.h"
#import "PNObject+Protected.h"
@interface PNUser() <PNObjectSubclassing>
@@ -17,6 +18,8 @@
@implementation PNUser
@synthesize password = _password;
static PNUser *SINGLETON = nil;
static bool isFirstAccess = YES;
@@ -25,17 +28,18 @@ static bool isFirstAccess = YES;
+ (instancetype)sharedInstance
{
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
isFirstAccess = NO;
SINGLETON = [[super allocWithZone:NULL] init];
});
return SINGLETON;
return [self currentUser];
}
+ (instancetype) currentUser {
return [self sharedInstance];
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
isFirstAccess = NO;
SINGLETON = [[super allocWithZone:NULL] init];
});
return SINGLETON;
}
#pragma mark - Life Cycle
@@ -76,6 +80,12 @@ static bool isFirstAccess = YES;
self = [super init];
if (self) {
[self setSubClassDelegate:self];
super.JSON = [super.objectModel fetchObjectsWithClass:[self class]];
if(super.JSON){
[super populateObjectFromJSON:super.JSON];
}
}
return self;
}
@@ -89,12 +99,13 @@ static bool isFirstAccess = YES;
- (void) setPassword:(NSString *)password {
if ([password length] >= [[PNObjectConfig sharedInstance] minPasswordLenght]) {
self.password = password;
_password = password;
}
else {
NSLogDebug(@"Inserted Passord is not valid.Lenght must be >= %ld",(long)[[PNObjectConfig sharedInstance] minPasswordLenght]);
}
NSLogDebug(@"Inserted Passord is not valid.Lenght must be >= %ld",(long)[[PNObjectConfig sharedInstance] minPasswordLenght]);
}
- (BOOL) isValidPassword:(NSString* _Nonnull) password {
if ([password length] >= [[PNObjectConfig sharedInstance] minPasswordLenght]) {
return YES;
@@ -111,7 +122,8 @@ static bool isFirstAccess = YES;
+ (NSDictionary *)objcetMapping {
NSDictionary *mapping = @{@"userId":@"id",
NSDictionary *mapping = @{
@"userId":@"id",
@"firstName":@"firstName",
@"lastName":@"lastName",
@"profileImage":@"profileImage",
@@ -127,7 +139,6 @@ static bool isFirstAccess = YES;
@"username":@"username",
@"publicProfile":@"public_profile",
@"loginCount":@"login_count",
@"createdAt":@"created_at",
@"facebookId":@"facebookId",
@"facebookAccessToken":@"facebookAccessToken",
};