Permalink
Browse files

Allow setting of the default session

[ANSession setDefaultSession:nil] returns it to the original default session.
  • Loading branch information...
brentdax committed Oct 26, 2012
1 parent 2b01399 commit f10e3c472c31023543950ab49b26326495a9c196
Showing with 12 additions and 1 deletion.
  1. +1 −0 ANSession.h
  2. +11 −1 ANSession.m
View
@@ -32,6 +32,7 @@ typedef enum {
+ (BOOL)isUsingNetwork;
+ (ANSession*)defaultSession;
++ (void)setDefaultSession:(ANSession*)defaultSession;
@property (strong) NSString * accessToken;
View
@@ -50,7 +50,7 @@ - (id)init {
return self;
}
-+ (ANSession *)defaultSession {
++ (ANSession *)defaultDefaultSession {
static ANSession * singleton;
static dispatch_once_t once;
@@ -61,6 +61,16 @@ + (ANSession *)defaultSession {
return singleton;
}
+static ANSession * DefaultSession = nil;
+
++ (ANSession*)defaultSession {
+ return DefaultSession ?: [self defaultDefaultSession];
+}
+
++ (void)setDefaultSession:(ANSession*)defaultSession {
+ DefaultSession = defaultSession;
+}
+
- (NSURL *)URLForStreamAPIVersion:(ANStreamAPIVersion)version {
switch(version) {
case ANStreamAPIVersion0:

0 comments on commit f10e3c4

Please sign in to comment.