no message

This commit is contained in:
Giuseppe Nucifora 2016-01-18 15:43:23 +01:00
parent 2deafc8b58
commit 0de3997a2a
4 changed files with 39 additions and 27 deletions

View File

@ -170,7 +170,20 @@ static bool isFirstAccess = YES;
} }
- (void) saveLocally:(id _Nonnull) object inBackGroundWithBlock:(nullable void (^)(BOOL saveStatus, id _Nullable responseObject, NSError * _Nullable error)) responseBlock { - (void) saveLocally:(id _Nonnull) object inBackGroundWithBlock:(nullable void (^)(BOOL saveStatus, id _Nullable responseObject, NSError * _Nullable error)) responseBlock {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
__weak id responseObject = [self saveLocally:object];
if ([responseObject isKindOfClass:[NSError class]]) {
if (responseBlock) {
responseBlock(NO, nil, responseObject);
}
}
else if ([[responseObject class] isSubclassOfClass:[PNObject class]]){
if (responseBlock) {
responseBlock(YES,responseObject, nil);
}
}
});
} }
- (id _Nonnull) pushObjectAndSaveLocally:(id _Nonnull) object { - (id _Nonnull) pushObjectAndSaveLocally:(id _Nonnull) object {

View File

@ -11,13 +11,13 @@
@interface PNAddress : PNObject <PNObjectSubclassing> @interface PNAddress : PNObject <PNObjectSubclassing>
@property (nonatomic, strong) NSString *country; @property (nonatomic, strong) NSString * _Nullable country;
@property (nonatomic, strong) NSString *province; @property (nonatomic, strong) NSString * _Nullable province;
@property (nonatomic, strong) NSString *city; @property (nonatomic, strong) NSString * _Nullable city;
@property (nonatomic, strong) NSString *street; @property (nonatomic, strong) NSString * _Nullable street;
@property (nonatomic, strong) NSNumber *number; @property (nonatomic, strong) NSNumber * _Nullable number;
@property (nonatomic, strong) NSString *zip; @property (nonatomic, strong) NSString * _Nullable zip;
@property (nonatomic, strong) NSString *istruction; @property (nonatomic, strong) NSString * _Nullable istruction;
@property (nonatomic, strong) PNLocation *location; @property (nonatomic, strong) PNLocation * _Nullable location;
@end @end

View File

@ -7,37 +7,37 @@
// //
#import "PNObject.h" #import "PNObject.h"
#import "PNAddress.h"
@interface PNUser : PNObject @interface PNUser : PNObject
@property (strong, nonatomic) NSString *userId; @property (strong, nonatomic) NSString * _Nonnull userId;
@property (strong, nonatomic) NSString *firstName; @property (strong, nonatomic) NSString * _Nonnull firstName;
@property (strong, nonatomic) NSString *lastName; @property (strong, nonatomic) NSString * _Nonnull lastName;
@property (nonatomic, strong) NSString *profileImage; @property (nonatomic, strong) NSString * _Nullable profileImage;
@property (nonatomic, strong) NSString *sex; @property (nonatomic, strong) NSString * _Nullable sex;
@property (nonatomic, strong) NSDate *birthDate; @property (nonatomic, strong) NSDate * _Nullable birthDate;
@property (nonatomic, strong) NSString *phone; @property (nonatomic, strong) NSString * _Nullable phone;
@property (nonatomic) BOOL hasAcceptedPrivacy; @property (nonatomic) BOOL hasAcceptedPrivacy;
@property (nonatomic) BOOL hasAcceptedNewsletter; @property (nonatomic) BOOL hasAcceptedNewsletter;
@property (nonatomic) BOOL hasVerifiedEmail; @property (nonatomic) BOOL hasVerifiedEmail;
@property (nonatomic, strong) NSDate *emailVerifiedDate; @property (nonatomic, strong) NSDate * _Nullable emailVerifiedDate;
@property (nonatomic, strong) NSString *email; @property (nonatomic, strong) NSString * _Nonnull email;
@property (nonatomic, strong) NSString *username; @property (nonatomic, strong) NSString * _Nonnull username;
@property (nonatomic, strong) NSString *password; @property (nonatomic, strong) NSString * _Nonnull password;
@property (nonatomic) BOOL publicProfile; @property (nonatomic) BOOL publicProfile;
@property (nonatomic) NSInteger loginCount; @property (nonatomic) NSInteger loginCount;
@property (strong, nonatomic) NSDate *createdAt; @property (strong, nonatomic) NSDate * _Nonnull createdAt;
@property (nonatomic, strong) NSString *facebookId; @property (nonatomic, strong) NSString * _Nullable facebookId;
@property (nonatomic, strong) NSString *facebookAccessToken; @property (nonatomic, strong) NSString * _Nullable facebookAccessToken;
@property (nonatomic, strong) PNAddress *address;
/** /**
* gets singleton object of current user session. * gets singleton object of current user session.
* *
* @return singleton * @return singleton
*/ */
+ (instancetype) currentUser; + (instancetype _Nonnull) currentUser;
- (BOOL) isValidPassword:(NSString* _Nonnull) password; - (BOOL) isValidPassword:(NSString* _Nonnull) password;

View File

@ -130,7 +130,6 @@ static bool isFirstAccess = YES;
@"createdAt":@"created_at", @"createdAt":@"created_at",
@"facebookId":@"facebookId", @"facebookId":@"facebookId",
@"facebookAccessToken":@"facebookAccessToken", @"facebookAccessToken":@"facebookAccessToken",
@"address":@{@"key":@"address",@"type":@"PNAddress"}
}; };
return mapping; return mapping;
} }