- Add Profile image
This commit is contained in:
parent
c70fa606e1
commit
b6b3b5a21d
@ -40,7 +40,7 @@ PODS:
|
||||
- NSString-Helper (1.0.3)
|
||||
- nv-ios-http-status (0.0.1)
|
||||
- PEAR-FileManager-iOS (1.3.1)
|
||||
- PNObject (0.3.10):
|
||||
- PNObject (0.3.11):
|
||||
- AFNetworking
|
||||
- CodFis-Helper
|
||||
- FBSDKCoreKit
|
||||
@ -96,7 +96,7 @@ SPEC CHECKSUMS:
|
||||
NSString-Helper: d4c5459e8142ee6a96b070118009f08637030c2d
|
||||
nv-ios-http-status: b6c2b5fc8656cc19e0d3000dadce2080b99d0e2f
|
||||
PEAR-FileManager-iOS: 3bc403f68a53483f5629aa822f4649e40275c4d3
|
||||
PNObject: fa282ce7a3b4258f48ccb4d0f0a2ae8e09a6b7a0
|
||||
PNObject: ad9ec93536cac8a9d777ffb849029b6b0b4c946e
|
||||
PureLayout: f35f5384c9c4e4479df041dbe33ad7577b71ddfb
|
||||
RNCryptor: 59d6483908115af5c12b884db23392024e52a5fe
|
||||
Specta: ac94d110b865115fe60ff2c6d7281053c6f8e8a2
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "PNObject",
|
||||
"version": "0.3.10",
|
||||
"version": "0.3.11",
|
||||
"summary": "PNObject is a simple replica of the more complex ParseObject",
|
||||
"homepage": "https://github.com/giuseppenucifora/PNObject",
|
||||
"license": "MIT",
|
||||
@ -9,7 +9,7 @@
|
||||
},
|
||||
"source": {
|
||||
"git": "https://github.com/giuseppenucifora/PNObject.git",
|
||||
"tag": "0.3.10"
|
||||
"tag": "0.3.11"
|
||||
},
|
||||
"platforms": {
|
||||
"ios": "7.0"
|
||||
|
||||
4
Example/Pods/Manifest.lock
generated
4
Example/Pods/Manifest.lock
generated
@ -40,7 +40,7 @@ PODS:
|
||||
- NSString-Helper (1.0.3)
|
||||
- nv-ios-http-status (0.0.1)
|
||||
- PEAR-FileManager-iOS (1.3.1)
|
||||
- PNObject (0.3.10):
|
||||
- PNObject (0.3.11):
|
||||
- AFNetworking
|
||||
- CodFis-Helper
|
||||
- FBSDKCoreKit
|
||||
@ -96,7 +96,7 @@ SPEC CHECKSUMS:
|
||||
NSString-Helper: d4c5459e8142ee6a96b070118009f08637030c2d
|
||||
nv-ios-http-status: b6c2b5fc8656cc19e0d3000dadce2080b99d0e2f
|
||||
PEAR-FileManager-iOS: 3bc403f68a53483f5629aa822f4649e40275c4d3
|
||||
PNObject: fa282ce7a3b4258f48ccb4d0f0a2ae8e09a6b7a0
|
||||
PNObject: ad9ec93536cac8a9d777ffb849029b6b0b4c946e
|
||||
PureLayout: f35f5384c9c4e4479df041dbe33ad7577b71ddfb
|
||||
RNCryptor: 59d6483908115af5c12b884db23392024e52a5fe
|
||||
Specta: ac94d110b865115fe60ff2c6d7281053c6f8e8a2
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.3.10</string>
|
||||
<string>0.3.11</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>BNDL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.3.10</string>
|
||||
<string>0.3.11</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "PNObject"
|
||||
s.version = "0.3.10"
|
||||
s.version = "0.3.11"
|
||||
s.summary = "PNObject is a simple replica of the more complex ParseObject"
|
||||
|
||||
# This description is used to generate tags and improve search results.
|
||||
|
||||
@ -101,6 +101,10 @@
|
||||
*/
|
||||
- (BOOL) isAuthenticated;
|
||||
|
||||
- (UIImage* _Nonnull) userProfileImage;
|
||||
|
||||
- (UIImage* _Nonnull) userProfileImage:(BOOL) forceReload;
|
||||
|
||||
//- (void) setPassword:(NSString * _Nonnull)password inBackGroundWithBlock:(nullable void (^)(BOOL saveStatus, id responseObject, NSError * error)) responseBlock;
|
||||
|
||||
///--------------------------------------
|
||||
|
||||
@ -139,17 +139,17 @@ static bool isFirstAccess = YES;
|
||||
|
||||
[self autoLoginWithBlockSuccess:^(BOOL loginSuccess) {
|
||||
[[self class] GETWithEndpointAction:@"user/profile"
|
||||
progress:nil
|
||||
success:^(NSURLSessionDataTask * _Nullable task, id _Nullable responseObject) {
|
||||
progress:nil
|
||||
success:^(NSURLSessionDataTask * _Nullable task, id _Nullable responseObject) {
|
||||
|
||||
NSLogDebug(@"%@",[responseObject objectForKey:@"user"]);
|
||||
NSLogDebug(@"%@",[responseObject objectForKey:@"user"]);
|
||||
|
||||
[self populateObjectFromJSON:[responseObject objectForKey:@"user"]];
|
||||
[self saveLocally];
|
||||
[self populateObjectFromJSON:[responseObject objectForKey:@"user"]];
|
||||
[self saveLocally];
|
||||
|
||||
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
|
||||
NSLogDebug(@"%@",error);
|
||||
}];
|
||||
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
|
||||
NSLogDebug(@"%@",error);
|
||||
}];
|
||||
} failure:^(NSError * _Nonnull error) {
|
||||
NSLogDebug(@"error : %@",error);
|
||||
}];
|
||||
@ -159,19 +159,19 @@ static bool isFirstAccess = YES;
|
||||
failure:(nullable void (^)(NSError * _Nonnull error))failure {
|
||||
|
||||
[[self class] POSTWithEndpointAction:@"registration/register" parameters:[self JSONFormObject]
|
||||
progress:nil
|
||||
success:^(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject) {
|
||||
NSLog(@"response %@",responseObject);
|
||||
if(success){
|
||||
success(self);
|
||||
[self saveLocally];
|
||||
}
|
||||
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
|
||||
NSLogDebug(@"error : %ld",[error code]);
|
||||
if (failure) {
|
||||
failure(error);
|
||||
}
|
||||
}];
|
||||
progress:nil
|
||||
success:^(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject) {
|
||||
NSLog(@"response %@",responseObject);
|
||||
if(success){
|
||||
success(self);
|
||||
[self saveLocally];
|
||||
}
|
||||
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
|
||||
NSLogDebug(@"error : %ld",[error code]);
|
||||
if (failure) {
|
||||
failure(error);
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
@ -323,6 +323,36 @@ static bool isFirstAccess = YES;
|
||||
return self.authenticated;
|
||||
}
|
||||
|
||||
- (UIImage* _Nonnull) userProfileImage {
|
||||
return [self userProfileImage:NO];
|
||||
}
|
||||
|
||||
|
||||
- (UIImage* _Nonnull) userProfileImage:(BOOL) forceReload {
|
||||
|
||||
if (!_profileImage || forceReload) {
|
||||
|
||||
if (_profileImageUrl) {
|
||||
|
||||
NSError* error = nil;
|
||||
NSData* data = [NSData dataWithContentsOfURL:_profileImageUrl options:NSDataReadingUncached error:&error];
|
||||
if (error) {
|
||||
NSLog(@"%@", [error localizedDescription]);
|
||||
return [UIImage imageNamed:@"userProfileAvatar"];
|
||||
} else {
|
||||
NSLog(@"Data has loaded successfully.");
|
||||
return [UIImage imageWithData:data];
|
||||
}
|
||||
}
|
||||
else {
|
||||
return [UIImage imageNamed:@"userProfileAvatar"];
|
||||
}
|
||||
}
|
||||
else {
|
||||
return _profileImage;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark PNObjectSubclassing Protocol
|
||||
|
||||
+ (NSDictionary *)objcetMapping {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user