- Fi vari
This commit is contained in:
parent
bc854abc37
commit
a818aafa0c
@ -34,7 +34,7 @@
|
||||
[PNObjectConfig initSharedInstanceForEnvironments:@{EnvironmentDevelopment : @"http://packman.local/app_dev.php/api/v1/",
|
||||
EnvironmentStage : @"https://packman.ppreview.it/app_stage.php/api/v1/",
|
||||
EnvironmentProduction : @"http://packman.ppreview.it/app_stage.php/api/v1/"
|
||||
} withOauth:YES];
|
||||
} userSubclass:[User class] withOauth:YES];
|
||||
[[PNObjectConfig sharedInstance] setHTTPHeaderValue:@"application/x-www-form-urlencoded" forKey:@"Content-Type"];
|
||||
[[PNObjectConfig sharedInstance] setClientID:@"1_pqjo2w5k7j4g8skco408oc048w8so0ws840gcg8k8gwsgk0g4" clientSecret:@"10w0vg2v6eggooc4wks4w4s0wkwok0wkck0w888so0o80g88w8" forEnv:EnvironmentProduction];
|
||||
#ifdef DEBUG
|
||||
|
||||
@ -135,7 +135,7 @@
|
||||
|
||||
//if ([user isAuthenticated]) {
|
||||
|
||||
[User loginCurrentUserWithEmail:@"packman@giuseppenucifora.com" password:@"asdasdasd" withBlockSuccess:^(PNUser * _Nullable responseObject) {
|
||||
[User loginCurrentUserWithEmail:@"demo@packman.example" password:@"demo@packman.example" withBlockSuccess:^(PNUser * _Nullable responseObject) {
|
||||
|
||||
NSLog(@"response : %@",responseObject);
|
||||
|
||||
|
||||
@ -37,10 +37,10 @@ PODS:
|
||||
- FBSnapshotTestCase/SwiftSupport (2.0.7):
|
||||
- FBSnapshotTestCase/Core
|
||||
- NSDate_Utils (0.1.0)
|
||||
- NSString-Helper (1.0.2)
|
||||
- NSString-Helper (1.0.3)
|
||||
- nv-ios-http-status (0.0.1)
|
||||
- PEAR-FileManager-iOS (1.3.1)
|
||||
- PNObject (0.3.8):
|
||||
- PNObject (0.3.9):
|
||||
- AFNetworking
|
||||
- CodFis-Helper
|
||||
- FBSDKCoreKit
|
||||
@ -93,10 +93,10 @@ SPEC CHECKSUMS:
|
||||
FBSDKShareKit: 54587b4624706ace1e810cf83412a918141f807a
|
||||
FBSnapshotTestCase: 7e85180d0d141a0cf472352edda7e80d7eaeb547
|
||||
NSDate_Utils: 4a57f91094123d5b7600c7de8c9ad9e1d43306a3
|
||||
NSString-Helper: 0ee74919829a332f9838fa87b28cb2d1d991e92c
|
||||
NSString-Helper: d4c5459e8142ee6a96b070118009f08637030c2d
|
||||
nv-ios-http-status: b6c2b5fc8656cc19e0d3000dadce2080b99d0e2f
|
||||
PEAR-FileManager-iOS: 3bc403f68a53483f5629aa822f4649e40275c4d3
|
||||
PNObject: f2ff42ecb60a86983e76d460a478b15a5c57d9cf
|
||||
PNObject: d0c5fda51507511773cc512928a3b7ab9ef6088c
|
||||
PureLayout: f35f5384c9c4e4479df041dbe33ad7577b71ddfb
|
||||
RNCryptor: 59d6483908115af5c12b884db23392024e52a5fe
|
||||
Specta: ac94d110b865115fe60ff2c6d7281053c6f8e8a2
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "PNObject",
|
||||
"version": "0.3.8",
|
||||
"version": "0.3.9",
|
||||
"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.8"
|
||||
"tag": "0.3.9"
|
||||
},
|
||||
"platforms": {
|
||||
"ios": "7.0"
|
||||
|
||||
8
Example/Pods/Manifest.lock
generated
8
Example/Pods/Manifest.lock
generated
@ -37,10 +37,10 @@ PODS:
|
||||
- FBSnapshotTestCase/SwiftSupport (2.0.7):
|
||||
- FBSnapshotTestCase/Core
|
||||
- NSDate_Utils (0.1.0)
|
||||
- NSString-Helper (1.0.2)
|
||||
- NSString-Helper (1.0.3)
|
||||
- nv-ios-http-status (0.0.1)
|
||||
- PEAR-FileManager-iOS (1.3.1)
|
||||
- PNObject (0.3.8):
|
||||
- PNObject (0.3.9):
|
||||
- AFNetworking
|
||||
- CodFis-Helper
|
||||
- FBSDKCoreKit
|
||||
@ -93,10 +93,10 @@ SPEC CHECKSUMS:
|
||||
FBSDKShareKit: 54587b4624706ace1e810cf83412a918141f807a
|
||||
FBSnapshotTestCase: 7e85180d0d141a0cf472352edda7e80d7eaeb547
|
||||
NSDate_Utils: 4a57f91094123d5b7600c7de8c9ad9e1d43306a3
|
||||
NSString-Helper: 0ee74919829a332f9838fa87b28cb2d1d991e92c
|
||||
NSString-Helper: d4c5459e8142ee6a96b070118009f08637030c2d
|
||||
nv-ios-http-status: b6c2b5fc8656cc19e0d3000dadce2080b99d0e2f
|
||||
PEAR-FileManager-iOS: 3bc403f68a53483f5629aa822f4649e40275c4d3
|
||||
PNObject: f2ff42ecb60a86983e76d460a478b15a5c57d9cf
|
||||
PNObject: d0c5fda51507511773cc512928a3b7ab9ef6088c
|
||||
PureLayout: f35f5384c9c4e4479df041dbe33ad7577b71ddfb
|
||||
RNCryptor: 59d6483908115af5c12b884db23392024e52a5fe
|
||||
Specta: ac94d110b865115fe60ff2c6d7281053c6f8e8a2
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
- (BOOL) isValidEmail
|
||||
{
|
||||
BOOL stricterFilter = YES;
|
||||
NSString *stricterFilterString = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}";
|
||||
NSString *stricterFilterString = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,15}";
|
||||
NSString *laxString = @".+@.+\\.[A-Za-z]{2}[A-Za-z]*";
|
||||
NSString *emailRegex = stricterFilter ? stricterFilterString : laxString;
|
||||
NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegex];
|
||||
|
||||
1850
Example/Pods/Pods.xcodeproj/project.pbxproj
generated
1850
Example/Pods/Pods.xcodeproj/project.pbxproj
generated
File diff suppressed because it is too large
Load Diff
@ -14,7 +14,7 @@
|
||||
buildForArchiving = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = 'primary'
|
||||
BlueprintIdentifier = 'FB7B8B19AE1F5E597E5C759195549ABD'
|
||||
BlueprintIdentifier = 'C8C004A101D5139E1B027E4C65815A0A'
|
||||
BlueprintName = 'PNObject'
|
||||
ReferencedContainer = 'container:Pods.xcodeproj'
|
||||
BuildableName = 'PNObject.framework'>
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0.2</string>
|
||||
<string>1.0.3</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>BNDL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0.2</string>
|
||||
<string>1.0.3</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.3.8</string>
|
||||
<string>0.3.9</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
#import "PNObject.h"
|
||||
#import "PNObjectConfig.h"
|
||||
#import "PNObjectConstants.h"
|
||||
#import "PNObjectFormData.h"
|
||||
#import "PNObjectModel.h"
|
||||
#import "AFJSONResponseSerializerWithData.h"
|
||||
#import "AFHTTPRequestSerializer+OAuth2.h"
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>BNDL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.3.8</string>
|
||||
<string>0.3.9</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.9"
|
||||
s.version = "0.3.10"
|
||||
s.summary = "PNObject is a simple replica of the more complex ParseObject"
|
||||
|
||||
# This description is used to generate tags and improve search results.
|
||||
|
||||
@ -272,6 +272,8 @@ static bool isFirstAccess = YES;
|
||||
|
||||
[[PNObjectConfig sharedInstance] refreshTokenForUserWithEmail:email password:password withBlockSuccess:^(BOOL refreshSuccess) {
|
||||
if (refreshSuccess) {
|
||||
|
||||
|
||||
PNUser *user = [[self class] new];
|
||||
|
||||
PNObjcPassword *objectPassword = [PNObjcPassword new];
|
||||
@ -353,7 +355,7 @@ static bool isFirstAccess = YES;
|
||||
}
|
||||
|
||||
+ (NSString *)objectClassName {
|
||||
return @"User";
|
||||
return @"PNUser";
|
||||
}
|
||||
|
||||
+ (NSString *) objectEndPoint {
|
||||
|
||||
@ -41,7 +41,7 @@ extern NSString* _Nonnull const Client_Secret;
|
||||
/**
|
||||
* Oauth is NO by default
|
||||
*
|
||||
* @param clientIdsForEnvironments
|
||||
* @param endpointUrlsForEnvironments
|
||||
* For example,
|
||||
* @{ PNObjectConfigDevelopment : @"https://development.it/api/v1",
|
||||
* PNObjectConfigEnvStage : @"ttps://stage.it/api/v1",
|
||||
@ -52,10 +52,25 @@ extern NSString* _Nonnull const Client_Secret;
|
||||
*/
|
||||
+ (instancetype _Nonnull) initSharedInstanceForEnvironments:(NSDictionary * _Nonnull) endpointUrlsForEnvironments;
|
||||
|
||||
/**
|
||||
* <#Description#>
|
||||
*
|
||||
* @param endpointUrlsForEnvironments
|
||||
* For example,
|
||||
* @{ PNObjectConfigDevelopment : @"https://development.it/api/v1",
|
||||
* PNObjectConfigEnvStage : @"ttps://stage.it/api/v1",
|
||||
* PNObjectConfigEnvProduction : @"ttps://production.it/api/v1"
|
||||
* }
|
||||
* @param userSubClass <#userSubClass description#>
|
||||
*
|
||||
* @return <#return value description#>
|
||||
*/
|
||||
+ (instancetype _Nonnull) initSharedInstanceForEnvironments:(NSDictionary * _Nonnull) endpointUrlsForEnvironments andUserSubclass:(Class _Nonnull) userSubClass;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param clientIdsForEnvironments
|
||||
* @param endpointUrlsForEnvironments
|
||||
* For example,
|
||||
* @{ PNObjectConfigDevelopment : @"https://development.it/api/v1",
|
||||
* PNObjectConfigEnvStage : @"ttps://stage.it/api/v1",
|
||||
@ -67,6 +82,21 @@ extern NSString* _Nonnull const Client_Secret;
|
||||
*/
|
||||
+ (instancetype _Nonnull) initSharedInstanceForEnvironments:(NSDictionary * _Nonnull) endpointUrlsForEnvironments withOauth:(BOOL) oauthEnabled;
|
||||
|
||||
/**
|
||||
* <#Description#>
|
||||
*
|
||||
* @param endpointUrlsForEnvironments
|
||||
* For example,
|
||||
* @{ PNObjectConfigDevelopment : @"https://development.it/api/v1",
|
||||
* PNObjectConfigEnvStage : @"ttps://stage.it/api/v1",
|
||||
* PNObjectConfigEnvProduction : @"ttps://production.it/api/v1"
|
||||
* }
|
||||
* @param userSubClass <#userSubClass description#>
|
||||
* @param oauthEnabled <#oauthEnabled description#>
|
||||
*
|
||||
* @return <#return value description#>
|
||||
*/
|
||||
+ (instancetype _Nonnull) initSharedInstanceForEnvironments:(NSDictionary * _Nonnull) endpointUrlsForEnvironments userSubclass:(Class _Nonnull) userSubClass withOauth:(BOOL) oauthEnabled;
|
||||
/**
|
||||
* <#Description#>
|
||||
*
|
||||
|
||||
@ -47,6 +47,7 @@ NSString* const Client_Secret = @"client_secret";
|
||||
@property (nonatomic, strong) NSString *currentOAuthClientID;
|
||||
@property (nonatomic, strong) NSString *currentOAuthClientSecret;
|
||||
//@property (nonatomic, strong) NSMutableDictionary *environments;
|
||||
@property (nonatomic) Class userSubClass;
|
||||
|
||||
@end
|
||||
|
||||
@ -74,14 +75,24 @@ static bool isFirstAccess = YES;
|
||||
#pragma mark - Life Cycle
|
||||
|
||||
+ (instancetype) initSharedInstanceForEnvironments:(NSDictionary *) endpointUrlsForEnvironments {
|
||||
return [self initSharedInstanceForEnvironments:endpointUrlsForEnvironments withOauth:NO];
|
||||
return [self initSharedInstanceForEnvironments:endpointUrlsForEnvironments userSubclass:[PNUser class] withOauth:NO];
|
||||
}
|
||||
|
||||
+ (instancetype) initSharedInstanceForEnvironments:(NSDictionary *)endpointUrlsForEnvironments andUserSubclass:(Class)userSubClass {
|
||||
return [self initSharedInstanceForEnvironments:endpointUrlsForEnvironments userSubclass:userSubClass withOauth:NO];
|
||||
}
|
||||
|
||||
|
||||
+ (instancetype) initSharedInstanceForEnvironments:(NSDictionary *) endpointUrlsForEnvironments withOauth:(BOOL) oauthEnabled {
|
||||
return [self initSharedInstanceForEnvironments:endpointUrlsForEnvironments userSubclass:[PNUser class] withOauth:oauthEnabled];
|
||||
}
|
||||
|
||||
+ (instancetype _Nonnull) initSharedInstanceForEnvironments:(NSDictionary * _Nonnull) endpointUrlsForEnvironments userSubclass:(Class _Nonnull) userSubClass withOauth:(BOOL) oauthEnabled {
|
||||
SINGLETON = [self sharedInstance];
|
||||
|
||||
if (SINGLETON) {
|
||||
SINGLETON.oauthEnabled = oauthEnabled;
|
||||
SINGLETON.userSubClass = userSubClass;
|
||||
for (NSString *key in [endpointUrlsForEnvironments allKeys]) {
|
||||
|
||||
NSURL * endpointUrl = [NSURL URLWithString:[endpointUrlsForEnvironments objectForKey:key]];
|
||||
@ -232,7 +243,9 @@ static bool isFirstAccess = YES;
|
||||
}
|
||||
|
||||
- (void) refreshToken {
|
||||
if([PNUser currentUser] && [[PNUser currentUser] hasValidEmailAndPasswordData]) {
|
||||
|
||||
|
||||
if([SINGLETON.userSubClass currentUser] && [[SINGLETON.userSubClass currentUser] hasValidEmailAndPasswordData]) {
|
||||
[self refreshTokenForUser];
|
||||
}
|
||||
else {
|
||||
@ -248,7 +261,7 @@ static bool isFirstAccess = YES;
|
||||
- (void) refreshTokenForUserWithBlockSuccess:(nullable void (^)(BOOL refreshSuccess))success
|
||||
failure:(nullable void (^)(NSError * _Nonnull error))failure {
|
||||
|
||||
if([PNUser currentUser] && [[PNUser currentUser] hasValidEmailAndPasswordData]) {
|
||||
if([SINGLETON.userSubClass currentUser] && [[SINGLETON.userSubClass currentUser] hasValidEmailAndPasswordData]) {
|
||||
[_manager authenticateUsingOAuthWithURLString:[_currentEndPointBaseUrl stringByAppendingString:@"oauth-token"] username:[[PNUser currentUser] email] password:[[[PNUser currentUser] password] password] scope:nil success:^(AFOAuthCredential * _Nonnull credential) {
|
||||
_currentOauthCredential = credential;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user