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

Commit ae1bdbc

Browse files
committed
#244 #223 Fix RN 0.40 import
1 parent 1b6ddbe commit ae1bdbc

File tree

7 files changed

+8
-20
lines changed

7 files changed

+8
-20
lines changed

src/ios/RNFetchBlob/RNFetchBlob.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
//
66

77
//XXX: DO NO REMOVE THIS LINE IF YOU'RE USING IT ON RN > 0.40 PROJECT
8-
#define RN040_IMPORT
8+
99

1010

1111
#ifndef RNFetchBlob_h
1212
#define RNFetchBlob_h
1313

1414

15-
#ifdef RN040_IMPORT
15+
#if __has_include(<React/RCTAssert.h>)
1616
#import <React/RCTLog.h>
1717
#import <React/RCTRootView.h>
1818
#import <React/RCTBridge.h>

src/ios/RNFetchBlobFS.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
#import "RNFetchBlob.h"
1313

1414
#import <Foundation/Foundation.h>
15-
#ifdef RN040_IMPORT
15+
16+
#if __has_include(<React/RCTAssert.h>)
1617
#import <React/RCTBridgeModule.h>
1718
#else
1819
#import "RCTBridgeModule.h"

src/ios/RNFetchBlobFS.m

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

16-
#ifdef RN040_IMPORT
16+
#if __has_include(<React/RCTAssert.h>)
1717
#import <React/RCTBridge.h>
1818
#import <React/RCTEventDispatcher.h>
1919
#else

src/ios/RNFetchBlobNetwork.h

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

13-
#ifdef RN040_IMPORT
13+
#if __has_include(<React/RCTAssert.h>)
1414
#import <React/RCTBridgeModule.h>
1515
#else
1616
#import "RCTBridgeModule.h"

src/ios/RNFetchBlobNetwork.m

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

20-
#ifdef RN040_IMPORT
20+
#if __has_include(<React/RCTAssert.h>)
2121
#import <React/RCTRootView.h>
2222
#import <React/RCTLog.h>
2323
#import <React/RCTEventDispatcher.h>

src/ios/RNFetchBlobReqBuilder.m

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

16-
#ifdef RN040_IMPORT
16+
#if __has_include(<React/RCTAssert.h>)
1717
#import <React/RCTLog.h>
1818
#else
1919
#import "RCTLog.h"

src/scripts/prelink.js

-13
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,6 @@ try {
2121
console.log('adding OkHttp3 dependency to pre 0.28 project .. ok')
2222
}
2323

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-
3724
console.log('Add Android permissions => ' + (addAndroidPermissions == "true"))
3825

3926
if(addAndroidPermissions) {

0 commit comments

Comments
 (0)