123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
-
-
-
-
- import {
- NativeModules,
- DeviceEventEmitter,
- Platform,
- NativeAppEventEmitter,
- } from 'react-native'
-
- const RNFetchBlob:RNFetchBlobNative = NativeModules.RNFetchBlob
-
-
- function actionViewIntent(path:string, mime:string = 'text/plain') {
- if(Platform.OS === 'android')
- return RNFetchBlob.actionViewIntent(path, mime)
- else
- return Promise.reject('RNFetchBlob.android.actionViewIntent only supports Android.')
- }
-
- function getContentIntent(mime:string) {
- if(Platform.OS === 'android')
- return RNFetchBlob.getContentIntent(mime)
- else
- return Promise.reject('RNFetchBlob.android.getContentIntent only supports Android.')
- }
-
- function addCompleteDownload(config) {
- if(Platform.OS === 'android')
- return RNFetchBlob.addCompleteDownload(config)
- else
- return Promise.reject('RNFetchBlob.android.addCompleteDownload only supports Android.')
- }
-
- function getSDCardDir() {
- if(Platform.OS === 'android')
- return RNFetchBlob.getSDCardDir()
- else
- return Promise.reject('RNFetchBlob.android.getSDCardDir only supports Android.')
- }
-
- function getSDCardApplicationDir() {
- if(Platform.OS === 'android')
- return RNFetchBlob.getSDCardApplicationDir()
- else
- return Promise.reject('RNFetchBlob.android.getSDCardApplicationDir only supports Android.')
- }
-
-
- export default {
- actionViewIntent,
- getContentIntent,
- addCompleteDownload,
- getSDCardDir,
- getSDCardApplicationDir,
- }
|