Sfoglia il codice sorgente

Add READ_SMS and RECEIVE_SMS permissions

vspedr 7 anni fa
parent
commit
3c27aeaf40
3 ha cambiato i file con 8 aggiunte e 2 eliminazioni
  1. 2
    1
      Example/android/app/src/main/AndroidManifest.xml
  2. 3
    0
      README.md
  3. 3
    1
      index.android.js

+ 2
- 1
Example/android/app/src/main/AndroidManifest.xml Vedi File

@@ -12,7 +12,8 @@
12 12
     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
13 13
     <uses-permission android:name="android.permission.READ_CONTACTS"/>
14 14
     <uses-permission android:name="android.permission.READ_CALENDAR"/>
15
-
15
+    <uses-permission android:name="android.permission.READ_SMS"/>
16
+    <uses-permission android:name="android.permission.RECEIVE_SMS"/>
16 17
 
17 18
     <application
18 19
       android:name=".MainApplication"

+ 3
- 0
README.md Vedi File

@@ -13,6 +13,7 @@ The current supported permissions are:
13 13
 - Push Notifications *(iOS only)*
14 14
 - Background Refresh *(iOS only)*
15 15
 - Speech Recognition *(iOS only)*
16
+- Read/Receive SMS *(Android only)*
16 17
 
17 18
 
18 19
 | Version | React Native Support |
@@ -120,6 +121,8 @@ Promises resolve into one of these statuses
120 121
 |`backgroundRefresh`| ✔️ | ❌ |
121 122
 |`speechRecognition`| ✔️ | ❌ |
122 123
 |`storage`| ❌️ | ✔ |
124
+|`readSms`| ❌️ | ✔ |
125
+|`receiveSms`| ❌️ | ✔ |
123 126
 
124 127
 ### Methods
125 128
 | Method Name | Arguments | Notes

+ 3
- 1
index.android.js Vedi File

@@ -12,6 +12,8 @@ const RNPTypes = {
12 12
 	event: RNPermissions.PERMISSIONS.READ_CALENDAR,
13 13
 	storage: RNPermissions.PERMISSIONS.READ_EXTERNAL_STORAGE,
14 14
 	photo: RNPermissions.PERMISSIONS.READ_EXTERNAL_STORAGE,
15
+	readSms: RNPermissions.PERMISSIONS.READ_SMS,
16
+	receiveSms: RNPermissions.PERMISSIONS.READ_SMS,
15 17
 }
16 18
 
17 19
 const RESULTS = {
@@ -41,7 +43,7 @@ class ReactNativePermissions {
41 43
 	check(permission) {
42 44
 		const androidPermission = RNPTypes[permission]
43 45
   	if (!androidPermission) return Promise.reject(`ReactNativePermissions: ${permission} is not a valid permission type on Android`);
44
-		
46
+
45 47
 		const shouldShowRationale = ReactNative.NativeModules.PermissionsAndroid.shouldShowRequestPermissionRationale;
46 48
 
47 49
 		return RNPermissions.check(androidPermission)