|
|
|
|
9
|
throw 'RNFetchBlob could not found link Android automatically, some files could not be found.'
|
9
|
throw 'RNFetchBlob could not found link Android automatically, some files could not be found.'
|
10
|
}
|
10
|
}
|
11
|
|
11
|
|
12
|
-var package = fs.readFileSync(PACKAGE_JSON);
|
|
|
13
|
-var APP_NAME = package.name;
|
|
|
14
|
-var APPLICATION_MAIN = process.cwd() + '/android/app/src/main/java/com/' + APP_NAME.toLocaleLowerCase() + '/MainApplication.java';
|
|
|
15
|
-
|
|
|
16
|
-if(!fs.existsSync('APPLICATION_MAIN')) {
|
|
|
17
|
- throw 'RNFetchBlob could not found link Android automatically, MainApplication.java not found in path : ' + APPLICATION_MAIN
|
|
|
18
|
-}
|
|
|
19
|
-
|
|
|
20
|
-var VERSION = checkVersion();
|
|
|
21
|
-console.log('RNFetchBlob detected app version .. ' + VERSION);
|
|
|
22
|
-
|
|
|
23
|
-if(VERSION >= 0.29) {
|
|
|
24
|
- console.log('RNFetchBlob patching MainApplication.java .. ');
|
|
|
25
|
- var main = fs.readFileSync(APPLICATION_MAIN);
|
|
|
26
|
- main = main.replace('new MainReactPackage()', 'new RNFetchBlobPackage(),\n new MainReactPackage()');
|
|
|
27
|
- fs.writeFileSync(APPLICATION_MAIN, main);
|
|
|
28
|
- console.log('RNFetchBlob patching MainApplication.java .. ok')
|
|
|
29
|
-
|
|
|
30
|
-}
|
|
|
31
|
-
|
|
|
32
|
// set file access permission for Android < 6.0
|
12
|
// set file access permission for Android < 6.0
|
33
|
fs.readFile(MANIFEST_PATH, function(err, data) {
|
13
|
fs.readFile(MANIFEST_PATH, function(err, data) {
|
34
|
|
14
|
|