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

Commit e24a476

Browse files
committed
Add IOS support #115
1 parent 3e57fd5 commit e24a476

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/index.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
NativeAppEventEmitter,
1010
Platform,
1111
AsyncStorage,
12+
AppState,
1213
} from 'react-native'
1314
import type {
1415
RNFetchBlobNative,
@@ -44,7 +45,13 @@ const {
4445

4546
const Blob = polyfill.Blob
4647
const emitter = DeviceEventEmitter
47-
const RNFetchBlob= NativeModules.RNFetchBlob
48+
const RNFetchBlob = NativeModules.RNFetchBlob
49+
50+
AppState.addEventListener('change', (e) => {
51+
console.log('app state changed', e)
52+
if(e === 'active')
53+
RNFetchBlob.emitExpiredEvent(()=>{})
54+
})
4855

4956
// register message channel event handler.
5057
emitter.addListener("RNFetchBlobMessage", (e) => {

src/ios/RNFetchBlob/RNFetchBlob.m

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,5 +486,12 @@ - (UIViewController *) documentInteractionControllerViewControllerForPreview: (U
486486
resolve([RNFetchBlobNetwork getCookies:url]);
487487
})
488488

489+
# pragma mark - check expired network events
490+
491+
RCT_EXPORT_METHOD(emitExpiredEvent:(RCTResponseSenderBlock)callback
492+
{
493+
[RNFetchBlobNetwork emitExpiredTasks];
494+
})
495+
489496

490497
@end

0 commit comments

Comments
 (0)