- ADD OAuth2 Manager
This commit is contained in:
1 parent
515d75c316
commit
31a1afdc98
65 files changed
+4110
-2732
No files matched your search
@@ -9,16 +9,32 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <AFNetworking/AFNetworking.h>
|
||||
|
||||
#import <AFOAuth2Manager/AFOAuth2Manager.h>
|
||||
#import <AFOAuth2Manager/AFHTTPRequestSerializer+OAuth2.h>
|
||||
#import <AFOAuth2Manager/AFOAuthCredential.h>
|
||||
|
||||
typedef NS_ENUM(NSInteger, Environment) {
|
||||
Development,
|
||||
Stage,
|
||||
Production
|
||||
Development = 0,
|
||||
Stage = 1,
|
||||
Production = 2
|
||||
};
|
||||
|
||||
extern NSString* const EnvironmentProduction;
|
||||
extern NSString* const EnvironmentStage;
|
||||
extern NSString* const EnvironmentDevelopment;
|
||||
|
||||
#pragma mark LocalNotification Keys
|
||||
|
||||
extern NSString* _Nonnull const PNObjectLocalNotificationRefreshTokenClientCredentialSuccess;
|
||||
extern NSString* _Nonnull const PNObjectLocalNotificationRefreshTokenClientCredentialFail;
|
||||
extern NSString* _Nonnull const PNObjectLocalNotificationRefreshTokenUserSuccess;
|
||||
extern NSString* _Nonnull const PNObjectLocalNotificationRefreshTokenUserFail;
|
||||
|
||||
#pragma mark -
|
||||
|
||||
extern NSString* _Nonnull const EnvironmentProduction;
|
||||
extern NSString* _Nonnull const EnvironmentStage;
|
||||
extern NSString* _Nonnull const EnvironmentDevelopment;
|
||||
|
||||
extern NSString* _Nonnull const Client_ID;
|
||||
extern NSString* _Nonnull const Client_Secret;
|
||||
|
||||
@interface PNObjectConfig : NSObject
|
||||
|
||||
@@ -26,10 +42,10 @@ extern NSString* const EnvironmentDevelopment;
|
||||
* gets singleton object.
|
||||
* @return singleton
|
||||
*/
|
||||
+ (instancetype) sharedInstance;
|
||||
+ (instancetype _Nonnull) sharedInstance;
|
||||
|
||||
/**
|
||||
*
|
||||
* Oauth is NO by default
|
||||
*
|
||||
* @param clientIdsForEnvironments
|
||||
* For example,
|
||||
@@ -40,7 +56,22 @@ extern NSString* const EnvironmentDevelopment;
|
||||
*
|
||||
* @return singleton
|
||||
*/
|
||||
+ (instancetype) initSharedInstanceForEnvironments:(NSDictionary *) endpointUrlsForEnvironments;
|
||||
+ (instancetype _Nonnull) initSharedInstanceForEnvironments:(NSDictionary * _Nonnull) endpointUrlsForEnvironments;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param clientIdsForEnvironments
|
||||
* For example,
|
||||
* @{ PNObjectConfigDevelopment : @"https://development.it/api/v1",
|
||||
* PNObjectConfigEnvStage : @"ttps://stage.it/api/v1",
|
||||
* PNObjectConfigEnvProduction : @"ttps://production.it/api/v1"
|
||||
* }
|
||||
* @param oauthEnabled <#oauthEnabled description#>
|
||||
*
|
||||
* @return singleton
|
||||
*/
|
||||
+ (instancetype _Nonnull) initSharedInstanceForEnvironments:(NSDictionary * _Nonnull) endpointUrlsForEnvironments withOauth:(BOOL) oauthEnabled;
|
||||
|
||||
/**
|
||||
* <#Description#>
|
||||
@@ -49,12 +80,30 @@ extern NSString* const EnvironmentDevelopment;
|
||||
*/
|
||||
- (void) setEnvironment:(Environment) env;
|
||||
|
||||
/**
|
||||
* <#Description#>
|
||||
*
|
||||
* @param value <#value description#>
|
||||
* @param key <#key description#>
|
||||
*/
|
||||
- (void) setHTTPHeaderValue:(NSString * _Nonnull)value forKey:(NSString * _Nonnull) key;
|
||||
|
||||
/**
|
||||
* <#Description#>
|
||||
*
|
||||
* @param value <#value description#>
|
||||
* @param key <#key description#>
|
||||
*/
|
||||
- (void) removeHTTPHeaderValueForKey:(NSString * _Nonnull) key;
|
||||
|
||||
- (void) setClientID:(NSString * _Nonnull) clientID clientSecret:(NSString* _Nonnull) clientSecret forEnv:(Environment) environment;
|
||||
|
||||
/**
|
||||
* <#Description#>
|
||||
*
|
||||
* @return <#return value description#>
|
||||
*/
|
||||
- (NSString *) PNObjEndpoint;
|
||||
- (NSString * _Nonnull) baseUrl;
|
||||
|
||||
/**
|
||||
* <#Description#>
|
||||
@@ -70,7 +119,8 @@ extern NSString* const EnvironmentDevelopment;
|
||||
/**
|
||||
* <#Description#>
|
||||
*/
|
||||
@property (nonatomic, strong) AFHTTPSessionManager *manager;
|
||||
@property (nonatomic, strong) AFOAuth2Manager *manager;
|
||||
|
||||
/**
|
||||
* <#Description#>
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user