|  | @@ -77,7 +77,7 @@ NSOperationQueue *taskQueue;
 | 
	
		
			
			| 77 | 77 |      if([options valueForKey:CONFIG_TRUSTY] != nil)
 | 
	
		
			
			| 78 | 78 |      {
 | 
	
		
			
			| 79 | 79 |          NSURLSessionConfiguration *defaultConfigObject = [NSURLSessionConfiguration defaultSessionConfiguration];
 | 
	
		
			
			| 80 |  | -        session = [NSURLSession sessionWithConfiguration:defaultConfigObject delegate:self delegateQueue:taskQueue];
 | 
	
		
			
			|  | 80 | +        session = [NSURLSession sessionWithConfiguration:defaultConfigObject delegate:self delegateQueue:[NSOperationQueue mainQueue]];
 | 
	
		
			
			| 81 | 81 |      }
 | 
	
		
			
			| 82 | 82 |      // the session validates SSL certification, self-signed certification will be aborted
 | 
	
		
			
			| 83 | 83 |      else
 | 
	
	
		
			
			|  | @@ -105,6 +105,7 @@ NSOperationQueue *taskQueue;
 | 
	
		
			
			| 105 | 105 |              callback(@[[NSNull null], path]);
 | 
	
		
			
			| 106 | 106 |              // prevent memory leaks
 | 
	
		
			
			| 107 | 107 |              self.respData = nil;
 | 
	
		
			
			|  | 108 | +            [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
 | 
	
		
			
			| 108 | 109 |          }];
 | 
	
		
			
			| 109 | 110 |          [task resume];
 | 
	
		
			
			| 110 | 111 |      }
 | 
	
	
		
			
			|  | @@ -127,6 +128,7 @@ NSOperationQueue *taskQueue;
 | 
	
		
			
			| 127 | 128 |                  return;
 | 
	
		
			
			| 128 | 129 |              }
 | 
	
		
			
			| 129 | 130 |              callback(@[[NSNull null], tmpPath]);
 | 
	
		
			
			|  | 131 | +            [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
 | 
	
		
			
			| 130 | 132 |              // prevent memory leaks
 | 
	
		
			
			| 131 | 133 |              self.respData = nil;
 | 
	
		
			
			| 132 | 134 |          }];
 | 
	
	
		
			
			|  | @@ -143,9 +145,15 @@ NSOperationQueue *taskQueue;
 | 
	
		
			
			| 143 | 145 |              else {
 | 
	
		
			
			| 144 | 146 |                  callback(@[[NSNull null], [resp base64EncodedStringWithOptions:0]]);
 | 
	
		
			
			| 145 | 147 |              }
 | 
	
		
			
			|  | 148 | +            self.respData = nil;
 | 
	
		
			
			|  | 149 | +            [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
 | 
	
		
			
			| 146 | 150 |          }];
 | 
	
		
			
			| 147 | 151 |          [task resume];
 | 
	
		
			
			| 148 | 152 |      }
 | 
	
		
			
			|  | 153 | +    
 | 
	
		
			
			|  | 154 | +    // network status indicator
 | 
	
		
			
			|  | 155 | +    if([[options objectForKey:CONFIG_INDICATOR] boolValue] == YES)
 | 
	
		
			
			|  | 156 | +        [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
 | 
	
		
			
			| 149 | 157 |  }
 | 
	
		
			
			| 150 | 158 |  
 | 
	
		
			
			| 151 | 159 |  ////////////////////////////////////////
 | 
	
	
		
			
			|  | @@ -188,6 +196,7 @@ NSOperationQueue *taskQueue;
 | 
	
		
			
			| 188 | 196 |  - (void) URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(NSError *)error {
 | 
	
		
			
			| 189 | 197 |      NSLog([error localizedDescription]);
 | 
	
		
			
			| 190 | 198 |      self.error = error;
 | 
	
		
			
			|  | 199 | +    [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
 | 
	
		
			
			| 191 | 200 |  }
 | 
	
		
			
			| 192 | 201 |  
 | 
	
		
			
			| 193 | 202 |  // upload progress handler
 | 
	
	
		
			
			|  | @@ -205,9 +214,9 @@ NSOperationQueue *taskQueue;
 | 
	
		
			
			| 205 | 214 |       ];
 | 
	
		
			
			| 206 | 215 |  }
 | 
	
		
			
			| 207 | 216 |  
 | 
	
		
			
			| 208 |  | -- (void) application:(UIApplication *)application handleEventsForBackgroundURLSession:(NSString *)identifier completionHandler:(void (^)())completionHandler {
 | 
	
		
			
			| 209 |  | -    
 | 
	
		
			
			| 210 |  | -}
 | 
	
		
			
			|  | 217 | +//- (void) application:(UIApplication *)application handleEventsForBackgroundURLSession:(NSString *)identifier completionHandler:(void (^)())completionHandler {
 | 
	
		
			
			|  | 218 | +//    
 | 
	
		
			
			|  | 219 | +//}
 | 
	
		
			
			| 211 | 220 |  
 | 
	
		
			
			| 212 | 221 |  //- (void) URLSessionDidFinishEventsForBackgroundURLSession:(NSURLSession *)session
 | 
	
		
			
			| 213 | 222 |  //{
 | 
	
	
		
			
			|  | @@ -225,8 +234,10 @@ NSOperationQueue *taskQueue;
 | 
	
		
			
			| 225 | 234 |  {
 | 
	
		
			
			| 226 | 235 |      if([options valueForKey:CONFIG_TRUSTY] != nil)
 | 
	
		
			
			| 227 | 236 |          completionHandler(NSURLSessionAuthChallengeUseCredential, [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]);
 | 
	
		
			
			| 228 |  | -    else
 | 
	
		
			
			|  | 237 | +    else {
 | 
	
		
			
			| 229 | 238 |          RCTLogWarn(@"counld not create connection with an unstrusted SSL certification, if you're going to create connection anyway, add `trusty:true` to RNFetchBlob.config");
 | 
	
		
			
			|  | 239 | +        [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
 | 
	
		
			
			|  | 240 | +    }
 | 
	
		
			
			| 230 | 241 |  }
 | 
	
		
			
			| 231 | 242 |  
 | 
	
		
			
			| 232 | 243 |  @end
 |