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 1010#import " PFNetworkActivityIndicatorManager.h"
1111
1212#import " PFApplication.h"
13+ #import " PFCommandRunningConstants.h"
1314
1415static NSTimeInterval const PFNetworkActivityIndicatorVisibilityDelay = 0.17 ;
1516
@@ -49,10 +50,20 @@ - (instancetype)init {
4950 _networkActivityAccessQueue = dispatch_queue_create (" com.parse.networkActivityIndicatorManager" ,
5051 DISPATCH_QUEUE_SERIAL);
5152
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+
5262 return self;
5363}
5464
5565- (void )dealloc {
66+ [[NSNotificationCenter defaultCenter ] removeObserver: self ];
5667 [_activityIndicatorVisibilityTimer invalidate ];
5768}
5869
@@ -137,4 +148,16 @@ - (void)_updateNetworkActivityIndicatorVisibility {
137148 }
138149}
139150
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+
140163@end
You can’t perform that action at this time.
0 commit comments