- Fix user ma
This commit is contained in:
parent
527b02a082
commit
bef8607419
@ -36,9 +36,9 @@
|
||||
EnvironmentProduction : @"http://packman.ppreview.it/app_stage.php/api/v1/"
|
||||
} withOauth:YES];
|
||||
[[PNObjectConfig sharedInstance] setHTTPHeaderValue:@"application/x-www-form-urlencoded" forKey:@"Content-Type"];
|
||||
[[PNObjectConfig sharedInstance] setClientID:@"1_pqjo2w5k7j4g8skco408oc048w8so0ws840gcg8k8gwsgk0g4" clientSecret:@"10w0vg2v6eggooc4wks4w4s0wkwok0wkck0w888so0o80g88w8" forEnv:Stage];
|
||||
[[PNObjectConfig sharedInstance] setClientID:@"1_pqjo2w5k7j4g8skco408oc048w8so0ws840gcg8k8gwsgk0g4" clientSecret:@"10w0vg2v6eggooc4wks4w4s0wkwok0wkck0w888so0o80g88w8" forEnv:EnvironmentProduction];
|
||||
#ifdef DEBUG
|
||||
[[PNObjectConfig sharedInstance] setEnvironment:Stage];
|
||||
[[PNObjectConfig sharedInstance] setEnvironment:EnvironmentStage];
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@ -106,15 +106,15 @@
|
||||
[password setPassword:@"asdasdasd"];
|
||||
[password setConfirmPassword:@"asdasdasd"];
|
||||
|
||||
User *user = [User currentUser];
|
||||
User *user = [User new];
|
||||
[user setFirstName:@"Giuseppe"];
|
||||
[user setLastName:@"Nuficora"];
|
||||
[user setEmail:@"packman@giuseppenucifora.com"];
|
||||
[user setEmail:@"packman5@giuseppenucifora.com"];
|
||||
[user setPassword:password];
|
||||
[user setHasAcceptedNewsletter:NO];
|
||||
[user setHasAcceptedNewsletter:YES];
|
||||
[user setHasAcceptedPrivacy:YES];
|
||||
|
||||
[user saveLocally];
|
||||
//[user saveLocally];
|
||||
|
||||
NSLog(@"%@",[user JSONFormObject]);
|
||||
//NSLog(@"%@",[user JSONObjectMap]);
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "PNObject"
|
||||
s.version = "0.3.7"
|
||||
s.version = "0.3.8"
|
||||
s.summary = "PNObject is a simple replica of the more complex ParseObject"
|
||||
|
||||
# This description is used to generate tags and improve search results.
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
|
||||
@implementation PNInstallation
|
||||
|
||||
static PNInstallation *SINGLETON = nil;
|
||||
static PNInstallation *INSTALLATION = nil;
|
||||
|
||||
static bool isFirstAccess = YES;
|
||||
|
||||
@ -61,10 +61,10 @@ static bool isFirstAccess = YES;
|
||||
dispatch_once(&onceToken, ^{
|
||||
isFirstAccess = NO;
|
||||
|
||||
SINGLETON = [[super allocWithZone:NULL] init];
|
||||
INSTALLATION = [[super allocWithZone:NULL] init];
|
||||
});
|
||||
|
||||
return SINGLETON;
|
||||
return INSTALLATION;
|
||||
}
|
||||
|
||||
- (void)setDeviceTokenFromData:(NSData *)deviceTokenData {
|
||||
@ -85,8 +85,8 @@ static bool isFirstAccess = YES;
|
||||
|
||||
- (id) init
|
||||
{
|
||||
if(SINGLETON){
|
||||
return SINGLETON;
|
||||
if(INSTALLATION){
|
||||
return INSTALLATION;
|
||||
}
|
||||
if (isFirstAccess) {
|
||||
[self doesNotRecognizeSelector:_cmd];
|
||||
|
||||
@ -136,6 +136,10 @@
|
||||
* <#Description#>
|
||||
*/
|
||||
@property (nonatomic) BOOL hasVerifiedEmail;
|
||||
/**
|
||||
* <#Description#>
|
||||
*/
|
||||
@property (nonatomic) BOOL hasVerifiedPhone;
|
||||
/**
|
||||
* <#Description#>
|
||||
*/
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
|
||||
@synthesize password = _password;
|
||||
|
||||
static PNUser *SINGLETON = nil;
|
||||
static id USER = nil;
|
||||
|
||||
static bool isFirstAccess = YES;
|
||||
|
||||
@ -39,15 +39,15 @@ static bool isFirstAccess = YES;
|
||||
dispatch_once(&onceToken, ^{
|
||||
isFirstAccess = NO;
|
||||
|
||||
SINGLETON = [[super allocWithZone:NULL] initForCurrentUser];
|
||||
USER = [[super allocWithZone:NULL] initForCurrentUser];
|
||||
});
|
||||
|
||||
return SINGLETON;
|
||||
return USER;
|
||||
}
|
||||
|
||||
+ (instancetype)resetUser {
|
||||
[SINGLETON autoRemoveLocally];
|
||||
SINGLETON = nil;
|
||||
[USER autoRemoveLocally];
|
||||
USER = nil;
|
||||
return [self currentUser];
|
||||
}
|
||||
|
||||
@ -65,8 +65,8 @@ static bool isFirstAccess = YES;
|
||||
|
||||
- (instancetype) initForCurrentUser
|
||||
{
|
||||
if(SINGLETON){
|
||||
return SINGLETON;
|
||||
if(USER){
|
||||
return USER;
|
||||
}
|
||||
if (isFirstAccess) {
|
||||
[self doesNotRecognizeSelector:_cmd];
|
||||
@ -75,19 +75,17 @@ static bool isFirstAccess = YES;
|
||||
NSDictionary *savedUser = [[PNObjectModel sharedInstance] fetchObjectsWithClass:[self class]];
|
||||
|
||||
if (savedUser) {
|
||||
SINGLETON = [super initWithJSON:savedUser];
|
||||
}
|
||||
else {
|
||||
SINGLETON = [super init];
|
||||
USER = [super initWithJSON:savedUser];
|
||||
}
|
||||
|
||||
if (SINGLETON) {
|
||||
if (USER) {
|
||||
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
[self autoLogin];
|
||||
});
|
||||
}
|
||||
return SINGLETON;
|
||||
|
||||
return USER;
|
||||
}
|
||||
|
||||
- (void) setEmail:(NSString *)email {
|
||||
@ -156,7 +154,7 @@ static bool isFirstAccess = YES;
|
||||
|
||||
[self POSTWithEndpointAction:@"registration/register" parameters:[self JSONFormObject]
|
||||
progress:nil
|
||||
success:^(NSURLSessionDataTask * _Nullable task, PNObject * _Nullable responseObject) {
|
||||
success:^(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject) {
|
||||
NSLog(@"response %@",responseObject);
|
||||
if(success){
|
||||
success(self);
|
||||
@ -294,8 +292,7 @@ static bool isFirstAccess = YES;
|
||||
+ (NSDictionary *)objcetMapping {
|
||||
|
||||
NSDictionary *mapping = @{
|
||||
@"userId":@"id",
|
||||
@"userUUID":@"uuid",
|
||||
@"userId":@"uuid",
|
||||
@"firstName":@"firstName",
|
||||
@"lastName":@"lastName",
|
||||
@"profileImage":@"profileImage",
|
||||
@ -306,6 +303,7 @@ static bool isFirstAccess = YES;
|
||||
@"hasAcceptedPrivacy":@"hasAcceptedPrivacy",
|
||||
@"hasAcceptedNewsletter":@"hasAcceptedNewsletter",
|
||||
@"hasVerifiedEmail":@"hasVerifiedEmail",
|
||||
@"hasVerifiedPhone":@"has_verified_phone",
|
||||
@"emailVerifiedDate":@"emailVerifiedDate",
|
||||
@"email":@"email",
|
||||
@"username":@"username",
|
||||
|
||||
@ -13,13 +13,15 @@
|
||||
|
||||
- (void) GETWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
progress:(nullable void (^)(NSProgress * _Nonnull downloadProgress)) downloadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, id _Nullable responseObject))success
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure;
|
||||
|
||||
- (void) POSTWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
parameters:(NSDictionary * _Nonnull) parameters
|
||||
progress:(nullable void (^)(NSProgress * _Nonnull uploadProgress)) uploadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, id _Nullable responseObject))success
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure;
|
||||
|
||||
+ (id _Nonnull) parseObjectFromResponse:(id _Nullable) response;
|
||||
|
||||
@end
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
|
||||
- (void) GETWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
progress:(nullable void (^)(NSProgress * _Nonnull downloadProgress)) downloadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, id _Nullable responseObject))success
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure {
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
[[[PNObjectConfig sharedInstance] manager] GET:[[[PNObjectConfig sharedInstance] baseUrl] stringByAppendingFormat:@"%@",endPoint] parameters:nil progress:downloadProgress success:^(NSURLSessionDataTask *task, id responseObject) {
|
||||
|
||||
if (success) {
|
||||
success(task,[[self class] parseObjectFromResponse:responseObject]);
|
||||
success(task,responseObject);
|
||||
}
|
||||
|
||||
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
|
||||
@ -51,7 +51,7 @@
|
||||
- (void) POSTWithEndpointAction:(NSString * _Nonnull) endPoint
|
||||
parameters:(NSDictionary * _Nonnull) parameters
|
||||
progress:(nullable void (^)(NSProgress * _Nonnull uploadProgress)) uploadProgress
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, id _Nullable responseObject))success
|
||||
success:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSDictionary * _Nullable responseObject))success
|
||||
failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error))failure {
|
||||
|
||||
if ([[PNObjectConfig sharedInstance] currentOauthCredential] && ![[[PNObjectConfig sharedInstance] currentOauthCredential] isExpired]) {
|
||||
@ -59,7 +59,7 @@
|
||||
[[[PNObjectConfig sharedInstance] manager] POST:[[[PNObjectConfig sharedInstance] baseUrl] stringByAppendingFormat:@"%@",endPoint] parameters:parameters progress:uploadProgress success:^(NSURLSessionDataTask *task, id responseObject) {
|
||||
|
||||
if (success) {
|
||||
success(task,[[self class] parseObjectFromResponse:responseObject]);
|
||||
success(task,responseObject);
|
||||
}
|
||||
|
||||
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
|
||||
|
||||
@ -371,124 +371,6 @@ NSString * const PNObjectMappingSelector = @"PNObjectLocalNotificationRefreshTok
|
||||
})();
|
||||
}
|
||||
}
|
||||
|
||||
/*for (NSString* propertyName in self.JSONObjectMap) {
|
||||
|
||||
id mappingValue = [self.JSONObjectMap objectForKey:propertyName];
|
||||
|
||||
if([mappingValue isKindOfClass:NSDictionary.class]) {
|
||||
mappedJSONKey = [mappingValue valueForKey:@"key"];
|
||||
mappedJSONType = [mappingValue valueForKey:@"type"];
|
||||
} else {
|
||||
mappedJSONKey = mappingValue;
|
||||
}
|
||||
|
||||
NSString *propertyType = [properties valueForKey:propertyName];
|
||||
|
||||
if (![[formMapping allKeys] containsObject:propertyName]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
id value = [self valueForKey:propertyName];
|
||||
//TODO: forse è da sostituire propertyName con il valore de
|
||||
((void (^)())@{
|
||||
@"c" : ^{
|
||||
char val = [value charValue];
|
||||
[JSON setValue:@(val) forKey:propertyName];
|
||||
},
|
||||
@"d" : ^{
|
||||
double val = [value doubleValue];
|
||||
[JSON setValue:@(val) forKey:propertyName];
|
||||
},
|
||||
@"f" : ^{
|
||||
float val = [value floatValue];
|
||||
[JSON setValue:@(val) forKey:propertyName];
|
||||
},
|
||||
@"i" : ^{
|
||||
int val = [value intValue];
|
||||
[JSON setValue:@(val) forKey:propertyName];
|
||||
},
|
||||
@"l" : ^{
|
||||
long val = [value longValue];
|
||||
[JSON setValue:@(val) forKey:propertyName];
|
||||
},
|
||||
@"s" : ^{
|
||||
short val = [value shortValue];
|
||||
[JSON setValue:@(val) forKey:propertyName];
|
||||
},
|
||||
@"B" : ^{
|
||||
BOOL val = [value boolValue];
|
||||
[JSON setValue:@(val) forKey:propertyName];
|
||||
},
|
||||
|
||||
@"UIImage" : ^{
|
||||
UIImage *image = [UIImage imageWithData:value];
|
||||
[JSON setValue:image forKey:propertyName];
|
||||
},
|
||||
@"NSURL" : ^{
|
||||
NSURL *url = value;
|
||||
|
||||
if (![self isObjNull:url]) {
|
||||
[JSON setValue:[url absoluteString] forKey:propertyName];
|
||||
}
|
||||
},
|
||||
@"NSString" : ^{
|
||||
NSString *val = [NSString stringWithFormat:@"%@", value];
|
||||
if (![self isObjNull:val]) {
|
||||
[JSON setValue:val forKey:propertyName];
|
||||
}
|
||||
},
|
||||
@"NSNumber" : ^{
|
||||
NSInteger val = [value integerValue];
|
||||
[JSON setValue:@(val) forKey:propertyName];
|
||||
},
|
||||
@"NSDate" : ^{
|
||||
NSDate *val = [value toLocalTime];
|
||||
if (![self isObjNull:val]) {
|
||||
[JSON setValue:val forKey:propertyName];
|
||||
}
|
||||
},
|
||||
@"NSArray" : ^{
|
||||
NSMutableArray *arr = [NSMutableArray array];
|
||||
for(id object in value) {
|
||||
|
||||
BOOL isPNObjectSubclass = [[object class] isSubclassOfClass:[PNObject class]];
|
||||
if(isPNObjectSubclass) {
|
||||
NSDictionary *objectDict = [(PNObject*) object reverseMapping];
|
||||
|
||||
[arr addObject:objectDict];
|
||||
}
|
||||
}
|
||||
|
||||
[JSON setValue:arr forKey:propertyName];
|
||||
},
|
||||
@"NSMutableArray" : ^{
|
||||
NSMutableArray *arr = [NSMutableArray array];
|
||||
for(id object in value) {
|
||||
|
||||
BOOL isPNObjectSubclass = [[object class] isSubclassOfClass:[PNObject class]];
|
||||
if(isPNObjectSubclass) {
|
||||
NSDictionary *objectDict = [(PNObject*) object reverseMapping];
|
||||
|
||||
[arr addObject:objectDict];
|
||||
}
|
||||
}
|
||||
|
||||
[JSON setValue:arr forKey:propertyName];
|
||||
}
|
||||
}[propertyType] ?: ^{
|
||||
BOOL isPNObjectSubclass = [NSClassFromString(propertyType) isSubclassOfClass:[PNObject class]];
|
||||
if(isPNObjectSubclass) {
|
||||
|
||||
NSDictionary *objectDict = [(PNObject*)value reverseMapping];
|
||||
|
||||
[JSON setValue:objectDict forKey:propertyName];
|
||||
}
|
||||
else {
|
||||
// do nothing
|
||||
}
|
||||
})();
|
||||
}*/
|
||||
}
|
||||
return JSON;
|
||||
}
|
||||
|
||||
@ -412,7 +412,7 @@
|
||||
|
||||
}
|
||||
}
|
||||
self.JSON = nil;
|
||||
_JSON = nil;
|
||||
_JSONObjectMap = nil;
|
||||
_objID = nil;
|
||||
_createdAt = nil;
|
||||
|
||||
@ -14,13 +14,6 @@
|
||||
#import "AFHTTPRequestSerializer+OAuth2.h"
|
||||
#import "AFOAuthCredential.h"
|
||||
|
||||
typedef NS_ENUM(NSInteger, Environment) {
|
||||
Development = 0,
|
||||
Stage = 1,
|
||||
Production = 2
|
||||
};
|
||||
|
||||
|
||||
#pragma mark LocalNotification Keys
|
||||
|
||||
extern NSString* _Nonnull const PNObjectLocalNotificationRefreshTokenClientCredentialSuccess;
|
||||
@ -79,7 +72,7 @@ extern NSString* _Nonnull const Client_Secret;
|
||||
*
|
||||
* @param env <#env description#>
|
||||
*/
|
||||
- (void) setEnvironment:(Environment) env;
|
||||
- (void) setEnvironment:(NSString * _Nonnull) environment;
|
||||
|
||||
/**
|
||||
* <#Description#>
|
||||
@ -92,12 +85,12 @@ extern NSString* _Nonnull const Client_Secret;
|
||||
/**
|
||||
* <#Description#>
|
||||
*
|
||||
* @param value <#value description#>
|
||||
* @param value EnvironmentProduction, EnvironmentStage, EnvironmentDevelopment
|
||||
* @param key <#key description#>
|
||||
*/
|
||||
- (void) removeHTTPHeaderValueForKey:(NSString * _Nonnull) key;
|
||||
|
||||
- (void) setClientID:(NSString * _Nonnull) clientID clientSecret:(NSString* _Nonnull) clientSecret forEnv:(Environment) environment;
|
||||
- (void) setClientID:(NSString * _Nonnull) clientID clientSecret:(NSString* _Nonnull) clientSecret forEnv:(NSString * _Nonnull) environment;
|
||||
|
||||
/**
|
||||
* <#Description#>
|
||||
@ -178,6 +171,6 @@ extern NSString* _Nonnull const Client_Secret;
|
||||
/**
|
||||
* <#Description#>
|
||||
*/
|
||||
@property (nonatomic, strong, readonly) NSString *encrypKey;
|
||||
@property (nonatomic, strong, nonnull , readonly) NSString *encrypKey;
|
||||
|
||||
@end
|
||||
@ -42,11 +42,11 @@ NSString* const Client_Secret = @"client_secret";
|
||||
|
||||
@property (nonatomic, strong) NSMutableDictionary *configuration;
|
||||
@property (nonatomic, strong) NSMutableDictionary *headerFields;
|
||||
@property (nonatomic) Environment currentEnv;
|
||||
@property (nonatomic, strong) NSString *currentEnv;
|
||||
@property (nonatomic, strong) NSString *currentEndPointBaseUrl;
|
||||
@property (nonatomic, strong) NSString *currentOAuthClientID;
|
||||
@property (nonatomic, strong) NSString *currentOAuthClientSecret;
|
||||
@property (nonatomic, strong) NSMutableArray *environments;
|
||||
//@property (nonatomic, strong) NSMutableDictionary *environments;
|
||||
|
||||
@end
|
||||
|
||||
@ -84,16 +84,14 @@ static bool isFirstAccess = YES;
|
||||
SINGLETON.oauthEnabled = oauthEnabled;
|
||||
for (NSString *key in [endpointUrlsForEnvironments allKeys]) {
|
||||
|
||||
if ([SINGLETON.environments containsObject:key]) {
|
||||
|
||||
NSURL * endpointUrl = [NSURL URLWithString:[endpointUrlsForEnvironments objectForKey:key]];
|
||||
if (endpointUrl) {
|
||||
[SINGLETON.configuration setValue:[NSDictionary dictionaryWithObjectsAndKeys:[endpointUrl absoluteString],BaseUrl, nil] forKey:key];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
NSAssert([SINGLETON.configuration objectForKey:EnvironmentProduction], @"EnvironmentProduction must be valid endpoint url");
|
||||
[SINGLETON setEnvironment:Production];
|
||||
[SINGLETON setEnvironment:EnvironmentProduction];
|
||||
|
||||
|
||||
|
||||
@ -138,11 +136,9 @@ static bool isFirstAccess = YES;
|
||||
|
||||
if (self) {
|
||||
if (_oauthEnabled) {
|
||||
_currentOauthCredential = [AFOAuthCredential retrieveCredentialWithIdentifier:PNObjectServiceCredentialIdentifier];
|
||||
[AFOAuthCredential deleteCredentialWithIdentifier:PNObjectServiceCredentialIdentifier];
|
||||
}
|
||||
|
||||
_environments = [[NSMutableArray alloc] initWithArray:@[EnvironmentDevelopment,EnvironmentStage,EnvironmentProduction]];
|
||||
|
||||
_configuration = [[NSMutableDictionary alloc] init];
|
||||
_minPasswordLenght = minPassLenght;
|
||||
|
||||
@ -162,30 +158,20 @@ static bool isFirstAccess = YES;
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) setEnvironment:(Environment) env {
|
||||
- (void) setEnvironment:(NSString * _Nonnull) environment {
|
||||
|
||||
_currentEnv = env;
|
||||
_currentEnv = environment;
|
||||
_currentEndPointBaseUrl = nil;
|
||||
_currentOAuthClientID = nil;
|
||||
_currentOAuthClientSecret = nil;
|
||||
|
||||
if (env < [_environments count]) {
|
||||
if ([_configuration objectForKey:[_environments objectAtIndex:env]]) {
|
||||
_currentEndPointBaseUrl = [[_configuration objectForKey:[_environments objectAtIndex:env]] objectForKey:BaseUrl];
|
||||
_currentOAuthClientID = [[_configuration objectForKey:[_environments objectAtIndex:env]] objectForKey:Client_ID];
|
||||
_currentOAuthClientSecret = [[_configuration objectForKey:[_environments objectAtIndex:env]] objectForKey:Client_Secret];
|
||||
if ([_configuration objectForKey:environment]) {
|
||||
_currentEndPointBaseUrl = [[_configuration objectForKey:_currentEnv] objectForKey:BaseUrl];
|
||||
_currentOAuthClientID = [[_configuration objectForKey:_currentEnv] objectForKey:Client_ID];
|
||||
_currentOAuthClientSecret = [[_configuration objectForKey:_currentEnv] objectForKey:Client_Secret];
|
||||
}
|
||||
}
|
||||
else {
|
||||
_currentEndPointBaseUrl = [[_configuration objectForKey:EnvironmentProduction] objectForKey:BaseUrl];
|
||||
if ([[_configuration objectForKey:EnvironmentProduction] objectForKey:Client_ID]) {
|
||||
_currentOAuthClientID = [[_configuration objectForKey:EnvironmentProduction] objectForKey:Client_ID];
|
||||
}
|
||||
if ([[_configuration objectForKey:EnvironmentProduction] objectForKey:Client_Secret]) {
|
||||
_currentOAuthClientSecret = [[_configuration objectForKey:EnvironmentProduction] objectForKey:Client_Secret];
|
||||
}
|
||||
}
|
||||
NSLog(@"%@",[[_configuration objectForKey:[_environments objectAtIndex:env]] objectForKey:BaseUrl]);
|
||||
|
||||
NSLog(@"%@",[[_configuration objectForKey:_currentEnv] objectForKey:BaseUrl]);
|
||||
|
||||
NSAssert(_currentEndPointBaseUrl,@"Selected environment generate error. Please check configuration");
|
||||
|
||||
@ -205,7 +191,7 @@ static bool isFirstAccess = YES;
|
||||
_manager = [AFOAuth2Manager manager];
|
||||
}
|
||||
|
||||
_currentOauthCredential = [AFOAuthCredential retrieveCredentialWithIdentifier:PNObjectServiceCredentialIdentifier];
|
||||
//_currentOauthCredential = [AFOAuthCredential retrieveCredentialWithIdentifier:PNObjectServiceCredentialIdentifier];
|
||||
|
||||
if (_oauthEnabled && _currentOAuthClientID && _currentOAuthClientSecret) {
|
||||
|
||||
@ -368,15 +354,15 @@ static bool isFirstAccess = YES;
|
||||
}
|
||||
}
|
||||
|
||||
- (void) setClientID:(NSString * _Nonnull) clientID clientSecret:(NSString* _Nonnull) clientSecret forEnv:(Environment) environment {
|
||||
- (void) setClientID:(NSString * _Nonnull) clientID clientSecret:(NSString* _Nonnull) clientSecret forEnv:(NSString *) environment {
|
||||
|
||||
if ([_configuration objectForKey:[_environments objectAtIndex:environment]]) {
|
||||
if ([_configuration objectForKey:environment]) {
|
||||
|
||||
NSMutableDictionary *currentConfigurationDict = [[NSMutableDictionary alloc] initWithDictionary:[_configuration objectForKey:[_environments objectAtIndex:environment]]];
|
||||
NSMutableDictionary *currentConfigurationDict = [[NSMutableDictionary alloc] initWithDictionary:[_configuration objectForKey:environment]];
|
||||
[currentConfigurationDict setObject:clientID forKey:Client_ID];
|
||||
[currentConfigurationDict setObject:clientSecret forKey:Client_Secret];
|
||||
|
||||
[_configuration setObject:currentConfigurationDict forKey:[_environments objectAtIndex:environment]];
|
||||
[_configuration setObject:currentConfigurationDict forKey:environment];
|
||||
|
||||
if (_currentEnv == environment) {
|
||||
[self setEnvironment:environment];
|
||||
|
||||
@ -41,15 +41,6 @@
|
||||
*/
|
||||
- (id _Nonnull) saveLocally:(id _Nonnull) object;
|
||||
|
||||
/**
|
||||
* <#Description#>
|
||||
*
|
||||
* @param object <#object description#>
|
||||
*
|
||||
* @return <#return value description#>
|
||||
*/
|
||||
- (id _Nonnull) saveNSUSerDefautls:(id _Nonnull) object;
|
||||
|
||||
/**
|
||||
* <#Description#>
|
||||
*
|
||||
|
||||
@ -238,9 +238,9 @@ static bool isFirstAccess = YES;
|
||||
}
|
||||
}
|
||||
|
||||
- (id _Nonnull) saveNSUSerDefautls:(id _Nonnull) object {
|
||||
/*- (id _Nonnull) saveNSUSerDefautls:(id _Nonnull) object {
|
||||
|
||||
}
|
||||
}*/
|
||||
|
||||
- (BOOL) removeObjectLocally:(id _Nonnull) object {
|
||||
BOOL isPNObjectSubclass = [[object class] isSubclassOfClass:[PNObject class]];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user