This repository was archived by the owner on Mar 16, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change 9
9
NativeAppEventEmitter ,
10
10
Platform ,
11
11
AsyncStorage ,
12
+ AppState ,
12
13
} from 'react-native'
13
14
import type {
14
15
RNFetchBlobNative ,
@@ -44,7 +45,13 @@ const {
44
45
45
46
const Blob = polyfill . Blob
46
47
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
+ } )
48
55
49
56
// register message channel event handler.
50
57
emitter . addListener ( "RNFetchBlobMessage" , ( e ) => {
Original file line number Diff line number Diff line change @@ -486,5 +486,12 @@ - (UIViewController *) documentInteractionControllerViewControllerForPreview: (U
486
486
resolve ([RNFetchBlobNetwork getCookies: url]);
487
487
})
488
488
489
+ # pragma mark - check expired network events
490
+
491
+ RCT_EXPORT_METHOD (emitExpiredEvent:(RCTResponseSenderBlock)callback
492
+ {
493
+ [RNFetchBlobNetwork emitExpiredTasks ];
494
+ })
495
+
489
496
490
497
@end
You can’t perform that action at this time.
0 commit comments