This commit is contained in:
giuseppenuc committed 2016-04-01 19:20:23 +02:00
1 parent b0bcfad332
commit de4cd554f0
104 files changed
+2211 -1744

No files matched your search

+1 -1
View File
@@ -6,7 +6,7 @@
//
//
#import <PNObject/PNObject.h>
#import "PNObject.h"
@interface PNInstallation : PNObject
+17 -1
View File
@@ -136,6 +136,11 @@ static bool isFirstAccess = YES;
- (void) reloadFormServer {
[self reloadFormServerWithBlockSuccess:nil failure:nil];
}
- (void) reloadFormServerWithBlockSuccess:(nullable void (^)(PNUser * _Nullable currentUser))success
failure:(nullable void (^)(NSError * _Nonnull error))failure {
[self autoLoginWithBlockSuccess:^(BOOL loginSuccess) {
[[self class] GETWithEndpointAction:@"user/profile"
progress:nil
@@ -145,13 +150,24 @@ static bool isFirstAccess = YES;
[[[self class] currentUser] populateObjectFromJSON:[responseObject objectForKey:@"user"]];
[[[self class] currentUser] saveLocally];
[[NSNotificationCenter defaultCenter] postNotificationName:PNObjectLocalNotificationUserReloadFromServerSuccess object:nil];
[[NSNotificationCenter defaultCenter] postNotificationName:PNObjectLocalNotificationUserReloadFromServerSuccess object:[[self class] currentUser]];
if (success) {
success([[self class] currentUser]);
}
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
NSLogDebug(@"%@",error);
if (failure) {
failure(error);
}
}];
} failure:^(NSError * _Nonnull error) {
NSLogDebug(@"error : %@",error);
if (failure) {
failure(error);
}
}];
}
+1
View File
@@ -26,6 +26,7 @@ extern NSString* _Nonnull const PNObjectLocalNotificationRefreshTokenUserSuccess
extern NSString* _Nonnull const PNObjectLocalNotificationRefreshTokenUserFail;
extern NSString* _Nonnull const PNObjectLocalNotificationUserReloadFromServerSuccess;
extern NSString* _Nonnull const PNObjectLocalNotificationUserReloadFromServerFailure;
extern NSString* _Nonnull const PNObjectLocalNotificationUserLogout;
#pragma mark -
+1
View File
@@ -25,6 +25,7 @@ NSString * const PNObjectLocalNotificationRefreshTokenUserSuccess = @"PNObjectLo
NSString * const PNObjectLocalNotificationRefreshTokenUserFail = @"PNObjectLocalNotificationRefreshTokenUserFail";
NSString * const PNObjectLocalNotificationUserReloadFromServerSuccess = @"PNObjectLocalNotificationUserReloadFromServerSuccess";
NSString * const PNObjectLocalNotificationUserReloadFromServerFailure = @"PNObjectLocalNotificationUserReloadFromServerFailure";
NSString * const PNObjectLocalNotificationUserLogout = @"PNObjectLocalNotificationUserLogout";