- Add Profile image
This commit is contained in:
parent
c70fa606e1
commit
b6b3b5a21d
@ -40,7 +40,7 @@ PODS:
|
|||||||
- NSString-Helper (1.0.3)
|
- NSString-Helper (1.0.3)
|
||||||
- nv-ios-http-status (0.0.1)
|
- nv-ios-http-status (0.0.1)
|
||||||
- PEAR-FileManager-iOS (1.3.1)
|
- PEAR-FileManager-iOS (1.3.1)
|
||||||
- PNObject (0.3.10):
|
- PNObject (0.3.11):
|
||||||
- AFNetworking
|
- AFNetworking
|
||||||
- CodFis-Helper
|
- CodFis-Helper
|
||||||
- FBSDKCoreKit
|
- FBSDKCoreKit
|
||||||
@ -96,7 +96,7 @@ SPEC CHECKSUMS:
|
|||||||
NSString-Helper: d4c5459e8142ee6a96b070118009f08637030c2d
|
NSString-Helper: d4c5459e8142ee6a96b070118009f08637030c2d
|
||||||
nv-ios-http-status: b6c2b5fc8656cc19e0d3000dadce2080b99d0e2f
|
nv-ios-http-status: b6c2b5fc8656cc19e0d3000dadce2080b99d0e2f
|
||||||
PEAR-FileManager-iOS: 3bc403f68a53483f5629aa822f4649e40275c4d3
|
PEAR-FileManager-iOS: 3bc403f68a53483f5629aa822f4649e40275c4d3
|
||||||
PNObject: fa282ce7a3b4258f48ccb4d0f0a2ae8e09a6b7a0
|
PNObject: ad9ec93536cac8a9d777ffb849029b6b0b4c946e
|
||||||
PureLayout: f35f5384c9c4e4479df041dbe33ad7577b71ddfb
|
PureLayout: f35f5384c9c4e4479df041dbe33ad7577b71ddfb
|
||||||
RNCryptor: 59d6483908115af5c12b884db23392024e52a5fe
|
RNCryptor: 59d6483908115af5c12b884db23392024e52a5fe
|
||||||
Specta: ac94d110b865115fe60ff2c6d7281053c6f8e8a2
|
Specta: ac94d110b865115fe60ff2c6d7281053c6f8e8a2
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "PNObject",
|
"name": "PNObject",
|
||||||
"version": "0.3.10",
|
"version": "0.3.11",
|
||||||
"summary": "PNObject is a simple replica of the more complex ParseObject",
|
"summary": "PNObject is a simple replica of the more complex ParseObject",
|
||||||
"homepage": "https://github.com/giuseppenucifora/PNObject",
|
"homepage": "https://github.com/giuseppenucifora/PNObject",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@ -9,7 +9,7 @@
|
|||||||
},
|
},
|
||||||
"source": {
|
"source": {
|
||||||
"git": "https://github.com/giuseppenucifora/PNObject.git",
|
"git": "https://github.com/giuseppenucifora/PNObject.git",
|
||||||
"tag": "0.3.10"
|
"tag": "0.3.11"
|
||||||
},
|
},
|
||||||
"platforms": {
|
"platforms": {
|
||||||
"ios": "7.0"
|
"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)
|
- NSString-Helper (1.0.3)
|
||||||
- nv-ios-http-status (0.0.1)
|
- nv-ios-http-status (0.0.1)
|
||||||
- PEAR-FileManager-iOS (1.3.1)
|
- PEAR-FileManager-iOS (1.3.1)
|
||||||
- PNObject (0.3.10):
|
- PNObject (0.3.11):
|
||||||
- AFNetworking
|
- AFNetworking
|
||||||
- CodFis-Helper
|
- CodFis-Helper
|
||||||
- FBSDKCoreKit
|
- FBSDKCoreKit
|
||||||
@ -96,7 +96,7 @@ SPEC CHECKSUMS:
|
|||||||
NSString-Helper: d4c5459e8142ee6a96b070118009f08637030c2d
|
NSString-Helper: d4c5459e8142ee6a96b070118009f08637030c2d
|
||||||
nv-ios-http-status: b6c2b5fc8656cc19e0d3000dadce2080b99d0e2f
|
nv-ios-http-status: b6c2b5fc8656cc19e0d3000dadce2080b99d0e2f
|
||||||
PEAR-FileManager-iOS: 3bc403f68a53483f5629aa822f4649e40275c4d3
|
PEAR-FileManager-iOS: 3bc403f68a53483f5629aa822f4649e40275c4d3
|
||||||
PNObject: fa282ce7a3b4258f48ccb4d0f0a2ae8e09a6b7a0
|
PNObject: ad9ec93536cac8a9d777ffb849029b6b0b4c946e
|
||||||
PureLayout: f35f5384c9c4e4479df041dbe33ad7577b71ddfb
|
PureLayout: f35f5384c9c4e4479df041dbe33ad7577b71ddfb
|
||||||
RNCryptor: 59d6483908115af5c12b884db23392024e52a5fe
|
RNCryptor: 59d6483908115af5c12b884db23392024e52a5fe
|
||||||
Specta: ac94d110b865115fe60ff2c6d7281053c6f8e8a2
|
Specta: ac94d110b865115fe60ff2c6d7281053c6f8e8a2
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>FMWK</string>
|
<string>FMWK</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>0.3.10</string>
|
<string>0.3.11</string>
|
||||||
<key>CFBundleSignature</key>
|
<key>CFBundleSignature</key>
|
||||||
<string>????</string>
|
<string>????</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
|
|||||||
@ -13,7 +13,7 @@
|
|||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>BNDL</string>
|
<string>BNDL</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>0.3.10</string>
|
<string>0.3.11</string>
|
||||||
<key>CFBundleSignature</key>
|
<key>CFBundleSignature</key>
|
||||||
<string>????</string>
|
<string>????</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
Pod::Spec.new do |s|
|
Pod::Spec.new do |s|
|
||||||
s.name = "PNObject"
|
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"
|
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.
|
||||||
|
|||||||
@ -101,6 +101,10 @@
|
|||||||
*/
|
*/
|
||||||
- (BOOL) isAuthenticated;
|
- (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;
|
//- (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 autoLoginWithBlockSuccess:^(BOOL loginSuccess) {
|
||||||
[[self class] GETWithEndpointAction:@"user/profile"
|
[[self class] GETWithEndpointAction:@"user/profile"
|
||||||
progress:nil
|
progress:nil
|
||||||
success:^(NSURLSessionDataTask * _Nullable task, id _Nullable responseObject) {
|
success:^(NSURLSessionDataTask * _Nullable task, id _Nullable responseObject) {
|
||||||
|
|
||||||
NSLogDebug(@"%@",[responseObject objectForKey:@"user"]);
|
NSLogDebug(@"%@",[responseObject objectForKey:@"user"]);
|
||||||
|
|
||||||
[self populateObjectFromJSON:[responseObject objectForKey:@"user"]];
|
[self populateObjectFromJSON:[responseObject objectForKey:@"user"]];
|
||||||
[self saveLocally];
|
[self saveLocally];
|
||||||
|
|
||||||
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
|
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
|
||||||
NSLogDebug(@"%@",error);
|
NSLogDebug(@"%@",error);
|
||||||
}];
|
}];
|
||||||
} failure:^(NSError * _Nonnull error) {
|
} failure:^(NSError * _Nonnull error) {
|
||||||
NSLogDebug(@"error : %@",error);
|
NSLogDebug(@"error : %@",error);
|
||||||
}];
|
}];
|
||||||
@ -159,19 +159,19 @@ static bool isFirstAccess = YES;
|
|||||||
failure:(nullable void (^)(NSError * _Nonnull error))failure {
|
failure:(nullable void (^)(NSError * _Nonnull error))failure {
|
||||||
|
|
||||||
[[self class] POSTWithEndpointAction:@"registration/register" parameters:[self JSONFormObject]
|
[[self class] POSTWithEndpointAction:@"registration/register" parameters:[self JSONFormObject]
|
||||||
progress:nil
|
progress:nil
|
||||||
success:^(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject) {
|
success:^(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject) {
|
||||||
NSLog(@"response %@",responseObject);
|
NSLog(@"response %@",responseObject);
|
||||||
if(success){
|
if(success){
|
||||||
success(self);
|
success(self);
|
||||||
[self saveLocally];
|
[self saveLocally];
|
||||||
}
|
}
|
||||||
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
|
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
|
||||||
NSLogDebug(@"error : %ld",[error code]);
|
NSLogDebug(@"error : %ld",[error code]);
|
||||||
if (failure) {
|
if (failure) {
|
||||||
failure(error);
|
failure(error);
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -323,6 +323,36 @@ static bool isFirstAccess = YES;
|
|||||||
return self.authenticated;
|
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
|
#pragma mark PNObjectSubclassing Protocol
|
||||||
|
|
||||||
+ (NSDictionary *)objcetMapping {
|
+ (NSDictionary *)objcetMapping {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user