Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add +sharedInstance for A0Lock #177

Merged
merged 1 commit into from
Oct 8, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Pod/Classes/Core/A0Lock.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,17 @@ NS_ASSUME_NONNULL_BEGIN
*/
+ (instancetype)newLock;

/**
* Returns a shared instance of Lock with credentials obtained from Info.plist.
* These are the the valid entries:
* - Auth0ClientId: Your app's client identifier in Auth0.
* - Auth0Domain: Your app's domain name or url in Auth0. e.g: samples.auth0.com or https://samples.auth0.com
* - Auth0ConfigurationDomain: Your app's configuration domain name or url where we get yout app configuration. This value is optional and will default to Auth0 CDN.
*
* @return a shared instance
*/
+ (instancetype)sharedLock;

/**
* Auth0 Authentication API client.
*
Expand Down
9 changes: 9 additions & 0 deletions Pod/Classes/Core/A0Lock.m
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,15 @@ - (instancetype)initWithClientId:(NSString *)clientId domain:(NSString *)domain
return self;
}

+ (instancetype)sharedLock {
static A0Lock *SharedInstance;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
SharedInstance = [A0Lock newLock];
});
return SharedInstance;
}

- (A0APIClient *)apiClient {
return self.client;
}
Expand Down