Renaming AFOperationState enum values to remove HTTP prefix
This commit is contained in:
parent
9ed38fd30a
commit
248ab6d8b8
1 changed files with 32 additions and 32 deletions
|
|
@ -26,10 +26,10 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
AFHTTPOperationPausedState = -1,
|
AFOperationPausedState = -1,
|
||||||
AFHTTPOperationReadyState = 1,
|
AFOperationReadyState = 1,
|
||||||
AFHTTPOperationExecutingState = 2,
|
AFOperationExecutingState = 2,
|
||||||
AFHTTPOperationFinishedState = 3,
|
AFOperationFinishedState = 3,
|
||||||
} _AFOperationState;
|
} _AFOperationState;
|
||||||
|
|
||||||
typedef signed short AFOperationState;
|
typedef signed short AFOperationState;
|
||||||
|
|
@ -58,13 +58,13 @@ typedef NSURLRequest * (^AFURLConnectionOperationRedirectResponseBlock)(NSURLCon
|
||||||
|
|
||||||
static inline NSString * AFKeyPathFromOperationState(AFOperationState state) {
|
static inline NSString * AFKeyPathFromOperationState(AFOperationState state) {
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case AFHTTPOperationReadyState:
|
case AFOperationReadyState:
|
||||||
return @"isReady";
|
return @"isReady";
|
||||||
case AFHTTPOperationExecutingState:
|
case AFOperationExecutingState:
|
||||||
return @"isExecuting";
|
return @"isExecuting";
|
||||||
case AFHTTPOperationFinishedState:
|
case AFOperationFinishedState:
|
||||||
return @"isFinished";
|
return @"isFinished";
|
||||||
case AFHTTPOperationPausedState:
|
case AFOperationPausedState:
|
||||||
return @"isPaused";
|
return @"isPaused";
|
||||||
default:
|
default:
|
||||||
return @"state";
|
return @"state";
|
||||||
|
|
@ -73,28 +73,28 @@ static inline NSString * AFKeyPathFromOperationState(AFOperationState state) {
|
||||||
|
|
||||||
static inline BOOL AFStateTransitionIsValid(AFOperationState fromState, AFOperationState toState, BOOL isCancelled) {
|
static inline BOOL AFStateTransitionIsValid(AFOperationState fromState, AFOperationState toState, BOOL isCancelled) {
|
||||||
switch (fromState) {
|
switch (fromState) {
|
||||||
case AFHTTPOperationReadyState:
|
case AFOperationReadyState:
|
||||||
switch (toState) {
|
switch (toState) {
|
||||||
case AFHTTPOperationPausedState:
|
case AFOperationPausedState:
|
||||||
case AFHTTPOperationExecutingState:
|
case AFOperationExecutingState:
|
||||||
return YES;
|
return YES;
|
||||||
case AFHTTPOperationFinishedState:
|
case AFOperationFinishedState:
|
||||||
return isCancelled;
|
return isCancelled;
|
||||||
default:
|
default:
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
case AFHTTPOperationExecutingState:
|
case AFOperationExecutingState:
|
||||||
switch (toState) {
|
switch (toState) {
|
||||||
case AFHTTPOperationPausedState:
|
case AFOperationPausedState:
|
||||||
case AFHTTPOperationFinishedState:
|
case AFOperationFinishedState:
|
||||||
return YES;
|
return YES;
|
||||||
default:
|
default:
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
case AFHTTPOperationFinishedState:
|
case AFOperationFinishedState:
|
||||||
return NO;
|
return NO;
|
||||||
case AFHTTPOperationPausedState:
|
case AFOperationPausedState:
|
||||||
return toState == AFHTTPOperationReadyState;
|
return toState == AFOperationReadyState;
|
||||||
default:
|
default:
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
@ -180,7 +180,7 @@ static inline BOOL AFStateTransitionIsValid(AFOperationState fromState, AFOperat
|
||||||
|
|
||||||
self.outputStream = [NSOutputStream outputStreamToMemory];
|
self.outputStream = [NSOutputStream outputStreamToMemory];
|
||||||
|
|
||||||
self.state = AFHTTPOperationReadyState;
|
self.state = AFOperationReadyState;
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
@ -326,10 +326,10 @@ static inline BOOL AFStateTransitionIsValid(AFOperationState fromState, AFOperat
|
||||||
[self didChangeValueForKey:newStateKey];
|
[self didChangeValueForKey:newStateKey];
|
||||||
|
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case AFHTTPOperationExecutingState:
|
case AFOperationExecutingState:
|
||||||
[[NSNotificationCenter defaultCenter] postNotificationName:AFNetworkingOperationDidStartNotification object:self];
|
[[NSNotificationCenter defaultCenter] postNotificationName:AFNetworkingOperationDidStartNotification object:self];
|
||||||
break;
|
break;
|
||||||
case AFHTTPOperationFinishedState:
|
case AFOperationFinishedState:
|
||||||
[[NSNotificationCenter defaultCenter] postNotificationName:AFNetworkingOperationDidFinishNotification object:self];
|
[[NSNotificationCenter defaultCenter] postNotificationName:AFNetworkingOperationDidFinishNotification object:self];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
@ -366,13 +366,13 @@ static inline BOOL AFStateTransitionIsValid(AFOperationState fromState, AFOperat
|
||||||
[[NSNotificationCenter defaultCenter] postNotificationName:AFNetworkingOperationDidFinishNotification object:self];
|
[[NSNotificationCenter defaultCenter] postNotificationName:AFNetworkingOperationDidFinishNotification object:self];
|
||||||
}
|
}
|
||||||
|
|
||||||
self.state = AFHTTPOperationPausedState;
|
self.state = AFOperationPausedState;
|
||||||
|
|
||||||
[self.lock unlock];
|
[self.lock unlock];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)isPaused {
|
- (BOOL)isPaused {
|
||||||
return self.state == AFHTTPOperationPausedState;
|
return self.state == AFOperationPausedState;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)resume {
|
- (void)resume {
|
||||||
|
|
@ -381,7 +381,7 @@ static inline BOOL AFStateTransitionIsValid(AFOperationState fromState, AFOperat
|
||||||
}
|
}
|
||||||
|
|
||||||
[self.lock lock];
|
[self.lock lock];
|
||||||
self.state = AFHTTPOperationReadyState;
|
self.state = AFOperationReadyState;
|
||||||
|
|
||||||
[self start];
|
[self start];
|
||||||
[self.lock unlock];
|
[self.lock unlock];
|
||||||
|
|
@ -390,15 +390,15 @@ static inline BOOL AFStateTransitionIsValid(AFOperationState fromState, AFOperat
|
||||||
#pragma mark - NSOperation
|
#pragma mark - NSOperation
|
||||||
|
|
||||||
- (BOOL)isReady {
|
- (BOOL)isReady {
|
||||||
return self.state == AFHTTPOperationReadyState && [super isReady];
|
return self.state == AFOperationReadyState && [super isReady];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)isExecuting {
|
- (BOOL)isExecuting {
|
||||||
return self.state == AFHTTPOperationExecutingState;
|
return self.state == AFOperationExecutingState;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)isFinished {
|
- (BOOL)isFinished {
|
||||||
return self.state == AFHTTPOperationFinishedState;
|
return self.state == AFOperationFinishedState;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)isConcurrent {
|
- (BOOL)isConcurrent {
|
||||||
|
|
@ -408,7 +408,7 @@ static inline BOOL AFStateTransitionIsValid(AFOperationState fromState, AFOperat
|
||||||
- (void)start {
|
- (void)start {
|
||||||
[self.lock lock];
|
[self.lock lock];
|
||||||
if ([self isReady]) {
|
if ([self isReady]) {
|
||||||
self.state = AFHTTPOperationExecutingState;
|
self.state = AFOperationExecutingState;
|
||||||
|
|
||||||
[self performSelector:@selector(operationDidStart) onThread:[[self class] networkRequestThread] withObject:nil waitUntilDone:NO modes:[self.runLoopModes allObjects]];
|
[self performSelector:@selector(operationDidStart) onThread:[[self class] networkRequestThread] withObject:nil waitUntilDone:NO modes:[self.runLoopModes allObjects]];
|
||||||
}
|
}
|
||||||
|
|
@ -434,7 +434,7 @@ static inline BOOL AFStateTransitionIsValid(AFOperationState fromState, AFOperat
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)finish {
|
- (void)finish {
|
||||||
self.state = AFHTTPOperationFinishedState;
|
self.state = AFOperationFinishedState;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)cancel {
|
- (void)cancel {
|
||||||
|
|
@ -634,9 +634,9 @@ didReceiveResponse:(NSURLResponse *)response
|
||||||
[aCoder encodeObject:self.request forKey:@"request"];
|
[aCoder encodeObject:self.request forKey:@"request"];
|
||||||
|
|
||||||
switch (self.state) {
|
switch (self.state) {
|
||||||
case AFHTTPOperationExecutingState:
|
case AFOperationExecutingState:
|
||||||
case AFHTTPOperationPausedState:
|
case AFOperationPausedState:
|
||||||
[aCoder encodeInteger:AFHTTPOperationReadyState forKey:@"state"];
|
[aCoder encodeInteger:AFOperationReadyState forKey:@"state"];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
[aCoder encodeInteger:self.state forKey:@"state"];
|
[aCoder encodeInteger:self.state forKey:@"state"];
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue