Skip to content
This repository has been archived by the owner on Mar 16, 2019. It is now read-only.

Bug Fix : fix call api on background thread #528 #654

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions ios/RNFetchBlobNetwork.m
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ - (void) sendRequest:(__weak NSDictionary * _Nullable )options
self.expectedBytes = 0;
self.receivedBytes = 0;
self.options = options;

backgroundTask = [options valueForKey:@"IOSBackgroundTask"] == nil ? NO : [[options valueForKey:@"IOSBackgroundTask"] boolValue];
followRedirect = [options valueForKey:@"followRedirect"] == nil ? YES : [[options valueForKey:@"followRedirect"] boolValue];
isIncrement = [options valueForKey:@"increment"] == nil ? NO : [[options valueForKey:@"increment"] boolValue];
Expand Down Expand Up @@ -246,7 +246,9 @@ - (void) sendRequest:(__weak NSDictionary * _Nullable )options

// network status indicator
if([[options objectForKey:CONFIG_INDICATOR] boolValue] == YES)
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
dispatch_async(dispatch_get_main_queue(), ^{
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
});
__block UIApplication * app = [UIApplication sharedApplication];

}
Expand Down Expand Up @@ -483,7 +485,9 @@ - (void) URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCom
NSString * respStr = [NSNull null];
NSString * rnfbRespType = @"";

[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
dispatch_async(dispatch_get_main_queue(), ^{
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
});

if(respInfo == nil)
{
Expand Down