Browse Source

Merge pull request #85 from alextkd/master

add support for newer react-native versions and backwards compatibility for previous
Yonah Forst 7 years ago
parent
commit
0af1a22c06
3 changed files with 27 additions and 6 deletions
  1. 5
    1
      RCTConvert+RNPStatus.h
  2. 5
    2
      ReactNativePermissions.h
  3. 17
    3
      ReactNativePermissions.m

+ 5
- 1
RCTConvert+RNPStatus.h View File

@@ -6,7 +6,11 @@
6 6
 //  Copyright © 2016 Yonah Forst. All rights reserved.
7 7
 //
8 8
 
9
-#import <React/RCTConvert.h>
9
+#if __has_include("RCTConvert.h")
10
+  #import "RCTConvert.h"
11
+#else
12
+  #import <React/RCTConvert.h>
13
+#endif
10 14
 
11 15
 static NSString* RNPStatusUndetermined = @"undetermined";
12 16
 static NSString* RNPStatusDenied = @"denied";

+ 5
- 2
ReactNativePermissions.h View File

@@ -5,9 +5,12 @@
5 5
 //  Created by Yonah Forst on 18/02/16.
6 6
 //  Copyright © 2016 Yonah Forst. All rights reserved.
7 7
 //
8
-#import <React/RCTBridgeModule.h>
9 8
 
10
-#import <Foundation/Foundation.h>
9
+#if __has_include("RCTBridgeModule.h")
10
+  #import "RCTBridgeModule.h"
11
+#else
12
+  #import <React/RCTBridgeModule.h>
13
+#endif
11 14
 
12 15
 @interface ReactNativePermissions : NSObject <RCTBridgeModule>
13 16
 

+ 17
- 3
ReactNativePermissions.m View File

@@ -10,9 +10,23 @@
10 10
 
11 11
 #import "ReactNativePermissions.h"
12 12
 
13
-#import <React/RCTBridge.h>
14
-#import <React/RCTConvert.h>
15
-#import <React/RCTEventDispatcher.h>
13
+#if __has_include("RCTBridge.h")
14
+  #import "RCTBridge.h"
15
+#else
16
+  #import <React/RCTBridge.h>
17
+#endif
18
+
19
+#if __has_include("RCTConvert.h")
20
+  #import "RCTConvert.h"
21
+#else
22
+  #import <React/RCTConvert.h>
23
+#endif
24
+
25
+#if __has_include("RCTEventDispatcher.h")
26
+  #import "RCTEventDispatcher.h"
27
+#else
28
+  #import <React/RCTEventDispatcher.h>
29
+#endif
16 30
 
17 31
 #import "RNPLocation.h"
18 32
 #import "RNPBluetooth.h"