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 99 NativeAppEventEmitter ,
1010 Platform ,
1111 AsyncStorage ,
12+ AppState ,
1213} from 'react-native'
1314import type {
1415 RNFetchBlobNative ,
@@ -44,7 +45,13 @@ const {
4445
4546const Blob = polyfill . Blob
4647const 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.
5057emitter . addListener ( "RNFetchBlobMessage" , ( e ) => {
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments