ソースを参照

#244 #223 Fix RN 0.40 import

Ben Hsieh 8 年 前
コミット
ae1bdbc085
共有7 個のファイルを変更した8 個の追加20 個の削除を含む
  1. 2
    2
      src/ios/RNFetchBlob/RNFetchBlob.h
  2. 2
    1
      src/ios/RNFetchBlobFS.h
  3. 1
    1
      src/ios/RNFetchBlobFS.m
  4. 1
    1
      src/ios/RNFetchBlobNetwork.h
  5. 1
    1
      src/ios/RNFetchBlobNetwork.m
  6. 1
    1
      src/ios/RNFetchBlobReqBuilder.m
  7. 0
    13
      src/scripts/prelink.js

+ 2
- 2
src/ios/RNFetchBlob/RNFetchBlob.h ファイルの表示

5
 //
5
 //
6
 
6
 
7
 //XXX: DO NO REMOVE THIS LINE IF YOU'RE USING IT ON RN > 0.40 PROJECT
7
 //XXX: DO NO REMOVE THIS LINE IF YOU'RE USING IT ON RN > 0.40 PROJECT
8
-#define RN040_IMPORT
8
+
9
 
9
 
10
 
10
 
11
 #ifndef RNFetchBlob_h
11
 #ifndef RNFetchBlob_h
12
 #define RNFetchBlob_h
12
 #define RNFetchBlob_h
13
 
13
 
14
 
14
 
15
-#ifdef RN040_IMPORT
15
+#if __has_include(<React/RCTAssert.h>)
16
 #import <React/RCTLog.h>
16
 #import <React/RCTLog.h>
17
 #import <React/RCTRootView.h>
17
 #import <React/RCTRootView.h>
18
 #import <React/RCTBridge.h>
18
 #import <React/RCTBridge.h>

+ 2
- 1
src/ios/RNFetchBlobFS.h ファイルの表示

12
 #import "RNFetchBlob.h"
12
 #import "RNFetchBlob.h"
13
 
13
 
14
 #import <Foundation/Foundation.h>
14
 #import <Foundation/Foundation.h>
15
-#ifdef RN040_IMPORT
15
+
16
+#if __has_include(<React/RCTAssert.h>)
16
 #import <React/RCTBridgeModule.h>
17
 #import <React/RCTBridgeModule.h>
17
 #else
18
 #else
18
 #import "RCTBridgeModule.h"
19
 #import "RCTBridgeModule.h"

+ 1
- 1
src/ios/RNFetchBlobFS.m ファイルの表示

13
 #import "IOS7Polyfill.h"
13
 #import "IOS7Polyfill.h"
14
 @import AssetsLibrary;
14
 @import AssetsLibrary;
15
 
15
 
16
-#ifdef RN040_IMPORT
16
+#if __has_include(<React/RCTAssert.h>)
17
 #import <React/RCTBridge.h>
17
 #import <React/RCTBridge.h>
18
 #import <React/RCTEventDispatcher.h>
18
 #import <React/RCTEventDispatcher.h>
19
 #else
19
 #else

+ 1
- 1
src/ios/RNFetchBlobNetwork.h ファイルの表示

10
 #import "RNFetchBlobProgress.h"
10
 #import "RNFetchBlobProgress.h"
11
 #import "RNFetchBlobFS.h"
11
 #import "RNFetchBlobFS.h"
12
 
12
 
13
-#ifdef RN040_IMPORT
13
+#if __has_include(<React/RCTAssert.h>)
14
 #import <React/RCTBridgeModule.h>
14
 #import <React/RCTBridgeModule.h>
15
 #else
15
 #else
16
 #import "RCTBridgeModule.h"
16
 #import "RCTBridgeModule.h"

+ 1
- 1
src/ios/RNFetchBlobNetwork.m ファイルの表示

17
 #import <CommonCrypto/CommonDigest.h>
17
 #import <CommonCrypto/CommonDigest.h>
18
 #import "RNFetchBlobProgress.h"
18
 #import "RNFetchBlobProgress.h"
19
 
19
 
20
-#ifdef RN040_IMPORT
20
+#if __has_include(<React/RCTAssert.h>)
21
 #import <React/RCTRootView.h>
21
 #import <React/RCTRootView.h>
22
 #import <React/RCTLog.h>
22
 #import <React/RCTLog.h>
23
 #import <React/RCTEventDispatcher.h>
23
 #import <React/RCTEventDispatcher.h>

+ 1
- 1
src/ios/RNFetchBlobReqBuilder.m ファイルの表示

13
 #import "RNFetchBlobFS.h"
13
 #import "RNFetchBlobFS.h"
14
 #import "IOS7Polyfill.h"
14
 #import "IOS7Polyfill.h"
15
 
15
 
16
-#ifdef RN040_IMPORT
16
+#if __has_include(<React/RCTAssert.h>)
17
 #import <React/RCTLog.h>
17
 #import <React/RCTLog.h>
18
 #else
18
 #else
19
 #import "RCTLog.h"
19
 #import "RCTLog.h"

+ 0
- 13
src/scripts/prelink.js ファイルの表示

21
     console.log('adding OkHttp3 dependency to pre 0.28 project .. ok')
21
     console.log('adding OkHttp3 dependency to pre 0.28 project .. ok')
22
   }
22
   }
23
 
23
 
24
-  if (VERSION < 0.40) {
25
-    console.log('Removing RN040_IMPORT for RN < 0.40 project ..')
26
-    glob('**/RNFetchBlob.h',{}, function(err, files) {
27
-      if(Array.isArray(files)) {
28
-        var target = process.cwd() + '/' + files[0];
29
-        console.log('\033[92mPatching .. \033[97m' + target);
30
-        var data = fs.readFileSync(target);
31
-        fs.writeFileSync(target, String(data).replace(/#define RN040_IMPORT/, ''));
32
-        console.log('done.')
33
-      }
34
-    })
35
-  }
36
-
37
   console.log('Add Android permissions => ' + (addAndroidPermissions == "true"))
24
   console.log('Add Android permissions => ' + (addAndroidPermissions == "true"))
38
 
25
 
39
   if(addAndroidPermissions) {
26
   if(addAndroidPermissions) {