File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 10
10
#import " PFNetworkActivityIndicatorManager.h"
11
11
12
12
#import " PFApplication.h"
13
+ #import " PFCommandRunningConstants.h"
13
14
14
15
static NSTimeInterval const PFNetworkActivityIndicatorVisibilityDelay = 0.17 ;
15
16
@@ -49,10 +50,20 @@ - (instancetype)init {
49
50
_networkActivityAccessQueue = dispatch_queue_create (" com.parse.networkActivityIndicatorManager" ,
50
51
DISPATCH_QUEUE_SERIAL);
51
52
53
+ [[NSNotificationCenter defaultCenter ] addObserver: self
54
+ selector: @selector (_handleWillSendURLRequestNotification: )
55
+ name: PFCommandRunnerWillSendURLRequestNotification
56
+ object: nil ];
57
+ [[NSNotificationCenter defaultCenter ] addObserver: self
58
+ selector: @selector (_handleDidReceiveURLResponseNotification: )
59
+ name: PFCommandRunnerDidReceiveURLResponseNotification
60
+ object: nil ];
61
+
52
62
return self;
53
63
}
54
64
55
65
- (void )dealloc {
66
+ [[NSNotificationCenter defaultCenter ] removeObserver: self ];
56
67
[_activityIndicatorVisibilityTimer invalidate ];
57
68
}
58
69
@@ -137,4 +148,16 @@ - (void)_updateNetworkActivityIndicatorVisibility {
137
148
}
138
149
}
139
150
151
+ // /--------------------------------------
152
+ #pragma mark - Command Running
153
+ // /--------------------------------------
154
+
155
+ - (void )_handleWillSendURLRequestNotification : (NSNotification *)notification {
156
+ [self incrementActivityCount ];
157
+ }
158
+
159
+ - (void )_handleDidReceiveURLResponseNotification : (NSNotification *)notification {
160
+ [self decrementActivityCount ];
161
+ }
162
+
140
163
@end
You can’t perform that action at this time.
0 commit comments