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

Commit bd54a37

Browse files
committed
Change prelink script for #223
1 parent fe2f9d2 commit bd54a37

File tree

7 files changed

+31
-30
lines changed

7 files changed

+31
-30
lines changed

src/ios/RNFetchBlob/RNFetchBlob.h

+10-9
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,26 @@
44
// Created by wkh237 on 2016/4/28.
55
//
66

7-
// comment out this line if your RN project >= 0.40
8-
#define OLD_IMPORT
7+
//XXX: DO NO REMOVE THIS LINE IF YOU'RE USING IT ON RN > 0.40 PROJECT
8+
//#define RN040_IMPORT
9+
910

1011
#ifndef RNFetchBlob_h
1112
#define RNFetchBlob_h
1213

1314

14-
#ifdef OLD_IMPORT
15-
#import "RCTBridgeModule.h"
16-
#import "RCTLog.h"
17-
#import "RCTRootView.h"
18-
#import "RCTBridge.h"
19-
#import "RCTEventDispatcher.h"
20-
#else
15+
#ifdef RN040_IMPORT
2116
#import <React/RCTLog.h>
2217
#import <React/RCTRootView.h>
2318
#import <React/RCTBridge.h>
2419
#import <React/RCTEventDispatcher.h>
2520
#import <React/RCTBridgeModule.h>
21+
#else
22+
#import "RCTBridgeModule.h"
23+
#import "RCTLog.h"
24+
#import "RCTRootView.h"
25+
#import "RCTBridge.h"
26+
#import "RCTEventDispatcher.h"
2627
#endif
2728

2829
#import <UIKit/UIKit.h>

src/ios/RNFetchBlobFS.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
#import "RNFetchBlob.h"
1313

1414
#import <Foundation/Foundation.h>
15-
#ifdef OLD_IMPORT
16-
#import "RCTBridgeModule.h"
17-
#else
15+
#ifdef RN040_IMPORT
1816
#import <React/RCTBridgeModule.h>
17+
#else
18+
#import "RCTBridgeModule.h"
1919
#endif
2020

2121
@import AssetsLibrary;

src/ios/RNFetchBlobFS.m

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
#import "IOS7Polyfill.h"
1414
@import AssetsLibrary;
1515

16-
#ifdef OLD_IMPORT
17-
#import "RCTBridge.h"
18-
#import "RCTEventDispatcher.h"
19-
#else
16+
#ifdef RN040_IMPORT
2017
#import <React/RCTBridge.h>
2118
#import <React/RCTEventDispatcher.h>
19+
#else
20+
#import "RCTBridge.h"
21+
#import "RCTEventDispatcher.h"
2222
#endif
2323

2424

src/ios/RNFetchBlobNetwork.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
#import "RNFetchBlobProgress.h"
1111
#import "RNFetchBlobFS.h"
1212

13-
#ifdef OLD_IMPORT
14-
#import "RCTBridgeModule.h"
15-
#else
13+
#ifdef RN040_IMPORT
1614
#import <React/RCTBridgeModule.h>
15+
#else
16+
#import "RCTBridgeModule.h"
1717
#endif
1818

1919
#ifndef RNFetchBlobNetwork_h

src/ios/RNFetchBlobNetwork.m

+6-6
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@
1717
#import <CommonCrypto/CommonDigest.h>
1818
#import "RNFetchBlobProgress.h"
1919

20-
#ifdef OLD_IMPORT
21-
#import "RCTRootView.h"
22-
#import "RCTLog.h"
23-
#import "RCTEventDispatcher.h"
24-
#import "RCTBridge.h"
25-
#else
20+
#ifdef RN040_IMPORT
2621
#import <React/RCTRootView.h>
2722
#import <React/RCTLog.h>
2823
#import <React/RCTEventDispatcher.h>
2924
#import <React/RCTBridge.h>
25+
#else
26+
#import "RCTRootView.h"
27+
#import "RCTLog.h"
28+
#import "RCTEventDispatcher.h"
29+
#import "RCTBridge.h"
3030
#endif
3131

3232
////////////////////////////////////////

src/ios/RNFetchBlobReqBuilder.m

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
#import "RNFetchBlobFS.h"
1414
#import "IOS7Polyfill.h"
1515

16-
#ifdef OLD_IMPORT
17-
#import "RCTLog.h"
18-
#else
16+
#ifdef RN040_IMPORT
1917
#import <React/RCTLog.h>
18+
#else
19+
#import "RCTLog.h"
2020
#endif
2121

2222
@interface RNFetchBlobReqBuilder()

src/scripts/prelink.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ try {
2121
console.log('adding OkHttp3 dependency to pre 0.28 project .. ok')
2222
}
2323
else if (VERSION >= 0.40) {
24-
console.log('Remove OLD_IMPORT for RN >= 0.40 project ..')
24+
console.log('Adding RN040_IMPORT for RN >= 0.40 project ..')
2525
glob('**/RNFetchBlob.h',{}, function(err, files) {
2626
if(Array.isArray(files)) {
2727
var target = process.cwd() + '/' + files[0];
2828
console.log('\033[92mPatching .. \033[97m' + target);
2929
var data = fs.readFileSync(target);
30-
fs.writeFileSync(target, String(data).replace(/#define OLD_IMPORT/, ''));
30+
fs.writeFileSync(target, String(data).replace(/\/\/#define RN040_IMPORT/, '#define RN040_IMPORT'));
3131
console.log('done.')
3232
}
3333
})

0 commit comments

Comments
 (0)