Browse Source

Bump to 2.0.0-rc.0

Mathieu Acthernoene 5 years ago
parent
commit
8ceca9aebd
100 changed files with 3513 additions and 5312 deletions
  1. 1
    0
      .editorconfig
  2. 4
    0
      .eslintignore
  3. 25
    0
      .eslintrc.js
  4. 0
    70
      .flowconfig
  5. 0
    74
      .github/CODE_OF_CONDUCT.md
  6. 0
    28
      .github/ISSUE_TEMPLATE.md
  7. 8
    18
      .gitignore
  8. 0
    1
      .npmignore
  9. 4
    1
      .prettierignore
  10. 3
    0
      .prettierrc
  11. 1
    0
      .yarnrc
  12. 2
    0
      CODEOWNERS
  13. 2
    2
      LICENSE
  14. 209
    205
      README.md
  15. 11
    98
      RNPermissions.podspec
  16. 5
    8
      android/build.gradle
  17. 3
    3
      android/src/main/AndroidManifest.xml
  18. 114
    0
      android/src/main/java/com/reactnativecommunity/rnpermissions/RNPermissionsModule.java
  19. 2
    3
      android/src/main/java/com/reactnativecommunity/rnpermissions/RNPermissionsPackage.java
  20. 0
    52
      android/src/main/java/com/yonahforst/rnpermissions/RNPermissionsModule.java
  21. 0
    6
      example/.buckconfig
  22. 0
    59
      example/.gitignore
  23. 0
    1
      example/.watchmanconfig
  24. 0
    185
      example/App.js
  25. 165
    0
      example/App.tsx
  26. 69
    8
      example/android/app/build.gradle
  27. 0
    7
      example/android/app/proguard-rules.pro
  28. 8
    0
      example/android/app/src/debug/AndroidManifest.xml
  29. 24
    21
      example/android/app/src/main/AndroidManifest.xml
  30. 9
    10
      example/android/app/src/main/java/com/rnpermissionsexample/MainApplication.java
  31. 1
    0
      example/android/app/src/main/res/values/styles.xml
  32. 11
    12
      example/android/build.gradle
  33. 3
    0
      example/android/gradle.properties
  34. BIN
      example/android/gradle/wrapper/gradle-wrapper.jar
  35. 1
    2
      example/android/gradle/wrapper/gradle-wrapper.properties
  36. 17
    1
      example/android/gradlew
  37. 17
    1
      example/android/gradlew.bat
  38. 0
    8
      example/android/keystores/BUCK
  39. 0
    4
      example/android/keystores/debug.keystore.properties
  40. 1
    7
      example/android/settings.gradle
  41. 1
    1
      example/babel.config.js
  42. 11
    15
      example/index.js
  43. 36
    44
      example/ios/Podfile
  44. 238
    136
      example/ios/Podfile.lock
  45. 0
    54
      example/ios/RNPermissionsExample-tvOS/Info.plist
  46. 44
    231
      example/ios/RNPermissionsExample.xcodeproj/project.pbxproj
  47. 0
    129
      example/ios/RNPermissionsExample.xcodeproj/xcshareddata/xcschemes/RNPermissionsExample-tvOS.xcscheme
  48. 2
    1
      example/ios/RNPermissionsExample/AppDelegate.h
  49. 15
    8
      example/ios/RNPermissionsExample/AppDelegate.m
  50. 14
    16
      example/ios/RNPermissionsExample/Info.plist
  51. 10
    0
      example/metro.config.js
  52. 13
    9
      example/package.json
  53. 0
    12
      example/theme.js
  54. 10
    0
      example/theme.ts
  55. 14
    0
      example/tsconfig.json
  56. 1470
    3031
      example/yarn.lock
  57. 0
    235
      index.js
  58. 19
    0
      ios/BluetoothPeripheral.podspec
  59. 1
    1
      ios/BluetoothPeripheral/RNPermissionHandlerBluetoothPeripheral.h
  60. 15
    12
      ios/BluetoothPeripheral/RNPermissionHandlerBluetoothPeripheral.m
  61. 19
    0
      ios/Calendars.podspec
  62. 1
    1
      ios/Calendars/RNPermissionHandlerCalendars.h
  63. 12
    8
      ios/Calendars/RNPermissionHandlerCalendars.m
  64. 19
    0
      ios/Camera.podspec
  65. 1
    1
      ios/Camera/RNPermissionHandlerCamera.h
  66. 37
    0
      ios/Camera/RNPermissionHandlerCamera.m
  67. 19
    0
      ios/Contacts.podspec
  68. 1
    1
      ios/Contacts/RNPermissionHandlerContacts.h
  69. 13
    9
      ios/Contacts/RNPermissionHandlerContacts.m
  70. 19
    0
      ios/FaceID.podspec
  71. 1
    1
      ios/FaceID/RNPermissionHandlerFaceID.h
  72. 115
    0
      ios/FaceID/RNPermissionHandlerFaceID.m
  73. 19
    0
      ios/LocationAlways.podspec
  74. 1
    1
      ios/LocationAlways/RNPermissionHandlerLocationAlways.h
  75. 107
    0
      ios/LocationAlways/RNPermissionHandlerLocationAlways.m
  76. 19
    0
      ios/LocationWhenInUse.podspec
  77. 1
    1
      ios/LocationWhenInUse/RNPermissionHandlerLocationWhenInUse.h
  78. 78
    0
      ios/LocationWhenInUse/RNPermissionHandlerLocationWhenInUse.m
  79. 19
    0
      ios/MediaLibrary.podspec
  80. 1
    1
      ios/MediaLibrary/RNPermissionHandlerMediaLibrary.h
  81. 18
    7
      ios/MediaLibrary/RNPermissionHandlerMediaLibrary.m
  82. 19
    0
      ios/Microphone.podspec
  83. 1
    1
      ios/Microphone/RNPermissionHandlerMicrophone.h
  84. 12
    8
      ios/Microphone/RNPermissionHandlerMicrophone.m
  85. 19
    0
      ios/Motion.podspec
  86. 1
    1
      ios/Motion/RNPermissionHandlerMotion.h
  87. 79
    0
      ios/Motion/RNPermissionHandlerMotion.m
  88. 19
    0
      ios/Notifications.podspec
  89. 7
    0
      ios/Notifications/RNPermissionHandlerNotifications.h
  90. 183
    0
      ios/Notifications/RNPermissionHandlerNotifications.m
  91. 0
    33
      ios/PermissionHandlers/Camera/RNPermissionHandlerCamera.m
  92. 0
    75
      ios/PermissionHandlers/FaceID/RNPermissionHandlerFaceID.m
  93. 0
    88
      ios/PermissionHandlers/LocationAlways/RNPermissionHandlerLocationAlways.m
  94. 0
    67
      ios/PermissionHandlers/LocationWhenInUse/RNPermissionHandlerLocationWhenInUse.m
  95. 0
    74
      ios/PermissionHandlers/Motion/RNPermissionHandlerMotion.m
  96. 0
    5
      ios/PermissionHandlers/Notifications/RNPermissionHandlerNotifications.h
  97. 0
    98
      ios/PermissionHandlers/Notifications/RNPermissionHandlerNotifications.m
  98. 19
    0
      ios/PhotoLibrary.podspec
  99. 1
    1
      ios/PhotoLibrary/RNPermissionHandlerPhotoLibrary.h
  100. 0
    0
      ios/PhotoLibrary/RNPermissionHandlerPhotoLibrary.m

+ 1
- 0
.editorconfig View File

@@ -2,6 +2,7 @@ root = true
2 2
 
3 3
 [*]
4 4
 charset = utf-8
5
+end_of_line = lf
5 6
 indent_size = 2
6 7
 indent_style = space
7 8
 insert_final_newline = true

+ 4
- 0
.eslintignore View File

@@ -0,0 +1,4 @@
1
+node_modules
2
+lib/
3
+example/android/app/build
4
+example/ios/Pods

+ 25
- 0
.eslintrc.js View File

@@ -0,0 +1,25 @@
1
+const typescriptEslintRecommended = require('@typescript-eslint/eslint-plugin/dist/configs/recommended.json');
2
+const typescriptEslintPrettier = require('eslint-config-prettier/@typescript-eslint');
3
+
4
+module.exports = {
5
+  extends: ['@react-native-community'],
6
+  overrides: [
7
+    {
8
+      files: ['*.ts', '*.tsx'],
9
+      // Apply the recommended Typescript defaults and the prettier overrides to all Typescript files
10
+      rules: Object.assign(
11
+        typescriptEslintRecommended.rules,
12
+        typescriptEslintPrettier.rules,
13
+        {'@typescript-eslint/explicit-member-accessibility': 'off'},
14
+      ),
15
+    },
16
+    {
17
+      files: ['example/**/*.ts', 'example/**/*.tsx'],
18
+      rules: {
19
+        // Turn off rules which are useless and annoying for the example files files
20
+        '@typescript-eslint/explicit-function-return-type': 'off',
21
+        'react-native/no-inline-styles': 'off',
22
+      },
23
+    },
24
+  ],
25
+};

+ 0
- 70
.flowconfig View File

@@ -1,70 +0,0 @@
1
-[ignore]
2
-; We fork some components by platform
3
-.*/*[.]android.js
4
-
5
-; Ignore "BUCK" generated dirs
6
-<PROJECT_ROOT>/\.buckd/
7
-
8
-; Ignore unexpected extra "@providesModule"
9
-.*/node_modules/.*/node_modules/fbjs/.*
10
-
11
-; Ignore duplicate module providers
12
-; For RN Apps installed via npm, "Libraries" folder is inside
13
-; "node_modules/react-native" but in the source repo it is in the root
14
-.*/Libraries/react-native/React.js
15
-
16
-; Ignore polyfills
17
-.*/Libraries/polyfills/.*
18
-
19
-; Ignore metro
20
-.*/node_modules/metro/.*
21
-
22
-[include]
23
-
24
-[libs]
25
-node_modules/react-native/Libraries/react-native/react-native-interface.js
26
-node_modules/react-native/flow/
27
-node_modules/react-native/flow-github/
28
-
29
-[options]
30
-emoji=true
31
-
32
-esproposal.optional_chaining=enable
33
-esproposal.nullish_coalescing=enable
34
-
35
-module.system=haste
36
-module.system.haste.use_name_reducers=true
37
-# get basename
38
-module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1'
39
-# strip .js or .js.flow suffix
40
-module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1'
41
-# strip .ios suffix
42
-module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1'
43
-module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1'
44
-module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1'
45
-module.system.haste.paths.blacklist=.*/__tests__/.*
46
-module.system.haste.paths.blacklist=.*/__mocks__/.*
47
-module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/Animated/src/polyfills/.*
48
-module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/Libraries/.*
49
-
50
-munge_underscores=true
51
-
52
-module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
53
-
54
-module.file_ext=.js
55
-module.file_ext=.jsx
56
-module.file_ext=.json
57
-module.file_ext=.native.js
58
-
59
-suppress_type=$FlowIssue
60
-suppress_type=$FlowFixMe
61
-suppress_type=$FlowFixMeProps
62
-suppress_type=$FlowFixMeState
63
-
64
-suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
65
-suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
66
-suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
67
-suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
68
-
69
-[version]
70
-^0.86.0

+ 0
- 74
.github/CODE_OF_CONDUCT.md View File

@@ -1,74 +0,0 @@
1
-# Contributor Covenant Code of Conduct
2
-
3
-## Our Pledge
4
-
5
-In the interest of fostering an open and welcoming environment, we as
6
-contributors and maintainers pledge to making participation in our project and
7
-our community a harassment-free experience for everyone, regardless of age, body
8
-size, disability, ethnicity, gender identity and expression, level of
9
-experience, nationality, personal appearance, race, religion, or sexual identity
10
-and orientation.
11
-
12
-## Our Standards
13
-
14
-Examples of behavior that contributes to creating a positive environment
15
-include:
16
-
17
-- Using welcoming and inclusive language
18
-- Being respectful of differing viewpoints and experiences
19
-- Gracefully accepting constructive criticism
20
-- Focusing on what is best for the community
21
-- Showing empathy towards other community members
22
-
23
-Examples of unacceptable behavior by participants include:
24
-
25
-- The use of sexualized language or imagery and unwelcome sexual attention or
26
-  advances
27
-- Trolling, insulting/derogatory comments, and personal or political attacks
28
-- Public or private harassment
29
-- Publishing others' private information, such as a physical or electronic
30
-  address, without explicit permission
31
-- Other conduct which could reasonably be considered inappropriate in a
32
-  professional setting
33
-
34
-## Our Responsibilities
35
-
36
-Project maintainers are responsible for clarifying the standards of acceptable
37
-behavior and are expected to take appropriate and fair corrective action in
38
-response to any instances of unacceptable behavior.
39
-
40
-Project maintainers have the right and responsibility to remove, edit, or reject
41
-comments, commits, code, wiki edits, issues, and other contributions that are
42
-not aligned to this Code of Conduct, or to ban temporarily or permanently any
43
-contributor for other behaviors that they deem inappropriate, threatening,
44
-offensive, or harmful.
45
-
46
-## Scope
47
-
48
-This Code of Conduct applies both within project spaces and in public spaces
49
-when an individual is representing the project or its community. Examples of
50
-representing a project or community include using an official project e-mail
51
-address, posting via an official social media account, or acting as an appointed
52
-representative at an online or offline event. Representation of a project may be
53
-further defined and clarified by project maintainers.
54
-
55
-## Enforcement
56
-
57
-Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
-reported by contacting the project team at yonaforst@hotmail.com. The project
59
-team will review and investigate all complaints, and will respond in a way that
60
-it deems appropriate to the circumstances. The project team is obligated to
61
-maintain confidentiality with regard to the reporter of an incident. Further
62
-details of specific enforcement policies may be posted separately.
63
-
64
-Project maintainers who do not follow or enforce the Code of Conduct in good
65
-faith may face temporary or permanent repercussions as determined by other
66
-members of the project's leadership.
67
-
68
-## Attribution
69
-
70
-This Code of Conduct is adapted from the [Contributor Covenant][homepage],
71
-version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
72
-
73
-[homepage]: http://contributor-covenant.org
74
-[version]: http://contributor-covenant.org/version/1/4/

+ 0
- 28
.github/ISSUE_TEMPLATE.md View File

@@ -1,28 +0,0 @@
1
-<!--
2
-
3
-Hello!
4
-
5
-Please read the following carefully before opening a new issue. Your issue may
6
-be closed if it doesn't provide the informations required.
7
-
8
--->
9
-
10
-### Describe your environment
11
-
12
-- react-native-permissions version
13
-- react-native version
14
-- Target platform: iOS, Android, both?
15
-- Device (which one?), simulator?
16
-- OS version
17
-- DevTools: Xcode version, Android Studio version
18
-- (Android only: buildToolsVersion)
19
-
20
-### How to repeat issue and example
21
-
22
-Explain what you did, what you expected to happen, and what actually happens.
23
-Provide some code if needed.
24
-
25
-### Solution
26
-
27
-Do you know what needs to be done to address this issue? Ideally, provide a pull
28
-request with a fix.

+ 8
- 18
.gitignore View File

@@ -1,9 +1,7 @@
1 1
 # OSX
2
-#
3 2
 .DS_Store
4 3
 
5 4
 # Xcode
6
-#
7 5
 build/
8 6
 *.pbxuser
9 7
 !default.pbxuser
@@ -23,15 +21,16 @@ DerivedData
23 21
 project.xcworkspace
24 22
 
25 23
 # Android/IntelliJ
26
-#
27 24
 build/
28 25
 .idea
29 26
 .gradle
30 27
 local.properties
31 28
 *.iml
32 29
 
30
+# Visual Studio Code
31
+.vscode/
32
+
33 33
 # node.js
34
-#
35 34
 node_modules/
36 35
 npm-debug.log
37 36
 yarn-error.log
@@ -41,20 +40,11 @@ buck-out/
41 40
 \.buckd/
42 41
 *.keystore
43 42
 
44
-# fastlane
45
-#
46
-# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
47
-# screenshots whenever they are needed.
48
-# For more information about the recommended setup visit:
49
-# https://docs.fastlane.tools/best-practices/source-control/
50
-
51
-*/fastlane/report.xml
52
-*/fastlane/Preview.html
53
-*/fastlane/screenshots
54
-
55 43
 # Bundle artifact
56 44
 *.jsbundle
57 45
 
58
-# VScode
59
-#
60
-.vscode/
46
+# Bob
47
+lib/
48
+
49
+# CocoaPods
50
+Pods/

+ 0
- 1
.npmignore View File

@@ -1 +0,0 @@
1
-example/

+ 4
- 1
.prettierignore View File

@@ -1 +1,4 @@
1
-example/node_modules/
1
+node_modules
2
+lib/
3
+example/android/app/build
4
+example/ios/Pods

+ 3
- 0
.prettierrc View File

@@ -1,3 +1,6 @@
1 1
 {
2
+  "bracketSpacing": false,
3
+  "jsxBracketSameLine": true,
4
+  "singleQuote": true,
2 5
   "trailingComma": "all"
3 6
 }

+ 1
- 0
.yarnrc View File

@@ -0,0 +1 @@
1
+save-exact true

+ 2
- 0
CODEOWNERS View File

@@ -0,0 +1,2 @@
1
+# Global owners
2
+* @zoontek

+ 2
- 2
LICENSE View File

@@ -1,6 +1,6 @@
1
-The MIT License (MIT)
1
+MIT License
2 2
 
3
-Copyright (c) 2015 Yonah Forst
3
+Copyright (c) 2019 Mathieu Acthernoene
4 4
 
5 5
 Permission is hereby granted, free of charge, to any person obtaining a copy
6 6
 of this software and associated documentation files (the "Software"), to deal

+ 209
- 205
README.md View File

@@ -6,68 +6,84 @@
6 6
 ![MIT](https://img.shields.io/dub/l/vibe-d.svg)
7 7
 [![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
8 8
 
9
-Request user permissions on iOS and Android.
10
-
11
-### ⚠️  Branch WIP 2.0.0 : Go to [pull request #291](https://github.com/yonahforst/react-native-permissions/pull/291) for feedbacks.
9
+Check and request user permissions in React Native
12 10
 
13 11
 ## Support
14 12
 
15 13
 | version | react-native version |
16 14
 | ------- | -------------------- |
17
-| 2.0.0+  | 0.56.0+              |
15
+| 2.0.0+  | 0.60.0+              |
18 16
 | 1.1.1   | 0.40.0 - 0.52.2      |
19 17
 
18
+For 2.0.0 with 0.59-, you can use [`jetify -r`](https://github.com/mikehardy/jetifier/blob/master/README.md#to-reverse-jetify--convert-node_modules-dependencies-to-support-libraries)
19
+
20 20
 ## Setup
21 21
 
22 22
 ```bash
23
-$ npm install --save react-native-permissions
23
+$ npm install --save react-native-permissions@2.0.0-rc.0
24 24
 # --- or ---
25
-$ yarn add react-native-permissions
25
+$ yarn add react-native-permissions@2.0.0-rc.0
26 26
 ```
27 27
 
28
-### iOS specific
28
+### iOS
29 29
 
30
-To allow installation of the needed permission handlers for your project (and only them), `react-native-permissions` uses CocoaPods. Update the following line with your path to `node_modules/` and add it to your podfile:
30
+By default no permission handler is installed. Add update your Podfile with the ones you want, then run `pod install`.
31 31
 
32 32
 ```ruby
33 33
 target 'YourAwesomeProject' do
34 34
 
35 35
   # …
36 36
 
37
-  pod 'RNPermissions', :path => '../node_modules/react-native-permissions', :subspecs => [
38
-    'Core',
39
-    ## Uncomment needed permissions
40
-    # 'BluetoothPeripheral',
41
-    # 'Calendars',
42
-    # 'Camera',
43
-    # 'Contacts',
44
-    # 'FaceID',
45
-    # 'LocationAlways',
46
-    # 'LocationWhenInUse',
47
-    # 'MediaLibrary',
48
-    # 'Microphone',
49
-    # 'Motion',
50
-    # 'Notifications',
51
-    # 'PhotoLibrary',
52
-    # 'Reminders',
53
-    # 'Siri',
54
-    # 'SpeechRecognition',
55
-    # 'StoreKit',
56
-  ]
37
+  permissions_path = '../node_modules/react-native-permissions/ios'
38
+
39
+  pod 'Permission-BluetoothPeripheral', :path => "#{permissions_path}/BluetoothPeripheral.podspec"
40
+  pod 'Permission-Calendars', :path => "#{permissions_path}/Calendars.podspec"
41
+  pod 'Permission-Camera', :path => "#{permissions_path}/Camera.podspec"
42
+  pod 'Permission-Contacts', :path => "#{permissions_path}/Contacts.podspec"
43
+  pod 'Permission-FaceID', :path => "#{permissions_path}/FaceID.podspec"
44
+  pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways.podspec"
45
+  pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse.podspec"
46
+  pod 'Permission-MediaLibrary', :path => "#{permissions_path}/MediaLibrary.podspec"
47
+  pod 'Permission-Microphone', :path => "#{permissions_path}/Microphone.podspec"
48
+  pod 'Permission-Motion', :path => "#{permissions_path}/Motion.podspec"
49
+  pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications.podspec"
50
+  pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary.podspec"
51
+  pod 'Permission-Reminders', :path => "#{permissions_path}/Reminders.podspec"
52
+  pod 'Permission-Siri', :path => "#{permissions_path}/Siri.podspec"
53
+  pod 'Permission-SpeechRecognition', :path => "#{permissions_path}/SpeechRecognition.podspec"
54
+  pod 'Permission-StoreKit', :path => "#{permissions_path}/StoreKit.podspec"
57 55
 
58 56
 end
59 57
 ```
60 58
 
61
-### Android specific
59
+_⚠️ Don't forget to add permissions to `AndroidManifest.xml` for android and
60
+`Info.plist` for iOS._
61
+
62
+## 🆘 Manual linking
63
+
64
+Because this package targets React Native 0.60+, you will probably don't need to link it. Otherwise if you follow all the previous steps and it still doesn't work, try to link this library manually:
62 65
 
63
-1.  Add the following lines to `android/settings.gradle`:
66
+#### iOS
67
+
68
+Add this line to your `ios/Podfile` file, then run `pod install`.
69
+
70
+```bash
71
+target 'YourAwesomeProject' do
72
+  # …
73
+  pod 'RNPermissions', :path => '../node_modules/react-native-permissions'
74
+end
75
+```
76
+
77
+### Android
78
+
79
+1. Add the following lines to `android/settings.gradle`:
64 80
 
65 81
 ```gradle
66 82
 include ':react-native-permissions'
67 83
 project(':react-native-permissions').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-permissions/android')
68 84
 ```
69 85
 
70
-2.  Add the compile line to the dependencies in `android/app/build.gradle`:
86
+2. Add the implementation line to the dependencies in `android/app/build.gradle`:
71 87
 
72 88
 ```gradle
73 89
 dependencies {
@@ -76,10 +92,10 @@ dependencies {
76 92
 }
77 93
 ```
78 94
 
79
-3.  Add the import and link the package in `MainApplication.java`:
95
+3. Add the import and link the package in `MainApplication.java`:
80 96
 
81 97
 ```java
82
-import com.yonahforst.rnpermissions.RNPermissionsPackage; // <-- Add the import
98
+import com.reactnativecommunity.rnpermissions.RNPermissionsPackage; // <- add the RNPermissionsPackage import
83 99
 
84 100
 public class MainApplication extends Application implements ReactApplication {
85 101
 
@@ -87,89 +103,84 @@ public class MainApplication extends Application implements ReactApplication {
87 103
 
88 104
   @Override
89 105
   protected List<ReactPackage> getPackages() {
90
-    return Arrays.<ReactPackage>asList(
91
-      new MainReactPackage(),
92
-      // …
93
-      new RNPermissionsPackage() // <-- Add it to the packages list
94
-    );
106
+    @SuppressWarnings("UnnecessaryLocalVariable")
107
+    List<ReactPackage> packages = new PackageList(this).getPackages();
108
+    // …
109
+    packages.add(new RNPermissionsPackage());
110
+    return packages;
95 111
   }
96 112
 
97 113
   // …
98 114
 }
99 115
 ```
100 116
 
101
-_📌 Don't forget to add permissions to `AndroidManifest.xml` for android and
102
-`Info.plist` for iOS (Xcode >= 8)._
103
-
104
-## API (subject to changes)
117
+## API
105 118
 
106 119
 ### Permissions statuses
107 120
 
108 121
 Promises resolve into one of these statuses:
109 122
 
110
-| Return value              | Notes                                                              |
111
-| ------------------------- | ------------------------------------------------------------------ |
112
-| `RESULTS.UNAVAILABLE`     | This feature is not available on this device.                      |
113
-| `RESULTS.GRANTED`         | The permission is granted.                                         |
114
-| `RESULTS.DENIED`          | The permission has not been requested / is denied but requestable. |
115
-| `RESULTS.NEVER_ASK_AGAIN` | The permission is not requestable anymore.                         |
123
+| Return value          | Notes                                                             |
124
+| --------------------- | ----------------------------------------------------------------- |
125
+| `RESULTS.UNAVAILABLE` | This feature is not available (on this device / in this context)  |
126
+| `RESULTS.DENIED`      | The permission has not been requested / is denied but requestable |
127
+| `RESULTS.GRANTED`     | The permission is granted                                         |
128
+| `RESULTS.BLOCKED`     | The permission is denied and not requestable anymore              |
116 129
 
117 130
 ### Supported permissions
118 131
 
119 132
 ```js
120
-import { ANDROID_PERMISSIONS, IOS_PERMISSIONS } from "react-native-permissions";
121
-
122
-// For Android
123
-
124
-// same as PermissionsAndroid
125
-ANDROID_PERMISSIONS.READ_CALENDAR;
126
-ANDROID_PERMISSIONS.WRITE_CALENDAR;
127
-ANDROID_PERMISSIONS.CAMERA;
128
-ANDROID_PERMISSIONS.READ_CONTACTS;
129
-ANDROID_PERMISSIONS.WRITE_CONTACTS;
130
-ANDROID_PERMISSIONS.GET_ACCOUNTS;
131
-ANDROID_PERMISSIONS.ACCESS_FINE_LOCATION;
132
-ANDROID_PERMISSIONS.ACCESS_COARSE_LOCATION;
133
-ANDROID_PERMISSIONS.RECORD_AUDIO;
134
-ANDROID_PERMISSIONS.READ_PHONE_STATE;
135
-ANDROID_PERMISSIONS.CALL_PHONE;
136
-ANDROID_PERMISSIONS.READ_CALL_LOG;
137
-ANDROID_PERMISSIONS.WRITE_CALL_LOG;
138
-ANDROID_PERMISSIONS.ADD_VOICEMAIL;
139
-ANDROID_PERMISSIONS.USE_SIP;
140
-ANDROID_PERMISSIONS.PROCESS_OUTGOING_CALLS;
141
-ANDROID_PERMISSIONS.BODY_SENSORS;
142
-ANDROID_PERMISSIONS.SEND_SMS;
143
-ANDROID_PERMISSIONS.RECEIVE_SMS;
144
-ANDROID_PERMISSIONS.READ_SMS;
145
-ANDROID_PERMISSIONS.RECEIVE_WAP_PUSH;
146
-ANDROID_PERMISSIONS.RECEIVE_MMS;
147
-ANDROID_PERMISSIONS.READ_EXTERNAL_STORAGE;
148
-ANDROID_PERMISSIONS.WRITE_EXTERNAL_STORAGE;
149
-
150
-// new ones
151
-ANDROID_PERMISSIONS.ANSWER_PHONE_CALLS;
152
-ANDROID_PERMISSIONS.ACCEPT_HANDOVER;
153
-ANDROID_PERMISSIONS.READ_PHONE_NUMBERS;
154
-
155
-// For iOS
156
-
157
-IOS_PERMISSIONS.BLUETOOTH_PERIPHERAL;
158
-IOS_PERMISSIONS.CALENDARS;
159
-IOS_PERMISSIONS.CAMERA;
160
-IOS_PERMISSIONS.CONTACTS;
161
-IOS_PERMISSIONS.FACE_ID;
162
-IOS_PERMISSIONS.LOCATION_ALWAYS;
163
-IOS_PERMISSIONS.LOCATION_WHEN_IN_USE;
164
-IOS_PERMISSIONS.MEDIA_LIBRARY;
165
-IOS_PERMISSIONS.MICROPHONE;
166
-IOS_PERMISSIONS.MOTION;
167
-IOS_PERMISSIONS.NOTIFICATIONS;
168
-IOS_PERMISSIONS.PHOTO_LIBRARY;
169
-IOS_PERMISSIONS.REMINDERS;
170
-IOS_PERMISSIONS.SIRI;
171
-IOS_PERMISSIONS.SPEECH_RECOGNITION;
172
-IOS_PERMISSIONS.STOREKIT;
133
+import {PERMISSIONS} from 'react-native-permissions';
134
+
135
+// Android permissions
136
+
137
+PERMISSIONS.ANDROID.ACCEPT_HANDOVER;
138
+PERMISSIONS.ANDROID.ACCESS_BACKGROUND_LOCATION;
139
+PERMISSIONS.ANDROID.ACCESS_COARSE_LOCATION;
140
+PERMISSIONS.ANDROID.ACCESS_FINE_LOCATION;
141
+PERMISSIONS.ANDROID.ACTIVITY_RECOGNITION;
142
+PERMISSIONS.ANDROID.ADD_VOICEMAIL;
143
+PERMISSIONS.ANDROID.ANSWER_PHONE_CALLS;
144
+PERMISSIONS.ANDROID.BODY_SENSORS;
145
+PERMISSIONS.ANDROID.CALL_PHONE;
146
+PERMISSIONS.ANDROID.CAMERA;
147
+PERMISSIONS.ANDROID.GET_ACCOUNTS;
148
+PERMISSIONS.ANDROID.PROCESS_OUTGOING_CALLS;
149
+PERMISSIONS.ANDROID.READ_CALENDAR;
150
+PERMISSIONS.ANDROID.READ_CALL_LOG;
151
+PERMISSIONS.ANDROID.READ_CONTACTS;
152
+PERMISSIONS.ANDROID.READ_EXTERNAL_STORAGE;
153
+PERMISSIONS.ANDROID.READ_PHONE_NUMBERS;
154
+PERMISSIONS.ANDROID.READ_PHONE_STATE;
155
+PERMISSIONS.ANDROID.READ_SMS;
156
+PERMISSIONS.ANDROID.RECEIVE_MMS;
157
+PERMISSIONS.ANDROID.RECEIVE_SMS;
158
+PERMISSIONS.ANDROID.RECEIVE_WAP_PUSH;
159
+PERMISSIONS.ANDROID.RECORD_AUDIO;
160
+PERMISSIONS.ANDROID.SEND_SMS;
161
+PERMISSIONS.ANDROID.USE_SIP;
162
+PERMISSIONS.ANDROID.WRITE_CALENDAR;
163
+PERMISSIONS.ANDROID.WRITE_CALL_LOG;
164
+PERMISSIONS.ANDROID.WRITE_CONTACTS;
165
+PERMISSIONS.ANDROID.WRITE_EXTERNAL_STORAGE;
166
+
167
+// iOS permissions
168
+
169
+PERMISSIONS.IOS.BLUETOOTH_PERIPHERAL;
170
+PERMISSIONS.IOS.CALENDARS;
171
+PERMISSIONS.IOS.CAMERA;
172
+PERMISSIONS.IOS.CONTACTS;
173
+PERMISSIONS.IOS.FACE_ID;
174
+PERMISSIONS.IOS.LOCATION_ALWAYS;
175
+PERMISSIONS.IOS.LOCATION_WHEN_IN_USE;
176
+PERMISSIONS.IOS.MEDIA_LIBRARY;
177
+PERMISSIONS.IOS.MICROPHONE;
178
+PERMISSIONS.IOS.MOTION;
179
+PERMISSIONS.IOS.PHOTO_LIBRARY;
180
+PERMISSIONS.IOS.REMINDERS;
181
+PERMISSIONS.IOS.SIRI;
182
+PERMISSIONS.IOS.SPEECH_RECOGNITION;
183
+PERMISSIONS.IOS.STOREKIT;
173 184
 ```
174 185
 
175 186
 ### Methods
@@ -177,165 +188,158 @@ IOS_PERMISSIONS.STOREKIT;
177 188
 _types used in usage examples_
178 189
 
179 190
 ```ts
180
-type Permission = keyof ANDROID_PERMISSIONS | keyof IOS_PERMISSIONS;
181
-
182
-type PermissionStatus =
183
-  | "granted"
184
-  | "denied"
185
-  | "never_ask_again"
186
-  | "unavailable";
191
+type PermissionStatus = 'unavailable' | 'denied' | 'blocked' | 'granted';
187 192
 ```
188 193
 
189
-#### check()
194
+#### check
190 195
 
191 196
 Check one permission status.
192 197
 
193
-#### Method type
194
-
195
-```ts
196
-function check(permission: Permission): Promise<PermissionStatus>;
197
-```
198
-
199
-#### Usage example
200
-
201
-```js
202
-import { check, IOS_PERMISSIONS, RESULTS } from "react-native-permissions";
203
-
204
-check(RNPermissions.IOS_PERMISSIONS.LOCATION_ALWAYS).then(result => {
205
-  switch (result) {
206
-    case RESULTS.UNAVAILABLE:
207
-      console.log("the feature is not available on this device");
208
-      break;
209
-    case RESULTS.GRANTED:
210
-      console.log("permission is granted");
211
-      break;
212
-    case RESULTS.DENIED:
213
-      console.log("permission is denied, but requestable");
214
-      break;
215
-    case RESULTS.NEVER_ASK_AGAIN:
216
-      console.log("permission is denied and not requestable");
217
-      break;
218
-  }
219
-});
220
-```
221
-
222
----
223
-
224
-#### checkMultiple()
225
-
226
-Check multiples permissions.
227
-
228
-#### Method type
229
-
230 198
 ```ts
231
-function checkMultiple<P: Permission>(permissions: P[]): Promise<{ [permission: P]: PermissionStatus }>;
199
+function check(permission: string): Promise<PermissionStatus>;
232 200
 ```
233 201
 
234
-#### Usage example
235
-
236 202
 ```js
237
-import { checkMultiple, IOS_PERMISSIONS } from "react-native-permissions";
238
-
239
-checkMultiple([
240
-  IOS_PERMISSIONS.LOCATION_ALWAYS,
241
-  IOS_PERMISSIONS.MEDIA_LIBRARY,
242
-]).then(results => {
243
-  // results.LOCATION_ALWAYS
244
-  // results.MEDIA_LIBRARY
245
-});
203
+import {check, PERMISSIONS, RESULTS} from 'react-native-permissions';
204
+
205
+check(PERMISSIONS.IOS.LOCATION_ALWAYS)
206
+  .then(result => {
207
+    switch (result) {
208
+      case RESULTS.UNAVAILABLE:
209
+        console.log('the feature is not available');
210
+        break;
211
+      case RESULTS.GRANTED:
212
+        console.log('permission is granted');
213
+        break;
214
+      case RESULTS.DENIED:
215
+        console.log('permission is denied and / or requestable');
216
+        break;
217
+      case RESULTS.BLOCKED:
218
+        console.log('permission is denied and not requestable');
219
+        break;
220
+    }
221
+  })
222
+  .catch(error => {
223
+    // …
224
+  });
246 225
 ```
247 226
 
248 227
 ---
249 228
 
250
-#### request()
229
+#### request
251 230
 
252 231
 Request one permission.
253 232
 
254
-#### Method type
255
-
256 233
 ```ts
257
-type NotificationOption =
258
-  | "badge"
259
-  | "sound"
260
-  | "alert"
261
-  | "carPlay"
262
-  | "criticalAlert"
263
-  | "provisional";
264
-
265 234
 type Rationale = {
266 235
   title: string;
267 236
   message: string;
268
-  buttonPositive: string;
237
+  buttonPositive?: string;
269 238
   buttonNegative?: string;
270 239
   buttonNeutral?: string;
271 240
 };
272 241
 
273 242
 function request(
274 243
   permission: string,
275
-  config: {
276
-    notificationOptions?: NotificationOption[];
277
-    rationale?: Rationale;
278
-  } = {},
244
+  rationale?: Rationale,
279 245
 ): Promise<PermissionStatus>;
280 246
 ```
281 247
 
282
-#### Usage example
283
-
284 248
 ```js
285
-import { request, IOS_PERMISSIONS } from "react-native-permissions";
249
+import {request, PERMISSIONS} from 'react-native-permissions';
286 250
 
287
-request(IOS_PERMISSIONS.LOCATION_ALWAYS).then(result => {
251
+request(PERMISSIONS.IOS.LOCATION_ALWAYS).then(result => {
288 252
   // …
289 253
 });
290 254
 ```
291 255
 
292 256
 ---
293 257
 
294
-#### requestMultiple()
258
+#### checkNotifications
295 259
 
296
-Request multiples permissions.
297
-
298
-#### Method type
260
+Check notifications permission status and get settings values.
299 261
 
300 262
 ```ts
301
-function requestMultiple<P: Permission>(permissions: P[]): Promise<{ [permission: P]: PermissionStatus }>;
302
-```
263
+interface NotificationSettings {
264
+  // properties only availables on iOS
265
+  // unavaible settings will not be included in the response object
266
+  alert?: boolean;
267
+  badge?: boolean;
268
+  sound?: boolean;
269
+  lockScreen?: boolean;
270
+  carPlay?: boolean;
271
+  critical?: boolean;
272
+}
303 273
 
304
-#### Usage example
274
+function checkNotifications(): Promise<{
275
+  status: PermissionStatus;
276
+  settings: NotificationSettings;
277
+}>;
278
+```
305 279
 
306 280
 ```js
307
-import { requestMultiple, IOS_PERMISSIONS } from "react-native-permissions";
308
-
309
-requestMultiple([
310
-  IOS_PERMISSIONS.LOCATION_ALWAYS,
311
-  IOS_PERMISSIONS.MEDIA_LIBRARY,
312
-]).then(results => {
313
-  // results.LOCATION_ALWAYS
314
-  // results.MEDIA_LIBRARY
281
+import {checkNotifications} from 'react-native-permissions';
282
+
283
+checkNotifications().then(({status, settings}) => {
284
+  // …
315 285
 });
316 286
 ```
317 287
 
318 288
 ---
319 289
 
320
-#### openSettings()
290
+#### requestNotifications
321 291
 
322
-Open application settings.
323
-
324
-#### Method type
292
+Open application settings
325 293
 
326 294
 ```ts
327
-function openSettings(): Promise<boolean>;
328
-```
295
+// only used on iOS
296
+type NotificationOption =
297
+  | 'alert'
298
+  | 'badge'
299
+  | 'sound'
300
+  | 'criticalAlert'
301
+  | 'carPlay'
302
+  | 'provisional';
303
+
304
+interface NotificationSettings {
305
+  // properties only availables on iOS
306
+  // unavaible settings will not be included in the response object
307
+  alert?: boolean;
308
+  badge?: boolean;
309
+  sound?: boolean;
310
+  lockScreen?: boolean;
311
+  carPlay?: boolean;
312
+  critical?: boolean;
313
+}
329 314
 
330
-#### Usage example
315
+function requestNotifications(
316
+  options: NotificationOption[],
317
+): Promise<{
318
+  status: PermissionStatus;
319
+  settings: NotificationSettings;
320
+}>;
321
+```
331 322
 
332 323
 ```js
333
-import { openSettings } from "react-native-permissions";
324
+import {requestNotifications} from 'react-native-permissions';
334 325
 
335
-openSettings().catch(() => console.warn("cannot open settings");
326
+requestNotifications(['alert', 'sound']).then(({status, settings}) => {
327
+  // …
328
+});
336 329
 ```
337 330
 
338
-## 🍎  iOS Notes
331
+---
332
+
333
+#### openSettings
339 334
 
340
-- Permission type `BLUETOOTH_PERIPHERAL` represents the status of the `CBPeripheralManager`.
341
-- If `notificationOptions` config array is omitted on `NOTIFICATIONS` request, it will request `alert`, `badge` and `sound`.
335
+Open application settings.
336
+
337
+```ts
338
+function openSettings(): Promise<void>;
339
+```
340
+
341
+```js
342
+import {openSettings} from 'react-native-permissions';
343
+
344
+openSettings().catch(() => console.warn('cannot open settings'));
345
+```

+ 11
- 98
RNPermissions.podspec View File

@@ -2,105 +2,18 @@ require 'json'
2 2
 package = JSON.parse(File.read('./package.json'))
3 3
 
4 4
 Pod::Spec.new do |s|
5
-  s.name                   = "RNPermissions"
5
+  s.name            = "RNPermissions"
6
+  s.dependency        "React"
6 7
 
7
-  s.version                = package["version"]
8
-  s.license                = package["license"]
9
-  s.description            = package["description"]
10
-  s.summary                = package["description"]
11
-  s.authors                = package["author"]
12
-  s.homepage               = package["homepage"]
8
+  s.version         = package["version"]
9
+  s.license         = package["license"]
10
+  s.summary         = package["description"]
11
+  s.authors         = package["author"]
12
+  s.homepage        = package["homepage"]
13 13
 
14
-  s.default_subspec        = "Core"
15
-  s.requires_arc           = true
16
-  s.pod_target_xcconfig    = { "CLANG_CXX_LANGUAGE_STANDARD" => "c++14" }
17
-  s.platforms              = { :ios => "9.0", :tvos => "9.2" }
14
+  s.platform        = :ios, "9.0"
15
+  s.requires_arc    = true
18 16
 
19
-  s.source                 = { :git => "#{s.homepage}.git", :tag => s.version }
20
-  s.source_files           = "ios/*.{h,m}"
21
-
22
-  s.subspec "Core" do |ss|
23
-    s.dependency             "React/Core"
24
-    ss.source_files        = "ios/*.{h,m}"
25
-  end
26
-
27
-  s.subspec "BluetoothPeripheral" do |ss|
28
-    ss.dependency            "RNPermissions/Core"
29
-    ss.source_files        = "ios/PermissionHandlers/BluetoothPeripheral/*.{h,m}"
30
-  end
31
-
32
-  s.subspec "Calendars" do |ss|
33
-    ss.dependency            "RNPermissions/Core"
34
-    ss.source_files        = "ios/PermissionHandlers/Calendars/*.{h,m}"
35
-  end
36
-
37
-  s.subspec "Camera" do |ss|
38
-    ss.dependency            "RNPermissions/Core"
39
-    ss.source_files        = "ios/PermissionHandlers/Camera/*.{h,m}"
40
-  end
41
-
42
-  s.subspec "Contacts" do |ss|
43
-    ss.dependency            "RNPermissions/Core"
44
-    ss.source_files        = "ios/PermissionHandlers/Contacts/*.{h,m}"
45
-  end
46
-
47
-  s.subspec "FaceID" do |ss|
48
-    ss.dependency            "RNPermissions/Core"
49
-    ss.source_files        = "ios/PermissionHandlers/FaceID/*.{h,m}"
50
-  end
51
-
52
-  s.subspec "LocationAlways" do |ss|
53
-    ss.dependency            "RNPermissions/Core"
54
-    ss.source_files        = "ios/PermissionHandlers/LocationAlways/*.{h,m}"
55
-  end
56
-
57
-  s.subspec "LocationWhenInUse" do |ss|
58
-    ss.dependency            "RNPermissions/Core"
59
-    ss.source_files        = "ios/PermissionHandlers/LocationWhenInUse/*.{h,m}"
60
-  end
61
-
62
-  s.subspec "MediaLibrary" do |ss|
63
-    ss.dependency            "RNPermissions/Core"
64
-    ss.source_files        = "ios/PermissionHandlers/MediaLibrary/*.{h,m}"
65
-  end
66
-
67
-  s.subspec "Microphone" do |ss|
68
-    ss.dependency            "RNPermissions/Core"
69
-    ss.source_files        = "ios/PermissionHandlers/Microphone/*.{h,m}"
70
-  end
71
-
72
-  s.subspec "Motion" do |ss|
73
-    ss.dependency            "RNPermissions/Core"
74
-    ss.source_files        = "ios/PermissionHandlers/Motion/*.{h,m}"
75
-  end
76
-
77
-  s.subspec "Notifications" do |ss|
78
-    ss.dependency            "RNPermissions/Core"
79
-    ss.source_files        = "ios/PermissionHandlers/Notifications/*.{h,m}"
80
-  end
81
-
82
-  s.subspec "PhotoLibrary" do |ss|
83
-    ss.dependency            "RNPermissions/Core"
84
-    ss.source_files        = "ios/PermissionHandlers/PhotoLibrary/*.{h,m}"
85
-  end
86
-
87
-  s.subspec "Reminders" do |ss|
88
-    ss.dependency            "RNPermissions/Core"
89
-    ss.source_files        = "ios/PermissionHandlers/Reminders/*.{h,m}"
90
-  end
91
-
92
-  s.subspec "Siri" do |ss|
93
-    ss.dependency            "RNPermissions/Core"
94
-    ss.source_files        = "ios/PermissionHandlers/Siri/*.{h,m}"
95
-  end
96
-
97
-  s.subspec "SpeechRecognition" do |ss|
98
-    ss.dependency            "RNPermissions/Core"
99
-    ss.source_files        = "ios/PermissionHandlers/SpeechRecognition/*.{h,m}"
100
-  end
101
-
102
-  s.subspec "StoreKit" do |ss|
103
-    ss.dependency            "RNPermissions/Core"
104
-    ss.source_files        = "ios/PermissionHandlers/StoreKit/*.{h,m}"
105
-  end
17
+  s.source          = { :git => s.homepage, :tag => s.version }
18
+  s.source_files    = "ios/*.{h,m}"
106 19
 end

+ 5
- 8
android/build.gradle View File

@@ -5,21 +5,18 @@ def safeExtGet(prop, fallback) {
5 5
 }
6 6
 
7 7
 android {
8
-  compileSdkVersion safeExtGet('compileSdkVersion', 26)
9
-  buildToolsVersion safeExtGet('buildToolsVersion', '26.0.3')
10
-
8
+  compileSdkVersion safeExtGet('compileSdkVersion', 28)
9
+  buildToolsVersion safeExtGet('buildToolsVersion', '28.0.3')
11 10
   defaultConfig {
12 11
     minSdkVersion safeExtGet('minSdkVersion', 16)
13
-    targetSdkVersion safeExtGet('targetSdkVersion', 26)
14
-    versionCode 1
15
-    versionName "1.0"
12
+    targetSdkVersion safeExtGet('targetSdkVersion', 28)
16 13
   }
17
-
18 14
   lintOptions {
19 15
     abortOnError false
20 16
   }
21 17
 }
22 18
 
23 19
 dependencies {
24
-  implementation "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}" // From node_modules
20
+  // noinspection GradleDynamicVersion
21
+  api 'com.facebook.react:react-native:+'
25 22
 }

+ 3
- 3
android/src/main/AndroidManifest.xml View File

@@ -1,4 +1,4 @@
1
-<?xml version="1.0" encoding="utf-8"?>
2
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
-    package="com.yonahforst.rnpermissions">
1
+<manifest
2
+  xmlns:android="http://schemas.android.com/apk/res/android"
3
+  package="com.reactnativecommunity.rnpermissions">
4 4
 </manifest>

+ 114
- 0
android/src/main/java/com/reactnativecommunity/rnpermissions/RNPermissionsModule.java View File

@@ -0,0 +1,114 @@
1
+package com.reactnativecommunity.rnpermissions;
2
+
3
+import android.Manifest;
4
+import android.content.Context;
5
+import android.content.Intent;
6
+import android.content.SharedPreferences;
7
+import android.net.Uri;
8
+import android.provider.Settings;
9
+
10
+import androidx.core.app.NotificationManagerCompat;
11
+
12
+import com.facebook.react.bridge.Arguments;
13
+import com.facebook.react.bridge.Promise;
14
+import com.facebook.react.bridge.ReactApplicationContext;
15
+import com.facebook.react.bridge.ReactContextBaseJavaModule;
16
+import com.facebook.react.bridge.ReactMethod;
17
+import com.facebook.react.bridge.ReadableArray;
18
+import com.facebook.react.bridge.WritableArray;
19
+import com.facebook.react.bridge.WritableMap;
20
+import com.facebook.react.module.annotations.ReactModule;
21
+
22
+import java.util.Map;
23
+
24
+@ReactModule(name = RNPermissionsModule.MODULE_NAME)
25
+public class RNPermissionsModule extends ReactContextBaseJavaModule {
26
+
27
+  private static final String ERROR_INVALID_ACTIVITY = "E_INVALID_ACTIVITY";
28
+  public static final String MODULE_NAME = "RNPermissions";
29
+  private static final String SETTING_NAME = "@RNPermissions:NonRequestables";
30
+
31
+  private final SharedPreferences sharedPrefs;
32
+
33
+  public RNPermissionsModule(ReactApplicationContext reactContext) {
34
+    super(reactContext);
35
+    sharedPrefs = reactContext.getSharedPreferences(SETTING_NAME, Context.MODE_PRIVATE);
36
+  }
37
+
38
+  @Override
39
+  public String getName() {
40
+    return MODULE_NAME;
41
+  }
42
+
43
+  @ReactMethod
44
+  public void isAvailable(final String permission, final Promise promise) {
45
+    String fieldName = permission.substring(permission.lastIndexOf('.') + 1);
46
+
47
+    try {
48
+      Manifest.permission.class.getField(fieldName);
49
+      promise.resolve(true);
50
+    } catch (NoSuchFieldException e) {
51
+      promise.resolve(false);
52
+    }
53
+  }
54
+
55
+  @ReactMethod
56
+  public void setNonRequestable(final String permission, final Promise promise) {
57
+    promise.resolve(sharedPrefs.edit().putBoolean(permission, true).commit());
58
+  }
59
+
60
+  @ReactMethod
61
+  public void getNonRequestables(final Promise promise) {
62
+    WritableArray result = Arguments.createArray();
63
+    Map<String, ?> entries = sharedPrefs.getAll();
64
+
65
+    for (Map.Entry<String, ?> entry : entries.entrySet()) {
66
+      result.pushString(entry.getKey());
67
+    }
68
+
69
+    promise.resolve(result);
70
+  }
71
+
72
+  @ReactMethod
73
+  public void openSettings(final Promise promise) {
74
+    try {
75
+      final ReactApplicationContext reactContext = getReactApplicationContext();
76
+      final Intent intent = new Intent();
77
+
78
+      intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
79
+      intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
80
+      intent.setData(Uri.fromParts("package", reactContext.getPackageName(), null));
81
+
82
+      reactContext.startActivity(intent);
83
+      promise.resolve(true);
84
+    } catch (Exception e) {
85
+      promise.reject(ERROR_INVALID_ACTIVITY, e);
86
+    }
87
+  }
88
+
89
+  private WritableMap internalCheckNotifications() {
90
+    final ReactApplicationContext reactContext = getReactApplicationContext();
91
+    final boolean enabled = NotificationManagerCompat.from(reactContext).areNotificationsEnabled();
92
+    final WritableMap map = Arguments.createMap();
93
+    final WritableMap settings = Arguments.createMap();
94
+
95
+    if (enabled) {
96
+      map.putString("status", "granted");
97
+    } else {
98
+      map.putString("status", "denied");
99
+    }
100
+
101
+    map.putMap("settings", settings);
102
+    return map;
103
+  }
104
+
105
+  @ReactMethod
106
+  public void checkNotifications(final Promise promise) {
107
+    promise.resolve(internalCheckNotifications());
108
+  }
109
+
110
+  @ReactMethod
111
+  public void requestNotifications(ReadableArray options, final Promise promise) {
112
+    promise.resolve(internalCheckNotifications());
113
+  }
114
+}

android/src/main/java/com/yonahforst/rnpermissions/RNPermissionsPackage.java → android/src/main/java/com/reactnativecommunity/rnpermissions/RNPermissionsPackage.java View File

@@ -1,11 +1,10 @@
1
-package com.yonahforst.rnpermissions;
1
+package com.reactnativecommunity.rnpermissions;
2 2
 
3 3
 import com.facebook.react.ReactPackage;
4 4
 import com.facebook.react.bridge.NativeModule;
5 5
 import com.facebook.react.bridge.ReactApplicationContext;
6 6
 import com.facebook.react.uimanager.ViewManager;
7 7
 
8
-import java.util.Arrays;
9 8
 import java.util.Collections;
10 9
 import java.util.List;
11 10
 
@@ -13,7 +12,7 @@ public class RNPermissionsPackage implements ReactPackage {
13 12
 
14 13
   @Override
15 14
   public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
16
-    return Arrays.<NativeModule>asList(new RNPermissionsModule(reactContext));
15
+    return Collections.<NativeModule>singletonList(new RNPermissionsModule(reactContext));
17 16
   }
18 17
 
19 18
   @Override

+ 0
- 52
android/src/main/java/com/yonahforst/rnpermissions/RNPermissionsModule.java View File

@@ -1,52 +0,0 @@
1
-package com.yonahforst.rnpermissions;
2
-
3
-import android.Manifest;
4
-import android.content.Intent;
5
-import android.net.Uri;
6
-import android.provider.Settings;
7
-
8
-import com.facebook.react.bridge.Promise;
9
-import com.facebook.react.bridge.ReactApplicationContext;
10
-import com.facebook.react.bridge.ReactContextBaseJavaModule;
11
-import com.facebook.react.bridge.ReactMethod;
12
-
13
-public class RNPermissionsModule extends ReactContextBaseJavaModule {
14
-
15
-  private static final String ERROR_INVALID_ACTIVITY = "E_INVALID_ACTIVITY";
16
-
17
-  public RNPermissionsModule(ReactApplicationContext reactContext) {
18
-    super(reactContext);
19
-  }
20
-
21
-  @Override
22
-  public String getName() {
23
-    return "RNPermissions";
24
-  }
25
-
26
-  @ReactMethod
27
-  public void isPermissionAvailable(final String permission, final Promise promise) {
28
-    String fieldName = permission.substring(permission.lastIndexOf('.') + 1);
29
-
30
-    try {
31
-      Manifest.permission.class.getField(fieldName);
32
-      promise.resolve(true);
33
-    } catch (NoSuchFieldException e) {
34
-      promise.resolve(false);
35
-    }
36
-  }
37
-
38
-  @ReactMethod
39
-  public void openSettings(final Promise promise) {
40
-    try {
41
-      String packageName = getReactApplicationContext().getPackageName();
42
-      Intent intent = new Intent();
43
-      intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
44
-      intent.setData(Uri.fromParts("package", packageName , null));
45
-      getReactApplicationContext().startActivity(intent);
46
-
47
-      promise.resolve(true);
48
-    } catch (Exception e) {
49
-      promise.reject(ERROR_INVALID_ACTIVITY, e);
50
-    }
51
-  }
52
-}

+ 0
- 6
example/.buckconfig View File

@@ -1,6 +0,0 @@
1
-
2
-[android]
3
-  target = Google Inc.:Google APIs:23
4
-
5
-[maven_repositories]
6
-  central = https://repo1.maven.org/maven2

+ 0
- 59
example/.gitignore View File

@@ -1,59 +0,0 @@
1
-# OSX
2
-#
3
-.DS_Store
4
-
5
-# Xcode
6
-#
7
-build/
8
-*.pbxuser
9
-!default.pbxuser
10
-*.mode1v3
11
-!default.mode1v3
12
-*.mode2v3
13
-!default.mode2v3
14
-*.perspectivev3
15
-!default.perspectivev3
16
-xcuserdata
17
-*.xccheckout
18
-*.moved-aside
19
-DerivedData
20
-*.hmap
21
-*.ipa
22
-*.xcuserstate
23
-project.xcworkspace
24
-
25
-# Android/IntelliJ
26
-#
27
-build/
28
-.idea
29
-.gradle
30
-local.properties
31
-*.iml
32
-
33
-# node.js
34
-#
35
-node_modules/
36
-npm-debug.log
37
-yarn-error.log
38
-
39
-# BUCK
40
-buck-out/
41
-\.buckd/
42
-*.keystore
43
-
44
-# fastlane
45
-#
46
-# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
47
-# screenshots whenever they are needed.
48
-# For more information about the recommended setup visit:
49
-# https://docs.fastlane.tools/best-practices/source-control/
50
-
51
-*/fastlane/report.xml
52
-*/fastlane/Preview.html
53
-*/fastlane/screenshots
54
-
55
-# Bundle artifact
56
-*.jsbundle
57
-
58
-# CocoaPods
59
-ios/Pods/

+ 0
- 1
example/.watchmanconfig View File

@@ -1 +0,0 @@
1
-{}

+ 0
- 185
example/App.js View File

@@ -1,185 +0,0 @@
1
-// @flow
2
-
3
-import * as React from "react";
4
-import { Appbar, List, TouchableRipple, Snackbar } from "react-native-paper";
5
-import * as RNPermissions from "react-native-permissions";
6
-import type { PermissionStatus } from "react-native-permissions";
7
-import theme from "./theme";
8
-
9
-import {
10
-  AppState,
11
-  Platform,
12
-  StatusBar,
13
-  ScrollView,
14
-  StyleSheet,
15
-  Text,
16
-  View,
17
-} from "react-native";
18
-
19
-// $FlowFixMe
20
-let platformPermissions: string[] = Object.values(
21
-  Platform.OS === "ios"
22
-    ? RNPermissions.IOS_PERMISSIONS
23
-    : RNPermissions.ANDROID_PERMISSIONS,
24
-).filter(permission => permission !== "SIRI");
25
-
26
-const statusColors: { [PermissionStatus]: string } = {
27
-  granted: "#43a047",
28
-  denied: "#ff9800",
29
-  never_ask_again: "#e53935",
30
-  unavailable: "#cfd8dc",
31
-};
32
-
33
-const statusIcons: { [PermissionStatus]: string } = {
34
-  granted: "check-circle",
35
-  denied: "error",
36
-  never_ask_again: "cancel",
37
-  unavailable: "lens",
38
-};
39
-
40
-type AppStateType = "active" | "background" | "inactive";
41
-
42
-type Props = {};
43
-
44
-// RNPermissions.checkMultiple([
45
-//   RNPermissions.ANDROID_PERMISSIONS.ACCESS_FINE_LOCATION,
46
-//   RNPermissions.ANDROID_PERMISSIONS.PROCESS_OUTGOING_CALLS,
47
-// ]).then(result => {
48
-//   console.log(result);
49
-// });
50
-
51
-type State = {|
52
-  snackBarVisible: boolean,
53
-  watchAppState: boolean,
54
-  statuses: { [string]: PermissionStatus },
55
-|};
56
-
57
-export default class App extends React.Component<Props, State> {
58
-  constructor(props: Props) {
59
-    super(props);
60
-
61
-    this.state = {
62
-      snackBarVisible: false,
63
-      watchAppState: false,
64
-      statuses: {},
65
-    };
66
-
67
-    setTimeout(() => {
68
-      this.checkAllPermissions();
69
-    }, 2000);
70
-  }
71
-
72
-  componentDidMount() {
73
-    AppState.addEventListener("change", this.onAppStateChange);
74
-  }
75
-
76
-  componentWillUnmount() {
77
-    AppState.removeEventListener("change", this.onAppStateChange);
78
-  }
79
-
80
-  checkAllPermissions = () => {
81
-    RNPermissions.checkMultiple(platformPermissions)
82
-      .then(statuses => {
83
-        console.log(statuses);
84
-        this.setState({ statuses });
85
-      })
86
-      .catch(error => {
87
-        console.error(error);
88
-      });
89
-  };
90
-
91
-  onAppStateChange = (nextAppState: AppStateType) => {
92
-    if (this.state.watchAppState && nextAppState === "active") {
93
-      this.setState({
94
-        snackBarVisible: true,
95
-        watchAppState: false,
96
-      });
97
-
98
-      setTimeout(() => {
99
-        // @TODO don't fire setState on unmounted component
100
-        this.setState({ snackBarVisible: false });
101
-      }, 3000);
102
-    }
103
-  };
104
-
105
-  render() {
106
-    return (
107
-      <View style={styles.container}>
108
-        <StatusBar
109
-          backgroundColor={theme.colors.primary}
110
-          barStyle="light-content"
111
-        />
112
-
113
-        <Appbar.Header>
114
-          <Appbar.Content
115
-            title="react-native-permissions"
116
-            subtitle="Example application"
117
-          />
118
-
119
-          <Appbar.Action
120
-            icon="settings-applications"
121
-            onPress={() => {
122
-              this.setState({ watchAppState: true }, () => {
123
-                RNPermissions.openSettings();
124
-              });
125
-            }}
126
-          />
127
-        </Appbar.Header>
128
-
129
-        <ScrollView>
130
-          <List.Section>
131
-            {platformPermissions.map(permission => {
132
-              const status = this.state.statuses[permission];
133
-
134
-              return (
135
-                <TouchableRipple
136
-                  key={permission}
137
-                  disabled={
138
-                    status === RNPermissions.RESULTS.UNAVAILABLE ||
139
-                    status === RNPermissions.RESULTS.NEVER_ASK_AGAIN
140
-                  }
141
-                  onPress={() => {
142
-                    RNPermissions.request(permission).then(status => {
143
-                      this.setState(prevState => ({
144
-                        ...prevState,
145
-                        statuses: {
146
-                          ...prevState.statuses,
147
-                          [permission]: status,
148
-                        },
149
-                      }));
150
-                    });
151
-                  }}
152
-                >
153
-                  <List.Item
154
-                    title={permission}
155
-                    description={status}
156
-                    right={() => (
157
-                      <List.Icon
158
-                        color={statusColors[status]}
159
-                        icon={statusIcons[status]}
160
-                      />
161
-                    )}
162
-                  />
163
-                </TouchableRipple>
164
-              );
165
-            })}
166
-          </List.Section>
167
-        </ScrollView>
168
-
169
-        <Snackbar
170
-          onDismiss={() => this.setState({ snackBarVisible: false })}
171
-          visible={this.state.snackBarVisible}
172
-        >
173
-          Welcome back ! Refreshing permissions…
174
-        </Snackbar>
175
-      </View>
176
-    );
177
-  }
178
-}
179
-
180
-const styles = StyleSheet.create({
181
-  container: {
182
-    flex: 1,
183
-    backgroundColor: theme.colors.background,
184
-  },
185
-});

+ 165
- 0
example/App.tsx View File

@@ -0,0 +1,165 @@
1
+import React from 'react';
2
+import {Appbar, List, TouchableRipple} from 'react-native-paper';
3
+import theme from './theme';
4
+
5
+import {
6
+  FlatList,
7
+  Platform,
8
+  StatusBar,
9
+  Text,
10
+  View,
11
+  GestureResponderEvent,
12
+} from 'react-native';
13
+
14
+import RNPermissions, {
15
+  Permission,
16
+  PermissionStatus,
17
+  NotificationsResponse,
18
+} from 'react-native-permissions';
19
+
20
+const {PERMISSIONS} = RNPermissions;
21
+// eslint-disable-next-line @typescript-eslint/no-unused-vars
22
+const {SIRI, ...PERMISSIONS_IOS} = PERMISSIONS.IOS; // remove siri (certificate required)
23
+
24
+const PLATFORM_PERMISSIONS = Platform.select({
25
+  ios: PERMISSIONS_IOS,
26
+  android: PERMISSIONS.ANDROID,
27
+  default: {},
28
+});
29
+
30
+const PERMISSIONS_VALUES: Permission[] = Object.values(PLATFORM_PERMISSIONS);
31
+
32
+const colors: {[key: string]: string} = {
33
+  unavailable: '#cfd8dc',
34
+  denied: '#ff9800',
35
+  granted: '#43a047',
36
+  blocked: '#e53935',
37
+};
38
+
39
+const icons: {[key: string]: string} = {
40
+  unavailable: 'lens',
41
+  denied: 'error',
42
+  granted: 'check-circle',
43
+  blocked: 'cancel',
44
+};
45
+
46
+const PermissionRow = ({
47
+  name,
48
+  status,
49
+  onPress,
50
+}: {
51
+  name: string;
52
+  status: string;
53
+  onPress: (event: GestureResponderEvent) => void;
54
+}) => (
55
+  <TouchableRipple onPress={onPress}>
56
+    <List.Item
57
+      right={() => <List.Icon color={colors[status]} icon={icons[status]} />}
58
+      title={name}
59
+      description={status}
60
+    />
61
+  </TouchableRipple>
62
+);
63
+
64
+interface State {
65
+  statuses: PermissionStatus[];
66
+  notifications: NotificationsResponse;
67
+}
68
+
69
+export default class App extends React.Component<{}, State> {
70
+  state: State = {
71
+    statuses: [],
72
+    notifications: {status: 'unavailable', settings: {}},
73
+  };
74
+
75
+  check = () =>
76
+    Promise.all(PERMISSIONS_VALUES.map(_ => RNPermissions.check(_)))
77
+      .then(statuses => this.setState({statuses}))
78
+      .then(() => RNPermissions.checkNotifications())
79
+      .then(notifications => this.setState({notifications}))
80
+      .catch(error => console.warn(error));
81
+
82
+  refresh = () => {
83
+    this.setState({statuses: []}, this.check);
84
+  };
85
+
86
+  componentDidMount() {
87
+    this.check();
88
+  }
89
+
90
+  render() {
91
+    return (
92
+      <View style={{flex: 1, backgroundColor: theme.colors.background}}>
93
+        <StatusBar
94
+          backgroundColor={theme.colors.primary}
95
+          barStyle="light-content"
96
+        />
97
+
98
+        <Appbar.Header>
99
+          <Appbar.Content
100
+            title="react-native-permissions"
101
+            subtitle="Example application"
102
+          />
103
+
104
+          <Appbar.Action onPress={this.refresh} icon="refresh" />
105
+
106
+          <Appbar.Action
107
+            onPress={RNPermissions.openSettings}
108
+            icon="settings-applications"
109
+          />
110
+        </Appbar.Header>
111
+
112
+        <FlatList
113
+          keyExtractor={item => item}
114
+          data={Object.keys(PLATFORM_PERMISSIONS)}
115
+          renderItem={({item, index}) => {
116
+            const value = PERMISSIONS_VALUES[index];
117
+            const status = this.state.statuses[index];
118
+
119
+            return (
120
+              <PermissionRow
121
+                status={status}
122
+                name={item}
123
+                onPress={() => {
124
+                  RNPermissions.request(value)
125
+                    .then(result => {
126
+                      const statuses = [...this.state.statuses];
127
+                      statuses[index] = result;
128
+                      this.setState({statuses});
129
+                    })
130
+                    .then(() => this.check());
131
+                }}
132
+              />
133
+            );
134
+          }}
135
+        />
136
+
137
+        <View
138
+          style={{backgroundColor: '#e0e0e0', height: 1}}
139
+          accessibilityRole="none"
140
+        />
141
+
142
+        <TouchableRipple
143
+          onPress={() => {
144
+            RNPermissions.requestNotifications(['alert', 'badge', 'sound']);
145
+          }}>
146
+          <List.Item
147
+            right={() => (
148
+              <List.Icon
149
+                color={colors[this.state.notifications.status]}
150
+                icon={icons[this.state.notifications.status]}
151
+              />
152
+            )}
153
+            title="NOTIFICATIONS"
154
+            description={this.state.notifications.status}
155
+          />
156
+        </TouchableRipple>
157
+
158
+        <Text style={{margin: 15, marginTop: 0, color: '#777'}}>
159
+          {'settings = ' +
160
+            JSON.stringify(this.state.notifications.settings, null, 2)}
161
+        </Text>
162
+      </View>
163
+    );
164
+  }
165
+}

+ 69
- 8
example/android/app/build.gradle View File

@@ -18,6 +18,9 @@ import com.android.build.OutputFile
18 18
  *   // the entry file for bundle generation
19 19
  *   entryFile: "index.android.js",
20 20
  *
21
+ *   // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format
22
+ *   bundleCommand: "ram-bundle",
23
+ *
21 24
  *   // whether to bundle JS and assets in debug mode
22 25
  *   bundleInDebug: false,
23 26
  *
@@ -73,7 +76,8 @@ import com.android.build.OutputFile
73 76
  */
74 77
 
75 78
 project.ext.react = [
76
-    entryFile: "index.js"
79
+    entryFile: "index.js",
80
+    enableHermes: false,  // clean and rebuild if changing
77 81
 ]
78 82
 
79 83
 apply from: "../../node_modules/react-native/react.gradle"
@@ -93,9 +97,35 @@ def enableSeparateBuildPerCPUArchitecture = false
93 97
  */
94 98
 def enableProguardInReleaseBuilds = false
95 99
 
100
+/**
101
+ * The preferred build flavor of JavaScriptCore.
102
+ *
103
+ * For example, to use the international variant, you can use:
104
+ * `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
105
+ *
106
+ * The international variant includes ICU i18n library and necessary data
107
+ * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
108
+ * give correct results when using with locales other than en-US.  Note that
109
+ * this variant is about 6MiB larger per architecture than default.
110
+ */
111
+def jscFlavor = 'org.webkit:android-jsc:+'
112
+
113
+/**
114
+ * Whether to enable the Hermes VM.
115
+ *
116
+ * This should be set on project.ext.react and mirrored here.  If it is not set
117
+ * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
118
+ * and the benefits of using Hermes will therefore be sharply reduced.
119
+ */
120
+def enableHermes = project.ext.react.get("enableHermes", false);
121
+
96 122
 android {
97 123
     compileSdkVersion rootProject.ext.compileSdkVersion
98
-    buildToolsVersion rootProject.ext.buildToolsVersion
124
+
125
+    compileOptions {
126
+        sourceCompatibility JavaVersion.VERSION_1_8
127
+        targetCompatibility JavaVersion.VERSION_1_8
128
+    }
99 129
 
100 130
     defaultConfig {
101 131
         applicationId "com.rnpermissionsexample"
@@ -109,11 +139,25 @@ android {
109 139
             reset()
110 140
             enable enableSeparateBuildPerCPUArchitecture
111 141
             universalApk false  // If true, also generate a universal APK
112
-            include "armeabi-v7a", "x86", "arm64-v8a"
142
+            include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
143
+        }
144
+    }
145
+    signingConfigs {
146
+        debug {
147
+            storeFile file('debug.keystore')
148
+            storePassword 'android'
149
+            keyAlias 'androiddebugkey'
150
+            keyPassword 'android'
113 151
         }
114 152
     }
115 153
     buildTypes {
154
+        debug {
155
+            signingConfig signingConfigs.debug
156
+        }
116 157
         release {
158
+            // Caution! In production, you need to generate your own keystore file.
159
+            // see https://facebook.github.io/react-native/docs/signed-apk-android.
160
+            signingConfig signingConfigs.debug
117 161
             minifyEnabled enableProguardInReleaseBuilds
118 162
             proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
119 163
         }
@@ -122,23 +166,38 @@ android {
122 166
     applicationVariants.all { variant ->
123 167
         variant.outputs.each { output ->
124 168
             // For each separate APK per architecture, set a unique version code as described here:
125
-            // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
126
-            def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3]
169
+            // https://developer.android.com/studio/build/configure-apk-splits.html
170
+            def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
127 171
             def abi = output.getFilter(OutputFile.ABI)
128 172
             if (abi != null) {  // null for the universal-debug, universal-release variants
129 173
                 output.versionCodeOverride =
130 174
                         versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
131 175
             }
176
+
132 177
         }
133 178
     }
179
+
180
+    packagingOptions {
181
+        pickFirst '**/armeabi-v7a/libc++_shared.so'
182
+        pickFirst '**/x86/libc++_shared.so'
183
+        pickFirst '**/arm64-v8a/libc++_shared.so'
184
+        pickFirst '**/x86_64/libc++_shared.so'
185
+        pickFirst '**/x86/libjsc.so'
186
+        pickFirst '**/armeabi-v7a/libjsc.so'
187
+    }
134 188
 }
135 189
 
136 190
 dependencies {
137
-    implementation project(':react-native-permissions')
138
-    implementation project(':react-native-vector-icons')
139 191
     implementation fileTree(dir: "libs", include: ["*.jar"])
140
-    implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
141 192
     implementation "com.facebook.react:react-native:+"  // From node_modules
193
+
194
+    if (enableHermes) {
195
+      def hermesPath = "../../node_modules/hermesvm/android/";
196
+      debugImplementation files(hermesPath + "hermes-debug.aar")
197
+      releaseImplementation files(hermesPath + "hermes-release.aar")
198
+    } else {
199
+      implementation jscFlavor
200
+    }
142 201
 }
143 202
 
144 203
 // Run this once to be able to run the application with BUCK
@@ -147,3 +206,5 @@ task copyDownloadableDepsToLibs(type: Copy) {
147 206
     from configurations.compile
148 207
     into 'libs'
149 208
 }
209
+
210
+apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

+ 0
- 7
example/android/app/proguard-rules.pro View File

@@ -8,10 +8,3 @@
8 8
 #   http://developer.android.com/guide/developing/tools/proguard.html
9 9
 
10 10
 # Add any project specific keep options here:
11
-
12
-# If your project uses WebView with JS, uncomment the following
13
-# and specify the fully qualified class name to the JavaScript interface
14
-# class:
15
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16
-#   public *;
17
-#}

+ 8
- 0
example/android/app/src/debug/AndroidManifest.xml View File

@@ -0,0 +1,8 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
+    xmlns:tools="http://schemas.android.com/tools">
4
+
5
+    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
6
+
7
+    <application android:usesCleartextTraffic="true" tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning" />
8
+</manifest>

+ 24
- 21
example/android/app/src/main/AndroidManifest.xml View File

@@ -1,34 +1,37 @@
1 1
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
-    package="com.rnpermissionsexample">
2
+  package="com.rnpermissionsexample">
3 3
 
4 4
     <uses-permission android:name="android.permission.INTERNET" />
5
-    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
6 5
 
7
-    <uses-permission android:name="android.permission.READ_CALENDAR" />
8
-    <uses-permission android:name="android.permission.WRITE_CALENDAR" />
9
-    <uses-permission android:name="android.permission.CAMERA" />
10
-    <uses-permission android:name="android.permission.READ_CONTACTS" />
11
-    <uses-permission android:name="android.permission.WRITE_CONTACTS" />
12
-    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
13
-    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
6
+    <uses-permission android:name="android.permission.ACCEPT_HANDOVER" />
7
+    <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
14 8
     <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
15
-    <uses-permission android:name="android.permission.RECORD_AUDIO" />
16
-    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
17
-    <uses-permission android:name="android.permission.CALL_PHONE" />
18
-    <uses-permission android:name="android.permission.READ_CALL_LOG" />
19
-    <uses-permission android:name="android.permission.WRITE_CALL_LOG" />
9
+    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
10
+    <uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" />
20 11
     <uses-permission android:name="com.android.voicemail.permission.ADD_VOICEMAIL" />
21
-    <uses-permission android:name="android.permission.USE_SIP" />
22
-    <uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" />
12
+    <uses-permission android:name="android.permission.ANSWER_PHONE_CALLS" />
23 13
     <uses-permission android:name="android.permission.BODY_SENSORS" />
24
-    <uses-permission android:name="android.permission.SEND_SMS" />
25
-    <uses-permission android:name="android.permission.RECEIVE_SMS" />
14
+    <uses-permission android:name="android.permission.CALL_PHONE" />
15
+    <uses-permission android:name="android.permission.CAMERA" />
16
+    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
17
+    <uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" />
18
+    <uses-permission android:name="android.permission.READ_CALENDAR" />
19
+    <uses-permission android:name="android.permission.READ_CALL_LOG" />
20
+    <uses-permission android:name="android.permission.READ_CONTACTS" />
21
+    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
22
+    <uses-permission android:name="android.permission.READ_PHONE_NUMBERS" />
23
+    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
26 24
     <uses-permission android:name="android.permission.READ_SMS" />
27
-    <uses-permission android:name="android.permission.RECEIVE_WAP_PUSH" />
28 25
     <uses-permission android:name="android.permission.RECEIVE_MMS" />
29
-    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
26
+    <uses-permission android:name="android.permission.RECEIVE_SMS" />
27
+    <uses-permission android:name="android.permission.RECEIVE_WAP_PUSH" />
28
+    <uses-permission android:name="android.permission.RECORD_AUDIO" />
29
+    <uses-permission android:name="android.permission.SEND_SMS" />
30
+    <uses-permission android:name="android.permission.USE_SIP" />
31
+    <uses-permission android:name="android.permission.WRITE_CALENDAR" />
32
+    <uses-permission android:name="android.permission.WRITE_CALL_LOG" />
33
+    <uses-permission android:name="android.permission.WRITE_CONTACTS" />
30 34
     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
31
-    <uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" />
32 35
 
33 36
     <application
34 37
       android:name=".MainApplication"

+ 9
- 10
example/android/app/src/main/java/com/rnpermissionsexample/MainApplication.java View File

@@ -1,17 +1,16 @@
1 1
 package com.rnpermissionsexample;
2 2
 
3 3
 import android.app.Application;
4
+import android.util.Log;
4 5
 
6
+import com.facebook.react.PackageList;
7
+import com.facebook.hermes.reactexecutor.HermesExecutorFactory;
8
+import com.facebook.react.bridge.JavaScriptExecutorFactory;
5 9
 import com.facebook.react.ReactApplication;
6 10
 import com.facebook.react.ReactNativeHost;
7 11
 import com.facebook.react.ReactPackage;
8
-import com.facebook.react.shell.MainReactPackage;
9 12
 import com.facebook.soloader.SoLoader;
10 13
 
11
-import com.yonahforst.rnpermissions.RNPermissionsPackage;
12
-import com.oblador.vectoricons.VectorIconsPackage;
13
-
14
-import java.util.Arrays;
15 14
 import java.util.List;
16 15
 
17 16
 public class MainApplication extends Application implements ReactApplication {
@@ -24,11 +23,11 @@ public class MainApplication extends Application implements ReactApplication {
24 23
 
25 24
     @Override
26 25
     protected List<ReactPackage> getPackages() {
27
-      return Arrays.<ReactPackage>asList(
28
-          new MainReactPackage(),
29
-          new RNPermissionsPackage(),
30
-          new VectorIconsPackage()
31
-      );
26
+      @SuppressWarnings("UnnecessaryLocalVariable")
27
+      List<ReactPackage> packages = new PackageList(this).getPackages();
28
+      // Packages that cannot be autolinked yet can be added manually here, for example:
29
+      // packages.add(new MyReactNativePackage());
30
+      return packages;
32 31
     }
33 32
 
34 33
     @Override

+ 1
- 0
example/android/app/src/main/res/values/styles.xml View File

@@ -3,6 +3,7 @@
3 3
     <!-- Base application theme. -->
4 4
     <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
5 5
         <!-- Customize your theme here. -->
6
+        <item name="android:textColor">#000000</item>
6 7
     </style>
7 8
 
8 9
 </resources>

+ 11
- 12
example/android/build.gradle View File

@@ -2,10 +2,10 @@
2 2
 
3 3
 buildscript {
4 4
     ext {
5
-        buildToolsVersion = "28.0.2"
5
+        buildToolsVersion = "28.0.3"
6 6
         minSdkVersion = 16
7 7
         compileSdkVersion = 28
8
-        targetSdkVersion = 27
8
+        targetSdkVersion = 28
9 9
         supportLibVersion = "28.0.0"
10 10
     }
11 11
     repositories {
@@ -13,7 +13,7 @@ buildscript {
13 13
         jcenter()
14 14
     }
15 15
     dependencies {
16
-        classpath 'com.android.tools.build:gradle:3.3.0'
16
+        classpath("com.android.tools.build:gradle:3.4.1")
17 17
 
18 18
         // NOTE: Do not place your application dependencies here; they belong
19 19
         // in the individual module build.gradle files
@@ -23,17 +23,16 @@ buildscript {
23 23
 allprojects {
24 24
     repositories {
25 25
         mavenLocal()
26
-        google()
27
-        jcenter()
28 26
         maven {
29 27
             // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
30
-            url "$rootDir/../node_modules/react-native/android"
28
+            url("$rootDir/../node_modules/react-native/android")
29
+        }
30
+        maven {
31
+            // Android JSC is installed from npm
32
+            url("$rootDir/../node_modules/jsc-android/dist")
31 33
         }
32
-    }
33
-}
34
-
35 34
 
36
-task wrapper(type: Wrapper) {
37
-    gradleVersion = '4.7'
38
-    distributionUrl = distributionUrl.replace("bin", "all")
35
+        google()
36
+        jcenter()
37
+    }
39 38
 }

+ 3
- 0
example/android/gradle.properties View File

@@ -16,3 +16,6 @@
16 16
 # This option should only be used with decoupled projects. More details, visit
17 17
 # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 18
 # org.gradle.parallel=true
19
+
20
+android.useAndroidX=true
21
+android.enableJetifier=true

BIN
example/android/gradle/wrapper/gradle-wrapper.jar View File


+ 1
- 2
example/android/gradle/wrapper/gradle-wrapper.properties View File

@@ -1,6 +1,5 @@
1
-#Wed Jan 30 14:02:26 CET 2019
2 1
 distributionBase=GRADLE_USER_HOME
3 2
 distributionPath=wrapper/dists
3
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
4 4
 zipStoreBase=GRADLE_USER_HOME
5 5
 zipStorePath=wrapper/dists
6
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip

+ 17
- 1
example/android/gradlew View File

@@ -1,5 +1,21 @@
1 1
 #!/usr/bin/env sh
2 2
 
3
+#
4
+# Copyright 2015 the original author or authors.
5
+#
6
+# Licensed under the Apache License, Version 2.0 (the "License");
7
+# you may not use this file except in compliance with the License.
8
+# You may obtain a copy of the License at
9
+#
10
+#      http://www.apache.org/licenses/LICENSE-2.0
11
+#
12
+# Unless required by applicable law or agreed to in writing, software
13
+# distributed under the License is distributed on an "AS IS" BASIS,
14
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+# See the License for the specific language governing permissions and
16
+# limitations under the License.
17
+#
18
+
3 19
 ##############################################################################
4 20
 ##
5 21
 ##  Gradle start up script for UN*X
@@ -28,7 +44,7 @@ APP_NAME="Gradle"
28 44
 APP_BASE_NAME=`basename "$0"`
29 45
 
30 46
 # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31
-DEFAULT_JVM_OPTS=""
47
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
32 48
 
33 49
 # Use the maximum available, or set MAX_FD != -1 to use that value.
34 50
 MAX_FD="maximum"

+ 17
- 1
example/android/gradlew.bat View File

@@ -1,3 +1,19 @@
1
+@rem
2
+@rem Copyright 2015 the original author or authors.
3
+@rem
4
+@rem Licensed under the Apache License, Version 2.0 (the "License");
5
+@rem you may not use this file except in compliance with the License.
6
+@rem You may obtain a copy of the License at
7
+@rem
8
+@rem      http://www.apache.org/licenses/LICENSE-2.0
9
+@rem
10
+@rem Unless required by applicable law or agreed to in writing, software
11
+@rem distributed under the License is distributed on an "AS IS" BASIS,
12
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+@rem See the License for the specific language governing permissions and
14
+@rem limitations under the License.
15
+@rem
16
+
1 17
 @if "%DEBUG%" == "" @echo off
2 18
 @rem ##########################################################################
3 19
 @rem
@@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0
14 30
 set APP_HOME=%DIRNAME%
15 31
 
16 32
 @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17
-set DEFAULT_JVM_OPTS=
33
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
18 34
 
19 35
 @rem Find java.exe
20 36
 if defined JAVA_HOME goto findJavaFromJavaHome

+ 0
- 8
example/android/keystores/BUCK View File

@@ -1,8 +0,0 @@
1
-keystore(
2
-    name = "debug",
3
-    properties = "debug.keystore.properties",
4
-    store = "debug.keystore",
5
-    visibility = [
6
-        "PUBLIC",
7
-    ],
8
-)

+ 0
- 4
example/android/keystores/debug.keystore.properties View File

@@ -1,4 +0,0 @@
1
-key.store=debug.keystore
2
-key.alias=androiddebugkey
3
-key.store.password=android
4
-key.alias.password=android

+ 1
- 7
example/android/settings.gradle View File

@@ -1,9 +1,3 @@
1 1
 rootProject.name = 'RNPermissionsExample'
2
-
3
-include ':react-native-permissions'
4
-project(':react-native-permissions').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-permissions/android')
5
-
6
-include ':react-native-vector-icons'
7
-project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android')
8
-
2
+apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
9 3
 include ':app'

+ 1
- 1
example/babel.config.js View File

@@ -1,3 +1,3 @@
1 1
 module.exports = {
2
-  presets: ["module:metro-react-native-babel-preset"],
2
+  presets: ['module:metro-react-native-babel-preset'],
3 3
 };

+ 11
- 15
example/index.js View File

@@ -1,18 +1,14 @@
1
-// @flow
1
+import React from 'react';
2
+import {Provider as PaperProvider} from 'react-native-paper';
3
+import {AppRegistry} from 'react-native';
4
+import App from './App';
5
+import {name as appName} from './app.json';
6
+import theme from './theme';
2 7
 
3
-import * as React from "react";
4
-import { Provider as PaperProvider } from "react-native-paper";
5
-import { AppRegistry } from "react-native";
6
-import { name as appName } from "./app.json";
7
-import App from "./App";
8
-import theme from "./theme";
9
-
10
-function Main() {
11
-  return (
12
-    <PaperProvider theme={theme}>
13
-      <App />
14
-    </PaperProvider>
15
-  );
16
-}
8
+let Main = () => (
9
+  <PaperProvider theme={theme}>
10
+    <App />
11
+  </PaperProvider>
12
+);
17 13
 
18 14
 AppRegistry.registerComponent(appName, () => Main);

+ 36
- 44
example/ios/Podfile View File

@@ -1,57 +1,49 @@
1 1
 platform :ios, '9.0'
2
+require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
2 3
 
3 4
 target 'RNPermissionsExample' do
4
-  pod 'React', :path => '../node_modules/react-native', :subspecs => [
5
-    'Core',
6
-    'CxxBridge', # Include this for RN >= 0.47
7
-    'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43
8
-    'RCTActionSheet',
9
-    'RCTAnimation', # Needed for FlatList and animations running on native UI thread
10
-    'RCTBlob',
11
-    # 'RCTCameraRoll',
12
-    'RCTGeolocation',
13
-    'RCTImage',
14
-    'RCTNetwork',
15
-    'RCTPushNotification',
16
-    'RCTSettings',
17
-    'RCTText',
18
-    'RCTVibration',
19
-    'RCTWebSocket', # Needed for debugging
20
-    'RCTLinkingIOS',
21
-  ]
5
+  pod 'React', :path => '../node_modules/react-native/'
6
+  pod 'React-Core', :path => '../node_modules/react-native/React'
7
+  pod 'React-DevSupport', :path => '../node_modules/react-native/React'
8
+  pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
9
+  pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
10
+  pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
11
+  pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
12
+  pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
13
+  pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
14
+  pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
15
+  pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
16
+  pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
17
+  pod 'React-RCTWebSocket', :path => '../node_modules/react-native/Libraries/WebSocket'
22 18
 
23
-  # Explicitly include Yoga if you are using RN >= 0.42.0
19
+  pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
20
+  pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
21
+  pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
22
+  pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
24 23
   pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
25 24
 
26
-  # Third party deps podspec link
27 25
   pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
28 26
   pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
29 27
   pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
30 28
 
31
-  # RN dependencies
32
-  pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
29
+  permissions_path = '../node_modules/react-native-permissions/ios'
33 30
 
34
-  pod 'RNPermissions', :path => '../node_modules/react-native-permissions', :subspecs => [
35
-    'Core',
36
-    # Comment unwanted permissions
37
-    'BluetoothPeripheral',
38
-    'Calendars',
39
-    'Camera',
40
-    'Contacts',
41
-    'FaceID',
42
-    'LocationAlways',
43
-    'LocationWhenInUse',
44
-    'MediaLibrary',
45
-    'Microphone',
46
-    'Motion',
47
-    'Notifications',
48
-    'PhotoLibrary',
49
-    'Reminders',
50
-    # 'Siri',
51
-    'SpeechRecognition',
52
-    'StoreKit',
53
-  ]
54
-end
31
+  pod 'Permission-BluetoothPeripheral', :path => "#{permissions_path}/BluetoothPeripheral.podspec"
32
+  pod 'Permission-Calendars', :path => "#{permissions_path}/Calendars.podspec"
33
+  pod 'Permission-Camera', :path => "#{permissions_path}/Camera.podspec"
34
+  pod 'Permission-Contacts', :path => "#{permissions_path}/Contacts.podspec"
35
+  pod 'Permission-FaceID', :path => "#{permissions_path}/FaceID.podspec"
36
+  pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways.podspec"
37
+  pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse.podspec"
38
+  pod 'Permission-MediaLibrary', :path => "#{permissions_path}/MediaLibrary.podspec"
39
+  pod 'Permission-Microphone', :path => "#{permissions_path}/Microphone.podspec"
40
+  pod 'Permission-Motion', :path => "#{permissions_path}/Motion.podspec"
41
+  pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications.podspec"
42
+  pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary.podspec"
43
+  pod 'Permission-Reminders', :path => "#{permissions_path}/Reminders.podspec"
44
+  # pod 'Permission-Siri', :path => "#{permissions_path}/Siri.podspec"
45
+  pod 'Permission-SpeechRecognition', :path => "#{permissions_path}/SpeechRecognition.podspec"
46
+  pod 'Permission-StoreKit', :path => "#{permissions_path}/StoreKit.podspec"
55 47
 
56
-target 'RNPermissionsExample-tvOS' do
48
+  use_native_modules!
57 49
 end

+ 238
- 136
example/ios/Podfile.lock View File

@@ -2,147 +2,156 @@ PODS:
2 2
   - boost-for-react-native (1.63.0)
3 3
   - DoubleConversion (1.1.6)
4 4
   - Folly (2018.10.22.00):
5
+    - boost-for-react-native
6
+    - DoubleConversion
7
+    - Folly/Default (= 2018.10.22.00)
8
+    - glog
9
+  - Folly/Default (2018.10.22.00):
5 10
     - boost-for-react-native
6 11
     - DoubleConversion
7 12
     - glog
8 13
   - glog (0.3.5)
9
-  - React (0.58.3):
10
-    - React/Core (= 0.58.3)
11
-  - React/Core (0.58.3):
12
-    - yoga (= 0.58.3.React)
13
-  - React/CxxBridge (0.58.3):
14
+  - Permission-BluetoothPeripheral (2.0.0-rc.0):
15
+    - RNPermissions
16
+  - Permission-Calendars (2.0.0-rc.0):
17
+    - RNPermissions
18
+  - Permission-Camera (2.0.0-rc.0):
19
+    - RNPermissions
20
+  - Permission-Contacts (2.0.0-rc.0):
21
+    - RNPermissions
22
+  - Permission-FaceID (2.0.0-rc.0):
23
+    - RNPermissions
24
+  - Permission-LocationAlways (2.0.0-rc.0):
25
+    - RNPermissions
26
+  - Permission-LocationWhenInUse (2.0.0-rc.0):
27
+    - RNPermissions
28
+  - Permission-MediaLibrary (2.0.0-rc.0):
29
+    - RNPermissions
30
+  - Permission-Microphone (2.0.0-rc.0):
31
+    - RNPermissions
32
+  - Permission-Motion (2.0.0-rc.0):
33
+    - RNPermissions
34
+  - Permission-Notifications (2.0.0-rc.0):
35
+    - RNPermissions
36
+  - Permission-PhotoLibrary (2.0.0-rc.0):
37
+    - RNPermissions
38
+  - Permission-Reminders (2.0.0-rc.0):
39
+    - RNPermissions
40
+  - Permission-SpeechRecognition (2.0.0-rc.0):
41
+    - RNPermissions
42
+  - Permission-StoreKit (2.0.0-rc.0):
43
+    - RNPermissions
44
+  - React (0.60.5):
45
+    - React-Core (= 0.60.5)
46
+    - React-DevSupport (= 0.60.5)
47
+    - React-RCTActionSheet (= 0.60.5)
48
+    - React-RCTAnimation (= 0.60.5)
49
+    - React-RCTBlob (= 0.60.5)
50
+    - React-RCTImage (= 0.60.5)
51
+    - React-RCTLinking (= 0.60.5)
52
+    - React-RCTNetwork (= 0.60.5)
53
+    - React-RCTSettings (= 0.60.5)
54
+    - React-RCTText (= 0.60.5)
55
+    - React-RCTVibration (= 0.60.5)
56
+    - React-RCTWebSocket (= 0.60.5)
57
+  - React-Core (0.60.5):
14 58
     - Folly (= 2018.10.22.00)
15
-    - React/Core
16
-    - React/cxxreact
17
-    - React/jsiexecutor
18
-  - React/cxxreact (0.58.3):
59
+    - React-cxxreact (= 0.60.5)
60
+    - React-jsiexecutor (= 0.60.5)
61
+    - yoga (= 0.60.5.React)
62
+  - React-cxxreact (0.60.5):
19 63
     - boost-for-react-native (= 1.63.0)
64
+    - DoubleConversion
20 65
     - Folly (= 2018.10.22.00)
21
-    - React/jsinspector
22
-  - React/DevSupport (0.58.3):
23
-    - React/Core
24
-    - React/RCTWebSocket
25
-  - React/fishhook (0.58.3)
26
-  - React/jsi (0.58.3):
66
+    - glog
67
+    - React-jsinspector (= 0.60.5)
68
+  - React-DevSupport (0.60.5):
69
+    - React-Core (= 0.60.5)
70
+    - React-RCTWebSocket (= 0.60.5)
71
+  - React-jsi (0.60.5):
72
+    - boost-for-react-native (= 1.63.0)
73
+    - DoubleConversion
27 74
     - Folly (= 2018.10.22.00)
28
-  - React/jsiexecutor (0.58.3):
75
+    - glog
76
+    - React-jsi/Default (= 0.60.5)
77
+  - React-jsi/Default (0.60.5):
78
+    - boost-for-react-native (= 1.63.0)
79
+    - DoubleConversion
29 80
     - Folly (= 2018.10.22.00)
30
-    - React/cxxreact
31
-    - React/jsi
32
-  - React/jsinspector (0.58.3)
33
-  - React/RCTActionSheet (0.58.3):
34
-    - React/Core
35
-  - React/RCTAnimation (0.58.3):
36
-    - React/Core
37
-  - React/RCTBlob (0.58.3):
38
-    - React/Core
39
-  - React/RCTGeolocation (0.58.3):
40
-    - React/Core
41
-  - React/RCTImage (0.58.3):
42
-    - React/Core
43
-    - React/RCTNetwork
44
-  - React/RCTLinkingIOS (0.58.3):
45
-    - React/Core
46
-  - React/RCTNetwork (0.58.3):
47
-    - React/Core
48
-  - React/RCTPushNotification (0.58.3):
49
-    - React/Core
50
-  - React/RCTSettings (0.58.3):
51
-    - React/Core
52
-  - React/RCTText (0.58.3):
53
-    - React/Core
54
-  - React/RCTVibration (0.58.3):
55
-    - React/Core
56
-  - React/RCTWebSocket (0.58.3):
57
-    - React/Core
58
-    - React/fishhook
59
-    - React/RCTBlob
60
-  - RNPermissions/BluetoothPeripheral (2.0.0-alpha.1):
61
-    - React/Core
62
-    - RNPermissions/Core
63
-  - RNPermissions/Calendars (2.0.0-alpha.1):
64
-    - React/Core
65
-    - RNPermissions/Core
66
-  - RNPermissions/Camera (2.0.0-alpha.1):
67
-    - React/Core
68
-    - RNPermissions/Core
69
-  - RNPermissions/Contacts (2.0.0-alpha.1):
70
-    - React/Core
71
-    - RNPermissions/Core
72
-  - RNPermissions/Core (2.0.0-alpha.1):
73
-    - React/Core
74
-  - RNPermissions/FaceID (2.0.0-alpha.1):
75
-    - React/Core
76
-    - RNPermissions/Core
77
-  - RNPermissions/LocationAlways (2.0.0-alpha.1):
78
-    - React/Core
79
-    - RNPermissions/Core
80
-  - RNPermissions/LocationWhenInUse (2.0.0-alpha.1):
81
-    - React/Core
82
-    - RNPermissions/Core
83
-  - RNPermissions/MediaLibrary (2.0.0-alpha.1):
84
-    - React/Core
85
-    - RNPermissions/Core
86
-  - RNPermissions/Microphone (2.0.0-alpha.1):
87
-    - React/Core
88
-    - RNPermissions/Core
89
-  - RNPermissions/Motion (2.0.0-alpha.1):
90
-    - React/Core
91
-    - RNPermissions/Core
92
-  - RNPermissions/Notifications (2.0.0-alpha.1):
93
-    - React/Core
94
-    - RNPermissions/Core
95
-  - RNPermissions/PhotoLibrary (2.0.0-alpha.1):
96
-    - React/Core
97
-    - RNPermissions/Core
98
-  - RNPermissions/Reminders (2.0.0-alpha.1):
99
-    - React/Core
100
-    - RNPermissions/Core
101
-  - RNPermissions/SpeechRecognition (2.0.0-alpha.1):
102
-    - React/Core
103
-    - RNPermissions/Core
104
-  - RNPermissions/StoreKit (2.0.0-alpha.1):
105
-    - React/Core
106
-    - RNPermissions/Core
107
-  - RNVectorIcons (6.2.0):
81
+    - glog
82
+  - React-jsiexecutor (0.60.5):
83
+    - DoubleConversion
84
+    - Folly (= 2018.10.22.00)
85
+    - glog
86
+    - React-cxxreact (= 0.60.5)
87
+    - React-jsi (= 0.60.5)
88
+  - React-jsinspector (0.60.5)
89
+  - React-RCTActionSheet (0.60.5):
90
+    - React-Core (= 0.60.5)
91
+  - React-RCTAnimation (0.60.5):
92
+    - React-Core (= 0.60.5)
93
+  - React-RCTBlob (0.60.5):
94
+    - React-Core (= 0.60.5)
95
+    - React-RCTNetwork (= 0.60.5)
96
+    - React-RCTWebSocket (= 0.60.5)
97
+  - React-RCTImage (0.60.5):
98
+    - React-Core (= 0.60.5)
99
+    - React-RCTNetwork (= 0.60.5)
100
+  - React-RCTLinking (0.60.5):
101
+    - React-Core (= 0.60.5)
102
+  - React-RCTNetwork (0.60.5):
103
+    - React-Core (= 0.60.5)
104
+  - React-RCTSettings (0.60.5):
105
+    - React-Core (= 0.60.5)
106
+  - React-RCTText (0.60.5):
107
+    - React-Core (= 0.60.5)
108
+  - React-RCTVibration (0.60.5):
109
+    - React-Core (= 0.60.5)
110
+  - React-RCTWebSocket (0.60.5):
111
+    - React-Core (= 0.60.5)
112
+  - RNPermissions (2.0.0-rc.0):
113
+    - React
114
+  - RNVectorIcons (6.6.0):
108 115
     - React
109
-  - yoga (0.58.3.React)
116
+  - yoga (0.60.5.React)
110 117
 
111 118
 DEPENDENCIES:
112 119
   - DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
113 120
   - Folly (from `../node_modules/react-native/third-party-podspecs/Folly.podspec`)
114 121
   - glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`)
115
-  - React/Core (from `../node_modules/react-native`)
116
-  - React/CxxBridge (from `../node_modules/react-native`)
117
-  - React/DevSupport (from `../node_modules/react-native`)
118
-  - React/RCTActionSheet (from `../node_modules/react-native`)
119
-  - React/RCTAnimation (from `../node_modules/react-native`)
120
-  - React/RCTBlob (from `../node_modules/react-native`)
121
-  - React/RCTGeolocation (from `../node_modules/react-native`)
122
-  - React/RCTImage (from `../node_modules/react-native`)
123
-  - React/RCTLinkingIOS (from `../node_modules/react-native`)
124
-  - React/RCTNetwork (from `../node_modules/react-native`)
125
-  - React/RCTPushNotification (from `../node_modules/react-native`)
126
-  - React/RCTSettings (from `../node_modules/react-native`)
127
-  - React/RCTText (from `../node_modules/react-native`)
128
-  - React/RCTVibration (from `../node_modules/react-native`)
129
-  - React/RCTWebSocket (from `../node_modules/react-native`)
130
-  - RNPermissions/BluetoothPeripheral (from `../node_modules/react-native-permissions`)
131
-  - RNPermissions/Calendars (from `../node_modules/react-native-permissions`)
132
-  - RNPermissions/Camera (from `../node_modules/react-native-permissions`)
133
-  - RNPermissions/Contacts (from `../node_modules/react-native-permissions`)
134
-  - RNPermissions/Core (from `../node_modules/react-native-permissions`)
135
-  - RNPermissions/FaceID (from `../node_modules/react-native-permissions`)
136
-  - RNPermissions/LocationAlways (from `../node_modules/react-native-permissions`)
137
-  - RNPermissions/LocationWhenInUse (from `../node_modules/react-native-permissions`)
138
-  - RNPermissions/MediaLibrary (from `../node_modules/react-native-permissions`)
139
-  - RNPermissions/Microphone (from `../node_modules/react-native-permissions`)
140
-  - RNPermissions/Motion (from `../node_modules/react-native-permissions`)
141
-  - RNPermissions/Notifications (from `../node_modules/react-native-permissions`)
142
-  - RNPermissions/PhotoLibrary (from `../node_modules/react-native-permissions`)
143
-  - RNPermissions/Reminders (from `../node_modules/react-native-permissions`)
144
-  - RNPermissions/SpeechRecognition (from `../node_modules/react-native-permissions`)
145
-  - RNPermissions/StoreKit (from `../node_modules/react-native-permissions`)
122
+  - Permission-BluetoothPeripheral (from `../node_modules/react-native-permissions/ios/BluetoothPeripheral.podspec`)
123
+  - Permission-Calendars (from `../node_modules/react-native-permissions/ios/Calendars.podspec`)
124
+  - Permission-Camera (from `../node_modules/react-native-permissions/ios/Camera.podspec`)
125
+  - Permission-Contacts (from `../node_modules/react-native-permissions/ios/Contacts.podspec`)
126
+  - Permission-FaceID (from `../node_modules/react-native-permissions/ios/FaceID.podspec`)
127
+  - Permission-LocationAlways (from `../node_modules/react-native-permissions/ios/LocationAlways.podspec`)
128
+  - Permission-LocationWhenInUse (from `../node_modules/react-native-permissions/ios/LocationWhenInUse.podspec`)
129
+  - Permission-MediaLibrary (from `../node_modules/react-native-permissions/ios/MediaLibrary.podspec`)
130
+  - Permission-Microphone (from `../node_modules/react-native-permissions/ios/Microphone.podspec`)
131
+  - Permission-Motion (from `../node_modules/react-native-permissions/ios/Motion.podspec`)
132
+  - Permission-Notifications (from `../node_modules/react-native-permissions/ios/Notifications.podspec`)
133
+  - Permission-PhotoLibrary (from `../node_modules/react-native-permissions/ios/PhotoLibrary.podspec`)
134
+  - Permission-Reminders (from `../node_modules/react-native-permissions/ios/Reminders.podspec`)
135
+  - Permission-SpeechRecognition (from `../node_modules/react-native-permissions/ios/SpeechRecognition.podspec`)
136
+  - Permission-StoreKit (from `../node_modules/react-native-permissions/ios/StoreKit.podspec`)
137
+  - React (from `../node_modules/react-native/`)
138
+  - React-Core (from `../node_modules/react-native/React`)
139
+  - React-cxxreact (from `../node_modules/react-native/ReactCommon/cxxreact`)
140
+  - React-DevSupport (from `../node_modules/react-native/React`)
141
+  - React-jsi (from `../node_modules/react-native/ReactCommon/jsi`)
142
+  - React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`)
143
+  - React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`)
144
+  - React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`)
145
+  - React-RCTAnimation (from `../node_modules/react-native/Libraries/NativeAnimation`)
146
+  - React-RCTBlob (from `../node_modules/react-native/Libraries/Blob`)
147
+  - React-RCTImage (from `../node_modules/react-native/Libraries/Image`)
148
+  - React-RCTLinking (from `../node_modules/react-native/Libraries/LinkingIOS`)
149
+  - React-RCTNetwork (from `../node_modules/react-native/Libraries/Network`)
150
+  - React-RCTSettings (from `../node_modules/react-native/Libraries/Settings`)
151
+  - React-RCTText (from `../node_modules/react-native/Libraries/Text`)
152
+  - React-RCTVibration (from `../node_modules/react-native/Libraries/Vibration`)
153
+  - React-RCTWebSocket (from `../node_modules/react-native/Libraries/WebSocket`)
154
+  - RNPermissions (from `../node_modules/react-native-permissions`)
146 155
   - RNVectorIcons (from `../node_modules/react-native-vector-icons`)
147 156
   - yoga (from `../node_modules/react-native/ReactCommon/yoga`)
148 157
 
@@ -157,8 +166,70 @@ EXTERNAL SOURCES:
157 166
     :podspec: "../node_modules/react-native/third-party-podspecs/Folly.podspec"
158 167
   glog:
159 168
     :podspec: "../node_modules/react-native/third-party-podspecs/glog.podspec"
169
+  Permission-BluetoothPeripheral:
170
+    :path: "../node_modules/react-native-permissions/ios/BluetoothPeripheral.podspec"
171
+  Permission-Calendars:
172
+    :path: "../node_modules/react-native-permissions/ios/Calendars.podspec"
173
+  Permission-Camera:
174
+    :path: "../node_modules/react-native-permissions/ios/Camera.podspec"
175
+  Permission-Contacts:
176
+    :path: "../node_modules/react-native-permissions/ios/Contacts.podspec"
177
+  Permission-FaceID:
178
+    :path: "../node_modules/react-native-permissions/ios/FaceID.podspec"
179
+  Permission-LocationAlways:
180
+    :path: "../node_modules/react-native-permissions/ios/LocationAlways.podspec"
181
+  Permission-LocationWhenInUse:
182
+    :path: "../node_modules/react-native-permissions/ios/LocationWhenInUse.podspec"
183
+  Permission-MediaLibrary:
184
+    :path: "../node_modules/react-native-permissions/ios/MediaLibrary.podspec"
185
+  Permission-Microphone:
186
+    :path: "../node_modules/react-native-permissions/ios/Microphone.podspec"
187
+  Permission-Motion:
188
+    :path: "../node_modules/react-native-permissions/ios/Motion.podspec"
189
+  Permission-Notifications:
190
+    :path: "../node_modules/react-native-permissions/ios/Notifications.podspec"
191
+  Permission-PhotoLibrary:
192
+    :path: "../node_modules/react-native-permissions/ios/PhotoLibrary.podspec"
193
+  Permission-Reminders:
194
+    :path: "../node_modules/react-native-permissions/ios/Reminders.podspec"
195
+  Permission-SpeechRecognition:
196
+    :path: "../node_modules/react-native-permissions/ios/SpeechRecognition.podspec"
197
+  Permission-StoreKit:
198
+    :path: "../node_modules/react-native-permissions/ios/StoreKit.podspec"
160 199
   React:
161
-    :path: "../node_modules/react-native"
200
+    :path: "../node_modules/react-native/"
201
+  React-Core:
202
+    :path: "../node_modules/react-native/React"
203
+  React-cxxreact:
204
+    :path: "../node_modules/react-native/ReactCommon/cxxreact"
205
+  React-DevSupport:
206
+    :path: "../node_modules/react-native/React"
207
+  React-jsi:
208
+    :path: "../node_modules/react-native/ReactCommon/jsi"
209
+  React-jsiexecutor:
210
+    :path: "../node_modules/react-native/ReactCommon/jsiexecutor"
211
+  React-jsinspector:
212
+    :path: "../node_modules/react-native/ReactCommon/jsinspector"
213
+  React-RCTActionSheet:
214
+    :path: "../node_modules/react-native/Libraries/ActionSheetIOS"
215
+  React-RCTAnimation:
216
+    :path: "../node_modules/react-native/Libraries/NativeAnimation"
217
+  React-RCTBlob:
218
+    :path: "../node_modules/react-native/Libraries/Blob"
219
+  React-RCTImage:
220
+    :path: "../node_modules/react-native/Libraries/Image"
221
+  React-RCTLinking:
222
+    :path: "../node_modules/react-native/Libraries/LinkingIOS"
223
+  React-RCTNetwork:
224
+    :path: "../node_modules/react-native/Libraries/Network"
225
+  React-RCTSettings:
226
+    :path: "../node_modules/react-native/Libraries/Settings"
227
+  React-RCTText:
228
+    :path: "../node_modules/react-native/Libraries/Text"
229
+  React-RCTVibration:
230
+    :path: "../node_modules/react-native/Libraries/Vibration"
231
+  React-RCTWebSocket:
232
+    :path: "../node_modules/react-native/Libraries/WebSocket"
162 233
   RNPermissions:
163 234
     :path: "../node_modules/react-native-permissions"
164 235
   RNVectorIcons:
@@ -168,14 +239,45 @@ EXTERNAL SOURCES:
168 239
 
169 240
 SPEC CHECKSUMS:
170 241
   boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c
171
-  DoubleConversion: bb338842f62ab1d708ceb63ec3d999f0f3d98ecd
172
-  Folly: de497beb10f102453a1afa9edbf8cf8a251890de
173
-  glog: aefd1eb5dda2ab95ba0938556f34b98e2da3a60d
174
-  React: d099597d6ba7001f0219dbc48532b63cfd8d0eca
175
-  RNPermissions: 064e4eb34c8c3da493ab48bda0af53cdd019b6a7
176
-  RNVectorIcons: b6b131d2fdc2e240f7aba41296df869141443793
177
-  yoga: 220e7595ec3cfe80c5ce02a0d0881be66b405e81
242
+  DoubleConversion: 5805e889d232975c086db112ece9ed034df7a0b2
243
+  Folly: 30e7936e1c45c08d884aa59369ed951a8e68cf51
244
+  glog: 1f3da668190260b06b429bb211bfbee5cd790c28
245
+  Permission-BluetoothPeripheral: 40a3a29cd253da8287511fb8de66bcfd0bed05cb
246
+  Permission-Calendars: 25e6f2eccd93b41cc34d3516a188f31bbb005629
247
+  Permission-Camera: b14927ff3611ae8ce6a6faba1e43a2c335fa21ee
248
+  Permission-Contacts: 807e3482b1d3957a5a321bff0955333ef3babe77
249
+  Permission-FaceID: 71ece20c432edc9dceaa6c65a67e08bfd9c6da8c
250
+  Permission-LocationAlways: 5fc356db1e7907c818f69e390ac1d8f19b121af2
251
+  Permission-LocationWhenInUse: 390e9625c1d31c0211bfecefa2d069b05fd0ac3c
252
+  Permission-MediaLibrary: 96f3e643983bc67d7109836ebe298eb755b4b2ce
253
+  Permission-Microphone: 4b56c7220e8e49ed4caf5f870305b1515d38afd3
254
+  Permission-Motion: a4d952f53fdbf76ee4a27a46b3cd6e9a86a99450
255
+  Permission-Notifications: 57e7814d37d1b46304a423d3e26d4f3ca95469ec
256
+  Permission-PhotoLibrary: 0d5f7f07184935d8e899e0e63e55f0702084960d
257
+  Permission-Reminders: 433b2c75d2d23ebd5ccf57261dfeeacbf2cffd5b
258
+  Permission-SpeechRecognition: f08e302a45682ab4426d44a4f2101e1ca88fdb8a
259
+  Permission-StoreKit: 257ef5f9d635b89a76821f11e536821f3964ab64
260
+  React: 53c53c4d99097af47cf60594b8706b4e3321e722
261
+  React-Core: ba421f6b4f4cbe2fb17c0b6fc675f87622e78a64
262
+  React-cxxreact: 8384287780c4999351ad9b6e7a149d9ed10a2395
263
+  React-DevSupport: 197fb409737cff2c4f9986e77c220d7452cb9f9f
264
+  React-jsi: 4d8c9efb6312a9725b18d6fc818ffc103f60fec2
265
+  React-jsiexecutor: 90ad2f9db09513fc763bc757fdc3c4ff8bde2a30
266
+  React-jsinspector: e08662d1bf5b129a3d556eb9ea343a3f40353ae4
267
+  React-RCTActionSheet: b0f1ea83f4bf75fb966eae9bfc47b78c8d3efd90
268
+  React-RCTAnimation: 359ba1b5690b1e87cc173558a78e82d35919333e
269
+  React-RCTBlob: 5e2b55f76e9a1c7ae52b826923502ddc3238df24
270
+  React-RCTImage: f5f1c50922164e89bdda67bcd0153952a5cfe719
271
+  React-RCTLinking: d0ecbd791e9ddddc41fa1f66b0255de90e8ee1e9
272
+  React-RCTNetwork: e26946300b0ab7bb6c4a6348090e93fa21f33a9d
273
+  React-RCTSettings: d0d37cb521b7470c998595a44f05847777cc3f42
274
+  React-RCTText: b074d89033583d4f2eb5faf7ea2db3a13c7553a2
275
+  React-RCTVibration: 2105b2e0e2b66a6408fc69a46c8a7fb5b2fdade0
276
+  React-RCTWebSocket: cd932a16b7214898b6b7f788c8bddb3637246ac4
277
+  RNPermissions: 86932e45b170515f71f76751bc9fa055910b049f
278
+  RNVectorIcons: 0bb4def82230be1333ddaeee9fcba45f0b288ed4
279
+  yoga: 312528f5bbbba37b4dcea5ef00e8b4033fdd9411
178 280
 
179
-PODFILE CHECKSUM: 6c6a73d9d885717f9c74907d423c3de5f74e21c3
281
+PODFILE CHECKSUM: a037c27dcc3fbbe5fde19672f4add90655640f7e
180 282
 
181
-COCOAPODS: 1.6.0
283
+COCOAPODS: 1.7.4

+ 0
- 54
example/ios/RNPermissionsExample-tvOS/Info.plist View File

@@ -1,54 +0,0 @@
1
-<?xml version="1.0" encoding="UTF-8"?>
2
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
-<plist version="1.0">
4
-<dict>
5
-	<key>CFBundleDevelopmentRegion</key>
6
-	<string>en</string>
7
-	<key>CFBundleExecutable</key>
8
-	<string>$(EXECUTABLE_NAME)</string>
9
-	<key>CFBundleIdentifier</key>
10
-	<string>org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)</string>
11
-	<key>CFBundleInfoDictionaryVersion</key>
12
-	<string>6.0</string>
13
-	<key>CFBundleName</key>
14
-	<string>$(PRODUCT_NAME)</string>
15
-	<key>CFBundlePackageType</key>
16
-	<string>APPL</string>
17
-	<key>CFBundleShortVersionString</key>
18
-	<string>1.0</string>
19
-	<key>CFBundleSignature</key>
20
-	<string>????</string>
21
-	<key>CFBundleVersion</key>
22
-	<string>1</string>
23
-	<key>LSRequiresIPhoneOS</key>
24
-	<true/>
25
-	<key>UILaunchStoryboardName</key>
26
-	<string>LaunchScreen</string>
27
-	<key>UIRequiredDeviceCapabilities</key>
28
-	<array>
29
-		<string>armv7</string>
30
-	</array>
31
-	<key>UISupportedInterfaceOrientations</key>
32
-	<array>
33
-		<string>UIInterfaceOrientationPortrait</string>
34
-		<string>UIInterfaceOrientationLandscapeLeft</string>
35
-		<string>UIInterfaceOrientationLandscapeRight</string>
36
-	</array>
37
-	<key>UIViewControllerBasedStatusBarAppearance</key>
38
-	<false/>
39
-	<key>NSLocationWhenInUseUsageDescription</key>
40
-	<string></string>
41
-	<key>NSAppTransportSecurity</key>
42
-	<!--See http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/ -->
43
-	<dict>
44
-		<key>NSExceptionDomains</key>
45
-		<dict>
46
-			<key>localhost</key>
47
-			<dict>
48
-				<key>NSExceptionAllowsInsecureHTTPLoads</key>
49
-				<true/>
50
-			</dict>
51
-		</dict>
52
-	</dict>
53
-</dict>
54
-</plist>

+ 44
- 231
example/ios/RNPermissionsExample.xcodeproj/project.pbxproj View File

@@ -11,21 +11,12 @@
11 11
 		13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; };
12 12
 		13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
13 13
 		13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
14
-		2D02E4BC1E0B4A80006451C7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; };
15
-		2D02E4BD1E0B4A84006451C7 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
16
-		2D02E4BF1E0B4AB3006451C7 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
17
-		2D16E6881FA4F8E400B85C8A /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2D16E6891FA4F8E400B85C8A /* libReact.a */; };
18
-		9C0E968CA5A4475A72D098CC /* libPods-RNPermissionsExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 61386F2312C2EA9721BCFEA4 /* libPods-RNPermissionsExample.a */; };
19
-		C365FCDF23384B71BADA5827 /* MaterialIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = B0FEF2381CCE4DAC89A441F0 /* MaterialIcons.ttf */; };
20
-		E70847AA58F41ED81DF7DC77 /* libPods-RNPermissionsExample-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DF6F9CA5073A9D32EB370652 /* libPods-RNPermissionsExample-tvOS.a */; };
21
-		ED297163215061F000B7C4FE /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED297162215061F000B7C4FE /* JavaScriptCore.framework */; };
22
-		ED2971652150620600B7C4FE /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED2971642150620600B7C4FE /* JavaScriptCore.framework */; };
14
+		2A94077659864F9EB01C8A33 /* MaterialIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = A7C280AB05534E81BE62866B /* MaterialIcons.ttf */; };
15
+		FF61E46FEEB7199D22A548F5 /* libPods-RNPermissionsExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D78CFB0B797068FC55B9C8C1 /* libPods-RNPermissionsExample.a */; };
23 16
 /* End PBXBuildFile section */
24 17
 
25 18
 /* Begin PBXFileReference section */
26 19
 		008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = main.jsbundle; sourceTree = "<group>"; };
27
-		0E7EBB2FDF7AAECF1C038287 /* Pods-RNPermissionsExample-tvOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNPermissionsExample-tvOS.release.xcconfig"; path = "Target Support Files/Pods-RNPermissionsExample-tvOS/Pods-RNPermissionsExample-tvOS.release.xcconfig"; sourceTree = "<group>"; };
28
-		1378F599F6455B105F696280 /* Pods-RNPermissionsExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNPermissionsExample.debug.xcconfig"; path = "Target Support Files/Pods-RNPermissionsExample/Pods-RNPermissionsExample.debug.xcconfig"; sourceTree = "<group>"; };
29 20
 		13B07F961A680F5B00A75B9A /* RNPermissionsExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RNPermissionsExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
30 21
 		13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = RNPermissionsExample/AppDelegate.h; sourceTree = "<group>"; };
31 22
 		13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = RNPermissionsExample/AppDelegate.m; sourceTree = "<group>"; };
@@ -33,15 +24,12 @@
33 24
 		13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = RNPermissionsExample/Images.xcassets; sourceTree = "<group>"; };
34 25
 		13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = RNPermissionsExample/Info.plist; sourceTree = "<group>"; };
35 26
 		13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = RNPermissionsExample/main.m; sourceTree = "<group>"; };
36
-		2D02E47B1E0B4A5D006451C7 /* RNPermissionsExample-tvOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "RNPermissionsExample-tvOS.app"; sourceTree = BUILT_PRODUCTS_DIR; };
37
-		2D16E6891FA4F8E400B85C8A /* libReact.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libReact.a; sourceTree = BUILT_PRODUCTS_DIR; };
38
-		61386F2312C2EA9721BCFEA4 /* libPods-RNPermissionsExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-RNPermissionsExample.a"; sourceTree = BUILT_PRODUCTS_DIR; };
39
-		B0FEF2381CCE4DAC89A441F0 /* MaterialIcons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = MaterialIcons.ttf; path = "../node_modules/react-native-vector-icons/Fonts/MaterialIcons.ttf"; sourceTree = "<group>"; };
40
-		D4E8F220F58DB908082D8E08 /* Pods-RNPermissionsExample-tvOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNPermissionsExample-tvOS.debug.xcconfig"; path = "Target Support Files/Pods-RNPermissionsExample-tvOS/Pods-RNPermissionsExample-tvOS.debug.xcconfig"; sourceTree = "<group>"; };
41
-		DF6F9CA5073A9D32EB370652 /* libPods-RNPermissionsExample-tvOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-RNPermissionsExample-tvOS.a"; sourceTree = BUILT_PRODUCTS_DIR; };
27
+		6508191B9B16B2AC0281B3AC /* Pods-RNPermissionsExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNPermissionsExample.release.xcconfig"; path = "Target Support Files/Pods-RNPermissionsExample/Pods-RNPermissionsExample.release.xcconfig"; sourceTree = "<group>"; };
28
+		A7C280AB05534E81BE62866B /* MaterialIcons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = MaterialIcons.ttf; path = "../node_modules/react-native-vector-icons/Fonts/MaterialIcons.ttf"; sourceTree = "<group>"; };
29
+		B6736F72654167EDBA7145AA /* Pods-RNPermissionsExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNPermissionsExample.debug.xcconfig"; path = "Target Support Files/Pods-RNPermissionsExample/Pods-RNPermissionsExample.debug.xcconfig"; sourceTree = "<group>"; };
30
+		D78CFB0B797068FC55B9C8C1 /* libPods-RNPermissionsExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-RNPermissionsExample.a"; sourceTree = BUILT_PRODUCTS_DIR; };
42 31
 		ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
43 32
 		ED2971642150620600B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS12.0.sdk/System/Library/Frameworks/JavaScriptCore.framework; sourceTree = DEVELOPER_DIR; };
44
-		F96F055A36F2991DEF9E65C0 /* Pods-RNPermissionsExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNPermissionsExample.release.xcconfig"; path = "Target Support Files/Pods-RNPermissionsExample/Pods-RNPermissionsExample.release.xcconfig"; sourceTree = "<group>"; };
45 33
 /* End PBXFileReference section */
46 34
 
47 35
 /* Begin PBXFrameworksBuildPhase section */
@@ -49,18 +37,7 @@
49 37
 			isa = PBXFrameworksBuildPhase;
50 38
 			buildActionMask = 2147483647;
51 39
 			files = (
52
-				ED297163215061F000B7C4FE /* JavaScriptCore.framework in Frameworks */,
53
-				9C0E968CA5A4475A72D098CC /* libPods-RNPermissionsExample.a in Frameworks */,
54
-			);
55
-			runOnlyForDeploymentPostprocessing = 0;
56
-		};
57
-		2D02E4781E0B4A5D006451C7 /* Frameworks */ = {
58
-			isa = PBXFrameworksBuildPhase;
59
-			buildActionMask = 2147483647;
60
-			files = (
61
-				ED2971652150620600B7C4FE /* JavaScriptCore.framework in Frameworks */,
62
-				2D16E6881FA4F8E400B85C8A /* libReact.a in Frameworks */,
63
-				E70847AA58F41ED81DF7DC77 /* libPods-RNPermissionsExample-tvOS.a in Frameworks */,
40
+				FF61E46FEEB7199D22A548F5 /* libPods-RNPermissionsExample.a in Frameworks */,
64 41
 			);
65 42
 			runOnlyForDeploymentPostprocessing = 0;
66 43
 		};
@@ -81,26 +58,41 @@
81 58
 			name = RNPermissionsExample;
82 59
 			sourceTree = "<group>";
83 60
 		};
61
+		2426786032D9E4653AC74A82 /* Pods */ = {
62
+			isa = PBXGroup;
63
+			children = (
64
+				B6736F72654167EDBA7145AA /* Pods-RNPermissionsExample.debug.xcconfig */,
65
+				6508191B9B16B2AC0281B3AC /* Pods-RNPermissionsExample.release.xcconfig */,
66
+			);
67
+			path = Pods;
68
+			sourceTree = "<group>";
69
+		};
84 70
 		2D16E6871FA4F8E400B85C8A /* Frameworks */ = {
85 71
 			isa = PBXGroup;
86 72
 			children = (
87 73
 				ED297162215061F000B7C4FE /* JavaScriptCore.framework */,
88 74
 				ED2971642150620600B7C4FE /* JavaScriptCore.framework */,
89
-				2D16E6891FA4F8E400B85C8A /* libReact.a */,
90
-				61386F2312C2EA9721BCFEA4 /* libPods-RNPermissionsExample.a */,
91
-				DF6F9CA5073A9D32EB370652 /* libPods-RNPermissionsExample-tvOS.a */,
75
+				D78CFB0B797068FC55B9C8C1 /* libPods-RNPermissionsExample.a */,
92 76
 			);
93 77
 			name = Frameworks;
94 78
 			sourceTree = "<group>";
95 79
 		};
80
+		5F78D441884D47A18F90131B /* Resources */ = {
81
+			isa = PBXGroup;
82
+			children = (
83
+				A7C280AB05534E81BE62866B /* MaterialIcons.ttf */,
84
+			);
85
+			name = Resources;
86
+			sourceTree = "<group>";
87
+		};
96 88
 		83CBB9F61A601CBA00E9B192 = {
97 89
 			isa = PBXGroup;
98 90
 			children = (
99 91
 				13B07FAE1A68108700A75B9A /* RNPermissionsExample */,
100 92
 				83CBBA001A601CBA00E9B192 /* Products */,
101 93
 				2D16E6871FA4F8E400B85C8A /* Frameworks */,
102
-				F00001AB828C4AB78E644833 /* Resources */,
103
-				A95D533A68278397BDA8D48F /* Pods */,
94
+				2426786032D9E4653AC74A82 /* Pods */,
95
+				5F78D441884D47A18F90131B /* Resources */,
104 96
 			);
105 97
 			indentWidth = 2;
106 98
 			sourceTree = "<group>";
@@ -111,31 +103,10 @@
111 103
 			isa = PBXGroup;
112 104
 			children = (
113 105
 				13B07F961A680F5B00A75B9A /* RNPermissionsExample.app */,
114
-				2D02E47B1E0B4A5D006451C7 /* RNPermissionsExample-tvOS.app */,
115 106
 			);
116 107
 			name = Products;
117 108
 			sourceTree = "<group>";
118 109
 		};
119
-		A95D533A68278397BDA8D48F /* Pods */ = {
120
-			isa = PBXGroup;
121
-			children = (
122
-				1378F599F6455B105F696280 /* Pods-RNPermissionsExample.debug.xcconfig */,
123
-				F96F055A36F2991DEF9E65C0 /* Pods-RNPermissionsExample.release.xcconfig */,
124
-				D4E8F220F58DB908082D8E08 /* Pods-RNPermissionsExample-tvOS.debug.xcconfig */,
125
-				0E7EBB2FDF7AAECF1C038287 /* Pods-RNPermissionsExample-tvOS.release.xcconfig */,
126
-			);
127
-			name = Pods;
128
-			path = Pods;
129
-			sourceTree = "<group>";
130
-		};
131
-		F00001AB828C4AB78E644833 /* Resources */ = {
132
-			isa = PBXGroup;
133
-			children = (
134
-				B0FEF2381CCE4DAC89A441F0 /* MaterialIcons.ttf */,
135
-			);
136
-			name = Resources;
137
-			sourceTree = "<group>";
138
-		};
139 110
 /* End PBXGroup section */
140 111
 
141 112
 /* Begin PBXNativeTarget section */
@@ -143,41 +114,23 @@
143 114
 			isa = PBXNativeTarget;
144 115
 			buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "RNPermissionsExample" */;
145 116
 			buildPhases = (
146
-				5F51F0458DC0318504BAA1BC /* [CP] Check Pods Manifest.lock */,
117
+				B8E3F604061BE0BB6353585E /* [CP] Check Pods Manifest.lock */,
118
+				FD10A7F022414F080027D42C /* Start Packager */,
147 119
 				13B07F871A680F5B00A75B9A /* Sources */,
148 120
 				13B07F8C1A680F5B00A75B9A /* Frameworks */,
149 121
 				13B07F8E1A680F5B00A75B9A /* Resources */,
150 122
 				00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */,
151
-				32560C6C133B2E27B79B4503 /* [CP] Copy Pods Resources */,
123
+				7A35D2CA5206F731A822AA51 /* [CP] Copy Pods Resources */,
152 124
 			);
153 125
 			buildRules = (
154 126
 			);
155 127
 			dependencies = (
156 128
 			);
157 129
 			name = RNPermissionsExample;
158
-			productName = "Hello World";
130
+			productName = RNPermissionsExample;
159 131
 			productReference = 13B07F961A680F5B00A75B9A /* RNPermissionsExample.app */;
160 132
 			productType = "com.apple.product-type.application";
161 133
 		};
162
-		2D02E47A1E0B4A5D006451C7 /* RNPermissionsExample-tvOS */ = {
163
-			isa = PBXNativeTarget;
164
-			buildConfigurationList = 2D02E4BA1E0B4A5E006451C7 /* Build configuration list for PBXNativeTarget "RNPermissionsExample-tvOS" */;
165
-			buildPhases = (
166
-				C5EF9DE7AEB391F931CDFB68 /* [CP] Check Pods Manifest.lock */,
167
-				2D02E4771E0B4A5D006451C7 /* Sources */,
168
-				2D02E4781E0B4A5D006451C7 /* Frameworks */,
169
-				2D02E4791E0B4A5D006451C7 /* Resources */,
170
-				2D02E4CB1E0B4B27006451C7 /* Bundle React Native Code And Images */,
171
-			);
172
-			buildRules = (
173
-			);
174
-			dependencies = (
175
-			);
176
-			name = "RNPermissionsExample-tvOS";
177
-			productName = "RNPermissionsExample-tvOS";
178
-			productReference = 2D02E47B1E0B4A5D006451C7 /* RNPermissionsExample-tvOS.app */;
179
-			productType = "com.apple.product-type.application";
180
-		};
181 134
 /* End PBXNativeTarget section */
182 135
 
183 136
 /* Begin PBXProject section */
@@ -189,21 +142,6 @@
189 142
 				TargetAttributes = {
190 143
 					13B07F861A680F5B00A75B9A = {
191 144
 						DevelopmentTeam = 745449BDR9;
192
-						SystemCapabilities = {
193
-							com.apple.BackgroundModes = {
194
-								enabled = 1;
195
-							};
196
-							com.apple.HealthKit = {
197
-								enabled = 0;
198
-							};
199
-							com.apple.HomeKit = {
200
-								enabled = 0;
201
-							};
202
-						};
203
-					};
204
-					2D02E47A1E0B4A5D006451C7 = {
205
-						CreatedOnToolsVersion = 8.2.1;
206
-						ProvisioningStyle = Automatic;
207 145
 					};
208 146
 				};
209 147
 			};
@@ -212,6 +150,7 @@
212 150
 			developmentRegion = English;
213 151
 			hasScannedForEncodings = 0;
214 152
 			knownRegions = (
153
+				English,
215 154
 				en,
216 155
 				Base,
217 156
 			);
@@ -221,7 +160,6 @@
221 160
 			projectRoot = "";
222 161
 			targets = (
223 162
 				13B07F861A680F5B00A75B9A /* RNPermissionsExample */,
224
-				2D02E47A1E0B4A5D006451C7 /* RNPermissionsExample-tvOS */,
225 163
 			);
226 164
 		};
227 165
 /* End PBXProject section */
@@ -233,15 +171,7 @@
233 171
 			files = (
234 172
 				13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */,
235 173
 				13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */,
236
-				C365FCDF23384B71BADA5827 /* MaterialIcons.ttf in Resources */,
237
-			);
238
-			runOnlyForDeploymentPostprocessing = 0;
239
-		};
240
-		2D02E4791E0B4A5D006451C7 /* Resources */ = {
241
-			isa = PBXResourcesBuildPhase;
242
-			buildActionMask = 2147483647;
243
-			files = (
244
-				2D02E4BD1E0B4A84006451C7 /* Images.xcassets in Resources */,
174
+				2A94077659864F9EB01C8A33 /* MaterialIcons.ttf in Resources */,
245 175
 			);
246 176
 			runOnlyForDeploymentPostprocessing = 0;
247 177
 		};
@@ -262,27 +192,11 @@
262 192
 			shellPath = /bin/sh;
263 193
 			shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh";
264 194
 		};
265
-		2D02E4CB1E0B4B27006451C7 /* Bundle React Native Code And Images */ = {
266
-			isa = PBXShellScriptBuildPhase;
267
-			buildActionMask = 2147483647;
268
-			files = (
269
-			);
270
-			inputPaths = (
271
-			);
272
-			name = "Bundle React Native Code And Images";
273
-			outputPaths = (
274
-			);
275
-			runOnlyForDeploymentPostprocessing = 0;
276
-			shellPath = /bin/sh;
277
-			shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh";
278
-		};
279
-		32560C6C133B2E27B79B4503 /* [CP] Copy Pods Resources */ = {
195
+		7A35D2CA5206F731A822AA51 /* [CP] Copy Pods Resources */ = {
280 196
 			isa = PBXShellScriptBuildPhase;
281 197
 			buildActionMask = 2147483647;
282 198
 			files = (
283 199
 			);
284
-			inputFileListPaths = (
285
-			);
286 200
 			inputPaths = (
287 201
 				"${PODS_ROOT}/Target Support Files/Pods-RNPermissionsExample/Pods-RNPermissionsExample-resources.sh",
288 202
 				"${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/AntDesign.ttf",
@@ -293,6 +207,7 @@
293 207
 				"${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/FontAwesome5_Brands.ttf",
294 208
 				"${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/FontAwesome5_Regular.ttf",
295 209
 				"${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/FontAwesome5_Solid.ttf",
210
+				"${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Fontisto.ttf",
296 211
 				"${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Foundation.ttf",
297 212
 				"${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Ionicons.ttf",
298 213
 				"${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/MaterialCommunityIcons.ttf",
@@ -302,8 +217,6 @@
302 217
 				"${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Zocial.ttf",
303 218
 			);
304 219
 			name = "[CP] Copy Pods Resources";
305
-			outputFileListPaths = (
306
-			);
307 220
 			outputPaths = (
308 221
 				"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/AntDesign.ttf",
309 222
 				"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Entypo.ttf",
@@ -313,6 +226,7 @@
313 226
 				"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/FontAwesome5_Brands.ttf",
314 227
 				"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/FontAwesome5_Regular.ttf",
315 228
 				"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/FontAwesome5_Solid.ttf",
229
+				"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Fontisto.ttf",
316 230
 				"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Foundation.ttf",
317 231
 				"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Ionicons.ttf",
318 232
 				"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/MaterialCommunityIcons.ttf",
@@ -326,7 +240,7 @@
326 240
 			shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-RNPermissionsExample/Pods-RNPermissionsExample-resources.sh\"\n";
327 241
 			showEnvVarsInLog = 0;
328 242
 		};
329
-		5F51F0458DC0318504BAA1BC /* [CP] Check Pods Manifest.lock */ = {
243
+		B8E3F604061BE0BB6353585E /* [CP] Check Pods Manifest.lock */ = {
330 244
 			isa = PBXShellScriptBuildPhase;
331 245
 			buildActionMask = 2147483647;
332 246
 			files = (
@@ -348,7 +262,7 @@
348 262
 			shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n    # print error to STDERR\n    echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n    exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
349 263
 			showEnvVarsInLog = 0;
350 264
 		};
351
-		C5EF9DE7AEB391F931CDFB68 /* [CP] Check Pods Manifest.lock */ = {
265
+		FD10A7F022414F080027D42C /* Start Packager */ = {
352 266
 			isa = PBXShellScriptBuildPhase;
353 267
 			buildActionMask = 2147483647;
354 268
 			files = (
@@ -356,18 +270,15 @@
356 270
 			inputFileListPaths = (
357 271
 			);
358 272
 			inputPaths = (
359
-				"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
360
-				"${PODS_ROOT}/Manifest.lock",
361 273
 			);
362
-			name = "[CP] Check Pods Manifest.lock";
274
+			name = "Start Packager";
363 275
 			outputFileListPaths = (
364 276
 			);
365 277
 			outputPaths = (
366
-				"$(DERIVED_FILE_DIR)/Pods-RNPermissionsExample-tvOS-checkManifestLockResult.txt",
367 278
 			);
368 279
 			runOnlyForDeploymentPostprocessing = 0;
369 280
 			shellPath = /bin/sh;
370
-			shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n    # print error to STDERR\n    echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n    exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
281
+			shellScript = "export RCT_METRO_PORT=\"${RCT_METRO_PORT:=8081}\"\necho \"export RCT_METRO_PORT=${RCT_METRO_PORT}\" > \"${SRCROOT}/../node_modules/react-native/scripts/.packager.env\"\nif [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\n  if nc -w 5 -z localhost ${RCT_METRO_PORT} ; then\n    if ! curl -s \"http://localhost:${RCT_METRO_PORT}/status\" | grep -q \"packager-status:running\" ; then\n      echo \"Port ${RCT_METRO_PORT} already in use, packager is either not running or not running correctly\"\n      exit 2\n    fi\n  else\n    open \"$SRCROOT/../node_modules/react-native/scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\n  fi\nfi\n";
371 282
 			showEnvVarsInLog = 0;
372 283
 		};
373 284
 /* End PBXShellScriptBuildPhase section */
@@ -382,15 +293,6 @@
382 293
 			);
383 294
 			runOnlyForDeploymentPostprocessing = 0;
384 295
 		};
385
-		2D02E4771E0B4A5D006451C7 /* Sources */ = {
386
-			isa = PBXSourcesBuildPhase;
387
-			buildActionMask = 2147483647;
388
-			files = (
389
-				2D02E4BF1E0B4AB3006451C7 /* main.m in Sources */,
390
-				2D02E4BC1E0B4A80006451C7 /* AppDelegate.m in Sources */,
391
-			);
392
-			runOnlyForDeploymentPostprocessing = 0;
393
-		};
394 296
 /* End PBXSourcesBuildPhase section */
395 297
 
396 298
 /* Begin PBXVariantGroup section */
@@ -408,27 +310,20 @@
408 310
 /* Begin XCBuildConfiguration section */
409 311
 		13B07F941A680F5B00A75B9A /* Debug */ = {
410 312
 			isa = XCBuildConfiguration;
411
-			baseConfigurationReference = 1378F599F6455B105F696280 /* Pods-RNPermissionsExample.debug.xcconfig */;
313
+			baseConfigurationReference = B6736F72654167EDBA7145AA /* Pods-RNPermissionsExample.debug.xcconfig */;
412 314
 			buildSettings = {
413 315
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
414
-				CODE_SIGN_ENTITLEMENTS = "";
415 316
 				CURRENT_PROJECT_VERSION = 1;
416 317
 				DEAD_CODE_STRIPPING = NO;
417 318
 				DEVELOPMENT_TEAM = 745449BDR9;
418
-				HEADER_SEARCH_PATHS = "$(inherited)";
419 319
 				INFOPLIST_FILE = RNPermissionsExample/Info.plist;
420 320
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
421
-				LIBRARY_SEARCH_PATHS = (
422
-					"$(inherited)",
423
-					"\"$(SRCROOT)/RNPermissionsExample\"",
424
-					"\"$(SRCROOT)/RNPermissionsExample\"",
425
-				);
426 321
 				OTHER_LDFLAGS = (
427 322
 					"$(inherited)",
428 323
 					"-ObjC",
429 324
 					"-lc++",
430 325
 				);
431
-				PRODUCT_BUNDLE_IDENTIFIER = com.zoontek.rnpermissions;
326
+				PRODUCT_BUNDLE_IDENTIFIER = com.rnpermissionsexample;
432 327
 				PRODUCT_NAME = RNPermissionsExample;
433 328
 				VERSIONING_SYSTEM = "apple-generic";
434 329
 			};
@@ -436,97 +331,24 @@
436 331
 		};
437 332
 		13B07F951A680F5B00A75B9A /* Release */ = {
438 333
 			isa = XCBuildConfiguration;
439
-			baseConfigurationReference = F96F055A36F2991DEF9E65C0 /* Pods-RNPermissionsExample.release.xcconfig */;
334
+			baseConfigurationReference = 6508191B9B16B2AC0281B3AC /* Pods-RNPermissionsExample.release.xcconfig */;
440 335
 			buildSettings = {
441 336
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
442
-				CODE_SIGN_ENTITLEMENTS = "";
443 337
 				CURRENT_PROJECT_VERSION = 1;
444 338
 				DEVELOPMENT_TEAM = 745449BDR9;
445
-				HEADER_SEARCH_PATHS = "$(inherited)";
446 339
 				INFOPLIST_FILE = RNPermissionsExample/Info.plist;
447 340
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
448
-				LIBRARY_SEARCH_PATHS = (
449
-					"$(inherited)",
450
-					"\"$(SRCROOT)/RNPermissionsExample\"",
451
-					"\"$(SRCROOT)/RNPermissionsExample\"",
452
-				);
453 341
 				OTHER_LDFLAGS = (
454 342
 					"$(inherited)",
455 343
 					"-ObjC",
456 344
 					"-lc++",
457 345
 				);
458
-				PRODUCT_BUNDLE_IDENTIFIER = com.zoontek.rnpermissions;
346
+				PRODUCT_BUNDLE_IDENTIFIER = com.rnpermissionsexample;
459 347
 				PRODUCT_NAME = RNPermissionsExample;
460 348
 				VERSIONING_SYSTEM = "apple-generic";
461 349
 			};
462 350
 			name = Release;
463 351
 		};
464
-		2D02E4971E0B4A5E006451C7 /* Debug */ = {
465
-			isa = XCBuildConfiguration;
466
-			baseConfigurationReference = D4E8F220F58DB908082D8E08 /* Pods-RNPermissionsExample-tvOS.debug.xcconfig */;
467
-			buildSettings = {
468
-				ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image";
469
-				ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
470
-				CLANG_ANALYZER_NONNULL = YES;
471
-				CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
472
-				CLANG_WARN_INFINITE_RECURSION = YES;
473
-				CLANG_WARN_SUSPICIOUS_MOVE = YES;
474
-				DEBUG_INFORMATION_FORMAT = dwarf;
475
-				ENABLE_TESTABILITY = YES;
476
-				GCC_NO_COMMON_BLOCKS = YES;
477
-				HEADER_SEARCH_PATHS = "$(inherited)";
478
-				INFOPLIST_FILE = "RNPermissionsExample-tvOS/Info.plist";
479
-				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
480
-				LIBRARY_SEARCH_PATHS = (
481
-					"$(inherited)",
482
-					"\"$(SRCROOT)/$(TARGET_NAME)\"",
483
-					"\"$(SRCROOT)/$(TARGET_NAME)\"",
484
-				);
485
-				OTHER_LDFLAGS = (
486
-					"-ObjC",
487
-					"-lc++",
488
-				);
489
-				PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.RNPermissionsExample-tvOS";
490
-				PRODUCT_NAME = "$(TARGET_NAME)";
491
-				SDKROOT = appletvos;
492
-				TARGETED_DEVICE_FAMILY = 3;
493
-				TVOS_DEPLOYMENT_TARGET = 9.2;
494
-			};
495
-			name = Debug;
496
-		};
497
-		2D02E4981E0B4A5E006451C7 /* Release */ = {
498
-			isa = XCBuildConfiguration;
499
-			baseConfigurationReference = 0E7EBB2FDF7AAECF1C038287 /* Pods-RNPermissionsExample-tvOS.release.xcconfig */;
500
-			buildSettings = {
501
-				ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image";
502
-				ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
503
-				CLANG_ANALYZER_NONNULL = YES;
504
-				CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
505
-				CLANG_WARN_INFINITE_RECURSION = YES;
506
-				CLANG_WARN_SUSPICIOUS_MOVE = YES;
507
-				COPY_PHASE_STRIP = NO;
508
-				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
509
-				GCC_NO_COMMON_BLOCKS = YES;
510
-				HEADER_SEARCH_PATHS = "$(inherited)";
511
-				INFOPLIST_FILE = "RNPermissionsExample-tvOS/Info.plist";
512
-				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
513
-				LIBRARY_SEARCH_PATHS = (
514
-					"$(inherited)",
515
-					"\"$(SRCROOT)/$(TARGET_NAME)\"",
516
-					"\"$(SRCROOT)/$(TARGET_NAME)\"",
517
-				);
518
-				OTHER_LDFLAGS = (
519
-					"-ObjC",
520
-					"-lc++",
521
-				);
522
-				PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.RNPermissionsExample-tvOS";
523
-				PRODUCT_NAME = "$(TARGET_NAME)";
524
-				SDKROOT = appletvos;
525
-				TARGETED_DEVICE_FAMILY = 3;
526
-				TVOS_DEPLOYMENT_TARGET = 9.2;
527
-			};
528
-			name = Release;
529
-		};
530 352
 		83CBBA201A601CBA00E9B192 /* Debug */ = {
531 353
 			isa = XCBuildConfiguration;
532 354
 			buildSettings = {
@@ -638,15 +460,6 @@
638 460
 			defaultConfigurationIsVisible = 0;
639 461
 			defaultConfigurationName = Release;
640 462
 		};
641
-		2D02E4BA1E0B4A5E006451C7 /* Build configuration list for PBXNativeTarget "RNPermissionsExample-tvOS" */ = {
642
-			isa = XCConfigurationList;
643
-			buildConfigurations = (
644
-				2D02E4971E0B4A5E006451C7 /* Debug */,
645
-				2D02E4981E0B4A5E006451C7 /* Release */,
646
-			);
647
-			defaultConfigurationIsVisible = 0;
648
-			defaultConfigurationName = Release;
649
-		};
650 463
 		83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "RNPermissionsExample" */ = {
651 464
 			isa = XCConfigurationList;
652 465
 			buildConfigurations = (

+ 0
- 129
example/ios/RNPermissionsExample.xcodeproj/xcshareddata/xcschemes/RNPermissionsExample-tvOS.xcscheme View File

@@ -1,129 +0,0 @@
1
-<?xml version="1.0" encoding="UTF-8"?>
2
-<Scheme
3
-   LastUpgradeVersion = "0940"
4
-   version = "1.3">
5
-   <BuildAction
6
-      parallelizeBuildables = "NO"
7
-      buildImplicitDependencies = "YES">
8
-      <BuildActionEntries>
9
-         <BuildActionEntry
10
-            buildForTesting = "YES"
11
-            buildForRunning = "YES"
12
-            buildForProfiling = "YES"
13
-            buildForArchiving = "YES"
14
-            buildForAnalyzing = "YES">
15
-            <BuildableReference
16
-               BuildableIdentifier = "primary"
17
-               BlueprintIdentifier = "2D2A28121D9B038B00D4039D"
18
-               BuildableName = "libReact.a"
19
-               BlueprintName = "React-tvOS"
20
-               ReferencedContainer = "container:../node_modules/react-native/React/React.xcodeproj">
21
-            </BuildableReference>
22
-         </BuildActionEntry>
23
-         <BuildActionEntry
24
-            buildForTesting = "YES"
25
-            buildForRunning = "YES"
26
-            buildForProfiling = "YES"
27
-            buildForArchiving = "YES"
28
-            buildForAnalyzing = "YES">
29
-            <BuildableReference
30
-               BuildableIdentifier = "primary"
31
-               BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
32
-               BuildableName = "RNPermissionsExample-tvOS.app"
33
-               BlueprintName = "RNPermissionsExample-tvOS"
34
-               ReferencedContainer = "container:RNPermissionsExample.xcodeproj">
35
-            </BuildableReference>
36
-         </BuildActionEntry>
37
-         <BuildActionEntry
38
-            buildForTesting = "YES"
39
-            buildForRunning = "YES"
40
-            buildForProfiling = "NO"
41
-            buildForArchiving = "NO"
42
-            buildForAnalyzing = "YES">
43
-            <BuildableReference
44
-               BuildableIdentifier = "primary"
45
-               BlueprintIdentifier = "2D02E48F1E0B4A5D006451C7"
46
-               BuildableName = "RNPermissionsExample-tvOSTests.xctest"
47
-               BlueprintName = "RNPermissionsExample-tvOSTests"
48
-               ReferencedContainer = "container:RNPermissionsExample.xcodeproj">
49
-            </BuildableReference>
50
-         </BuildActionEntry>
51
-      </BuildActionEntries>
52
-   </BuildAction>
53
-   <TestAction
54
-      buildConfiguration = "Debug"
55
-      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
56
-      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
57
-      shouldUseLaunchSchemeArgsEnv = "YES">
58
-      <Testables>
59
-         <TestableReference
60
-            skipped = "NO">
61
-            <BuildableReference
62
-               BuildableIdentifier = "primary"
63
-               BlueprintIdentifier = "2D02E48F1E0B4A5D006451C7"
64
-               BuildableName = "RNPermissionsExample-tvOSTests.xctest"
65
-               BlueprintName = "RNPermissionsExample-tvOSTests"
66
-               ReferencedContainer = "container:RNPermissionsExample.xcodeproj">
67
-            </BuildableReference>
68
-         </TestableReference>
69
-      </Testables>
70
-      <MacroExpansion>
71
-         <BuildableReference
72
-            BuildableIdentifier = "primary"
73
-            BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
74
-            BuildableName = "RNPermissionsExample-tvOS.app"
75
-            BlueprintName = "RNPermissionsExample-tvOS"
76
-            ReferencedContainer = "container:RNPermissionsExample.xcodeproj">
77
-         </BuildableReference>
78
-      </MacroExpansion>
79
-      <AdditionalOptions>
80
-      </AdditionalOptions>
81
-   </TestAction>
82
-   <LaunchAction
83
-      buildConfiguration = "Debug"
84
-      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
85
-      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
86
-      launchStyle = "0"
87
-      useCustomWorkingDirectory = "NO"
88
-      ignoresPersistentStateOnLaunch = "NO"
89
-      debugDocumentVersioning = "YES"
90
-      debugServiceExtension = "internal"
91
-      allowLocationSimulation = "YES">
92
-      <BuildableProductRunnable
93
-         runnableDebuggingMode = "0">
94
-         <BuildableReference
95
-            BuildableIdentifier = "primary"
96
-            BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
97
-            BuildableName = "RNPermissionsExample-tvOS.app"
98
-            BlueprintName = "RNPermissionsExample-tvOS"
99
-            ReferencedContainer = "container:RNPermissionsExample.xcodeproj">
100
-         </BuildableReference>
101
-      </BuildableProductRunnable>
102
-      <AdditionalOptions>
103
-      </AdditionalOptions>
104
-   </LaunchAction>
105
-   <ProfileAction
106
-      buildConfiguration = "Release"
107
-      shouldUseLaunchSchemeArgsEnv = "YES"
108
-      savedToolIdentifier = ""
109
-      useCustomWorkingDirectory = "NO"
110
-      debugDocumentVersioning = "YES">
111
-      <BuildableProductRunnable
112
-         runnableDebuggingMode = "0">
113
-         <BuildableReference
114
-            BuildableIdentifier = "primary"
115
-            BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
116
-            BuildableName = "RNPermissionsExample-tvOS.app"
117
-            BlueprintName = "RNPermissionsExample-tvOS"
118
-            ReferencedContainer = "container:RNPermissionsExample.xcodeproj">
119
-         </BuildableReference>
120
-      </BuildableProductRunnable>
121
-   </ProfileAction>
122
-   <AnalyzeAction
123
-      buildConfiguration = "Debug">
124
-   </AnalyzeAction>
125
-   <ArchiveAction
126
-      buildConfiguration = "Release"
127
-      revealArchiveInOrganizer = "YES">
128
-   </ArchiveAction>
129
-</Scheme>

+ 2
- 1
example/ios/RNPermissionsExample/AppDelegate.h View File

@@ -5,9 +5,10 @@
5 5
  * LICENSE file in the root directory of this source tree.
6 6
  */
7 7
 
8
+#import <React/RCTBridgeDelegate.h>
8 9
 #import <UIKit/UIKit.h>
9 10
 
10
-@interface AppDelegate : UIResponder <UIApplicationDelegate>
11
+@interface AppDelegate : UIResponder <UIApplicationDelegate, RCTBridgeDelegate>
11 12
 
12 13
 @property (nonatomic, strong) UIWindow *window;
13 14
 

+ 15
- 8
example/ios/RNPermissionsExample/AppDelegate.m View File

@@ -7,6 +7,7 @@
7 7
 
8 8
 #import "AppDelegate.h"
9 9
 
10
+#import <React/RCTBridge.h>
10 11
 #import <React/RCTBundleURLProvider.h>
11 12
 #import <React/RCTRootView.h>
12 13
 
@@ -14,15 +15,12 @@
14 15
 
15 16
 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
16 17
 {
17
-  NSURL *jsCodeLocation;
18
+  RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
19
+  RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
20
+                                                   moduleName:@"RNPermissionsExample"
21
+                                            initialProperties:nil];
18 22
 
19
-  jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
20
-
21
-  RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
22
-                                                      moduleName:@"RNPermissionsExample"
23
-                                               initialProperties:nil
24
-                                                   launchOptions:launchOptions];
25
-  rootView.backgroundColor = [UIColor blackColor];
23
+  rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
26 24
 
27 25
   self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
28 26
   UIViewController *rootViewController = [UIViewController new];
@@ -32,4 +30,13 @@
32 30
   return YES;
33 31
 }
34 32
 
33
+- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
34
+{
35
+#if DEBUG
36
+  return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
37
+#else
38
+  return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
39
+#endif
40
+}
41
+
35 42
 @end

+ 14
- 16
example/ios/RNPermissionsExample/Info.plist View File

@@ -38,33 +38,33 @@
38 38
 		</dict>
39 39
 	</dict>
40 40
 	<key>NSAppleMusicUsageDescription</key>
41
-	<string>Please let me use your media library</string>
41
+	<string>Let me use your media library</string>
42 42
 	<key>NSBluetoothPeripheralUsageDescription</key>
43
-	<string>Please let me use your bluetooth peripheral</string>
43
+	<string>Let me use your bluetooth peripheral</string>
44 44
 	<key>NSCalendarsUsageDescription</key>
45
-	<string>Please let me use your calendar</string>
45
+	<string>Let me use your calendar</string>
46 46
 	<key>NSCameraUsageDescription</key>
47
-	<string>Please let me use your camera</string>
47
+	<string>Let me use your camera</string>
48 48
 	<key>NSContactsUsageDescription</key>
49
-	<string>Please let me use your contacts</string>
49
+	<string>Let me use your contacts</string>
50 50
 	<key>NSFaceIDUsageDescription</key>
51
-	<string>Please let me use FaceID</string>
51
+	<string>Let me use FaceID</string>
52 52
 	<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
53
-	<string>Please let me use your location, even in background</string>
53
+	<string>Let me use your location, even in background</string>
54 54
 	<key>NSLocationAlwaysUsageDescription</key>
55
-	<string>Please let me use your location, even in background</string>
55
+	<string>Let me use your location, even in background</string>
56 56
 	<key>NSLocationWhenInUseUsageDescription</key>
57
-	<string>Please let me use your location when the app is opened</string>
57
+	<string>Let me use your location when the app is opened</string>
58 58
 	<key>NSMicrophoneUsageDescription</key>
59
-	<string>Please let me use your microphone</string>
59
+	<string>Let me use your microphone</string>
60 60
 	<key>NSMotionUsageDescription</key>
61
-	<string>Please let me use your motion data</string>
61
+	<string>Let me use your motion data</string>
62 62
 	<key>NSPhotoLibraryUsageDescription</key>
63
-	<string>Please let me use your photo library</string>
63
+	<string>Let me use your photo library</string>
64 64
 	<key>NSRemindersUsageDescription</key>
65
-	<string>Please let me use your reminders</string>
65
+	<string>Let me use your reminders</string>
66 66
 	<key>NSSpeechRecognitionUsageDescription</key>
67
-	<string>Please let me use speech recognition</string>
67
+	<string>Let me use speech recognition</string>
68 68
 	<key>UIAppFonts</key>
69 69
 	<array>
70 70
 		<string>MaterialIcons.ttf</string>
@@ -83,8 +83,6 @@
83 83
 	<key>UISupportedInterfaceOrientations</key>
84 84
 	<array>
85 85
 		<string>UIInterfaceOrientationPortrait</string>
86
-		<string>UIInterfaceOrientationLandscapeLeft</string>
87
-		<string>UIInterfaceOrientationLandscapeRight</string>
88 86
 	</array>
89 87
 	<key>UIViewControllerBasedStatusBarAppearance</key>
90 88
 	<false/>

+ 10
- 0
example/metro.config.js View File

@@ -0,0 +1,10 @@
1
+module.exports = {
2
+  transformer: {
3
+    getTransformOptions: async () => ({
4
+      transform: {
5
+        experimentalImportSupport: false,
6
+        inlineRequires: false,
7
+      },
8
+    }),
9
+  },
10
+};

+ 13
- 9
example/package.json View File

@@ -3,19 +3,23 @@
3 3
   "version": "0.0.1",
4 4
   "private": true,
5 5
   "scripts": {
6
-    "clean:modules": "rm -rf node_modules/react-native-permissions/node_modules",
7
-    "clean:example": "rm -rf node_modules/react-native-permissions/example",
8
-    "start": "yarn clean:modules && yarn clean:example && node node_modules/react-native/local-cli/cli.js start"
6
+    "start": "react-native start",
7
+    "postinstall": "rm -rf node_modules/react-native-permissions/{example,node_modules}",
8
+    "reinstall": "rm -rf node_modules ios/Pods && yarn install && cd ios && pod install"
9 9
   },
10 10
   "dependencies": {
11
-    "react": "16.6.3",
12
-    "react-native": "0.58.3",
13
-    "react-native-paper": "2.6.3",
11
+    "react": "16.8.6",
12
+    "react-native": "0.60.5",
13
+    "react-native-paper": "2.16.0",
14 14
     "react-native-permissions": "../",
15
-    "react-native-vector-icons": "6.2.0"
15
+    "react-native-vector-icons": "6.6.0"
16 16
   },
17 17
   "devDependencies": {
18
-    "babel-core": "7.0.0-bridge.0",
19
-    "metro-react-native-babel-preset": "0.51.1"
18
+    "@babel/core": "7.5.5",
19
+    "@babel/runtime": "7.5.5",
20
+    "@types/react": "16.9.2",
21
+    "@types/react-native": "0.60.7",
22
+    "metro-react-native-babel-preset": "0.56.0",
23
+    "typescript": "3.5.3"
20 24
   }
21 25
 }

+ 0
- 12
example/theme.js View File

@@ -1,12 +0,0 @@
1
-// @flow
2
-
3
-import { DefaultTheme } from "react-native-paper";
4
-
5
-export default {
6
-  ...DefaultTheme,
7
-  colors: {
8
-    ...DefaultTheme.colors,
9
-    primary: "#607d8b",
10
-    accent: "#7b1fa2",
11
-  },
12
-};

+ 10
- 0
example/theme.ts View File

@@ -0,0 +1,10 @@
1
+import {DefaultTheme} from 'react-native-paper';
2
+
3
+export default {
4
+  ...DefaultTheme,
5
+  colors: {
6
+    ...DefaultTheme.colors,
7
+    primary: '#607d8b',
8
+    accent: '#7b1fa2',
9
+  },
10
+};

+ 14
- 0
example/tsconfig.json View File

@@ -0,0 +1,14 @@
1
+{
2
+  "compilerOptions": {
3
+    "esModuleInterop": true,
4
+    "isolatedModules": true,
5
+    "jsx": "react-native",
6
+    "lib": ["es2015"],
7
+    "moduleResolution": "node",
8
+    "noEmit": true,
9
+    "strict": true,
10
+    "target": "esnext"
11
+  },
12
+  "include": ["**/*.ts", "**/*.tsx"],
13
+  "exclude": ["node_modules"]
14
+}

+ 1470
- 3031
example/yarn.lock
File diff suppressed because it is too large
View File


+ 0
- 235
index.js View File

@@ -1,235 +0,0 @@
1
-// @flow
2
-
3
-import {
4
-  AsyncStorage,
5
-  NativeModules,
6
-  PermissionsAndroid,
7
-  Platform,
8
-  // $FlowFixMe
9
-} from "react-native";
10
-
11
-const { RNPermissions } = NativeModules;
12
-
13
-export const ANDROID_PERMISSIONS = {
14
-  ...PermissionsAndroid.PERMISSIONS,
15
-  // Dangerous permissions not included in PermissionsAndroid
16
-  // They might be unavailable in the current OS
17
-  ANSWER_PHONE_CALLS: "android.permission.ANSWER_PHONE_CALLS",
18
-  ACCEPT_HANDOVER: "android.permission.ACCEPT_HANDOVER",
19
-  READ_PHONE_NUMBERS: "android.permission.READ_PHONE_NUMBERS",
20
-};
21
-
22
-// function keyMirror<O: {}>(obj: O): $ObjMapi<O, <K>(k: K) => K> {
23
-//   return Object.keys(obj).reduce((acc, key) => ({ ...acc, [key]: key }), {});
24
-// }
25
-
26
-export const IOS_PERMISSIONS = {
27
-  BLUETOOTH_PERIPHERAL: "BLUETOOTH_PERIPHERAL",
28
-  CALENDARS: "CALENDARS",
29
-  CAMERA: "CAMERA",
30
-  CONTACTS: "CONTACTS",
31
-  FACE_ID: "FACE_ID",
32
-  LOCATION_ALWAYS: "LOCATION_ALWAYS",
33
-  LOCATION_WHEN_IN_USE: "LOCATION_WHEN_IN_USE",
34
-  MEDIA_LIBRARY: "MEDIA_LIBRARY",
35
-  MICROPHONE: "MICROPHONE",
36
-  MOTION: "MOTION",
37
-  NOTIFICATIONS: "NOTIFICATIONS",
38
-  PHOTO_LIBRARY: "PHOTO_LIBRARY",
39
-  REMINDERS: "REMINDERS",
40
-  SIRI: "SIRI",
41
-  SPEECH_RECOGNITION: "SPEECH_RECOGNITION",
42
-  STOREKIT: "STOREKIT",
43
-};
44
-
45
-export const RESULTS = {
46
-  GRANTED: "granted",
47
-  DENIED: "denied",
48
-  NEVER_ASK_AGAIN: "never_ask_again",
49
-  UNAVAILABLE: "unavailable",
50
-};
51
-
52
-export type Permission =
53
-  | $Keys<typeof ANDROID_PERMISSIONS>
54
-  | $Keys<typeof IOS_PERMISSIONS>;
55
-
56
-export type PermissionStatus = $Values<typeof RESULTS>;
57
-
58
-export type Rationale = {|
59
-  title: string,
60
-  message: string,
61
-  buttonPositive: string,
62
-  buttonNegative?: string,
63
-  buttonNeutral?: string,
64
-|};
65
-
66
-export type NotificationOption =
67
-  | "badge"
68
-  | "sound"
69
-  | "alert"
70
-  | "carPlay"
71
-  | "criticalAlert"
72
-  | "provisional";
73
-
74
-export type RequestConfig = {
75
-  notificationOptions?: NotificationOption[],
76
-  rationale?: Rationale,
77
-};
78
-
79
-const platformPermissions = Object.values(
80
-  Platform.OS === "ios" ? IOS_PERMISSIONS : ANDROID_PERMISSIONS,
81
-);
82
-
83
-function assertValidPermission(permission: string) {
84
-  if (!platformPermissions.includes(permission)) {
85
-    const bulletsList = `• ${platformPermissions.join("\n• ")}`;
86
-    const alertSentence = `Invalid ${
87
-      Platform.OS
88
-    } permission "${permission}". Must be one of:\n\n`;
89
-
90
-    throw new Error(`${alertSentence}${bulletsList}`);
91
-  }
92
-}
93
-
94
-function getUnavailablePermissions(permissions: string[]) {
95
-  return Promise.all(
96
-    permissions.map(p => RNPermissions.isPermissionAvailable(p)),
97
-  ).then(availabilities =>
98
-    availabilities.reduce((acc, available, i) => {
99
-      return !available
100
-        ? { ...acc, [permissions[i]]: RESULTS.UNAVAILABLE }
101
-        : acc;
102
-    }, {}),
103
-  );
104
-}
105
-
106
-const requestedKey = "@RNPermissions:requested";
107
-
108
-async function getRequestedPermissions() {
109
-  const requested = await AsyncStorage.getItem(requestedKey);
110
-  return requested ? JSON.parse(requested) : [];
111
-}
112
-
113
-async function setRequestedPermissions(permissions: string[]) {
114
-  const requested = await getRequestedPermissions();
115
-  const dedup = [...new Set([...requested, ...permissions])];
116
-  return AsyncStorage.setItem(requestedKey, JSON.stringify(dedup));
117
-}
118
-
119
-async function internalCheck(
120
-  permission: Permission,
121
-): Promise<PermissionStatus> {
122
-  if (Platform.OS !== "android") {
123
-    return RNPermissions.check(permission);
124
-  }
125
-
126
-  if (!(await RNPermissions.isPermissionAvailable(permission))) {
127
-    return RESULTS.UNAVAILABLE;
128
-  }
129
-  if (await PermissionsAndroid.check(permission)) {
130
-    return RESULTS.GRANTED;
131
-  }
132
-  if (!(await getRequestedPermissions()).includes(permission)) {
133
-    return RESULTS.DENIED;
134
-  }
135
-
136
-  return (await NativeModules.PermissionsAndroid.shouldShowRequestPermissionRationale(
137
-    permission,
138
-  ))
139
-    ? RESULTS.DENIED
140
-    : RESULTS.NEVER_ASK_AGAIN;
141
-}
142
-
143
-async function internalRequest(
144
-  permission: string,
145
-  config: RequestConfig = {},
146
-): Promise<PermissionStatus> {
147
-  const { notificationOptions, rationale } = config;
148
-
149
-  if (Platform.OS !== "android") {
150
-    return RNPermissions.request(permission, { notificationOptions });
151
-  }
152
-
153
-  if (!(await RNPermissions.isPermissionAvailable(permission))) {
154
-    return RESULTS.UNAVAILABLE;
155
-  }
156
-
157
-  const status = await PermissionsAndroid.request(permission, rationale);
158
-  return setRequestedPermissions([permission]).then(() => status);
159
-}
160
-
161
-async function internalCheckMultiple(
162
-  permissions: Permission[],
163
-): Promise<{ [permission: Permission]: PermissionStatus }> {
164
-  let available = permissions;
165
-  let result = {};
166
-
167
-  if (Platform.OS === "android") {
168
-    result = await getUnavailablePermissions(permissions);
169
-    const unavailable = Object.keys(result);
170
-    available = permissions.filter(p => !unavailable.includes(p));
171
-  }
172
-
173
-  return Promise.all(available.map(p => internalCheck(p)))
174
-    .then(statuses =>
175
-      statuses.reduce((acc, status, i) => {
176
-        return { ...acc, [available[i]]: status };
177
-      }, {}),
178
-    )
179
-    .then(statuses => ({ ...result, ...statuses }));
180
-}
181
-
182
-async function internalRequestMultiple(
183
-  permissions: Permission[],
184
-): Promise<{ [permission: Permission]: PermissionStatus }> {
185
-  if (Platform.OS !== "android") {
186
-    const result = {};
187
-
188
-    for (let i = 0; i < permissions.length; i++) {
189
-      const permission = permissions[i];
190
-      result[permission] = await internalRequest(permission); // once at the time
191
-    }
192
-
193
-    return result;
194
-  }
195
-
196
-  const result = await getUnavailablePermissions(permissions);
197
-  const unavailable = Object.keys(result);
198
-
199
-  const statuses = await PermissionsAndroid.requestMultiple(
200
-    permissions.filter(p => !unavailable.includes(p)),
201
-  ).then(statuses => ({ ...result, ...statuses }));
202
-
203
-  return setRequestedPermissions(permissions).then(() => statuses);
204
-}
205
-
206
-export function openSettings(): Promise<boolean> {
207
-  return RNPermissions.openSettings();
208
-}
209
-
210
-export function check(permission: Permission): Promise<PermissionStatus> {
211
-  assertValidPermission(permission);
212
-  return internalCheck(permission);
213
-}
214
-
215
-export function checkMultiple<P: Permission>(
216
-  permissions: P[],
217
-): Promise<{ [permission: P]: PermissionStatus }> {
218
-  permissions.forEach(assertValidPermission);
219
-  return internalCheckMultiple(permissions);
220
-}
221
-
222
-export function request(
223
-  permission: string,
224
-  config: RequestConfig = {},
225
-): Promise<PermissionStatus> {
226
-  assertValidPermission(permission);
227
-  return internalRequest(permission, config);
228
-}
229
-
230
-export function requestMultiple<P: Permission>(
231
-  permissions: P[],
232
-): Promise<{ [permission: P]: PermissionStatus }> {
233
-  permissions.forEach(assertValidPermission);
234
-  return internalRequestMultiple(permissions);
235
-}

+ 19
- 0
ios/BluetoothPeripheral.podspec View File

@@ -0,0 +1,19 @@
1
+require 'json'
2
+package = JSON.parse(File.read('../package.json'))
3
+
4
+Pod::Spec.new do |s|
5
+  s.name            = "Permission-BluetoothPeripheral"
6
+  s.dependency        "RNPermissions"
7
+
8
+  s.version         = package["version"]
9
+  s.license         = package["license"]
10
+  s.summary         = package["description"]
11
+  s.authors         = package["author"]
12
+  s.homepage        = package["homepage"]
13
+
14
+  s.platform        = :ios, "9.0"
15
+  s.requires_arc    = true
16
+
17
+  s.source          = { :git => s.homepage, :tag => s.version }
18
+  s.source_files    = "BluetoothPeripheral/*.{h,m}"
19
+end

ios/PermissionHandlers/BluetoothPeripheral/RNPermissionHandlerBluetoothPeripheral.h → ios/BluetoothPeripheral/RNPermissionHandlerBluetoothPeripheral.h View File

@@ -1,4 +1,4 @@
1
-#import "RNPermissionsManager.h"
1
+#import "RNPermissions.h"
2 2
 
3 3
 @interface RNPermissionHandlerBluetoothPeripheral : NSObject<RNPermissionHandler>
4 4
 

ios/PermissionHandlers/BluetoothPeripheral/RNPermissionHandlerBluetoothPeripheral.m → ios/BluetoothPeripheral/RNPermissionHandlerBluetoothPeripheral.m View File

@@ -4,24 +4,28 @@
4 4
 
5 5
 @interface RNPermissionHandlerBluetoothPeripheral() <CBPeripheralManagerDelegate>
6 6
 
7
-@property (nonatomic) CBPeripheralManager* peripheralManager;
8
-@property (nonatomic, copy) void (^resolve)(RNPermissionStatus status);
9
-@property (nonatomic, copy) void (^reject)(NSError *error);
7
+@property (nonatomic, strong) CBPeripheralManager* peripheralManager;
8
+@property (nonatomic, strong) void (^resolve)(RNPermissionStatus status);
9
+@property (nonatomic, strong) void (^reject)(NSError *error);
10 10
 
11 11
 @end
12 12
 
13 13
 @implementation RNPermissionHandlerBluetoothPeripheral
14 14
 
15
-+ (NSArray<NSString *> *)usageDescriptionKeys {
15
++ (NSArray<NSString *> * _Nonnull)usageDescriptionKeys {
16 16
   return @[@"NSBluetoothPeripheralUsageDescription"];
17 17
 }
18 18
 
19
-- (void)checkWithResolver:(void (^)(RNPermissionStatus status))resolve
20
-             withRejecter:(void (__unused ^)(NSError *error))reject {
19
++ (NSString * _Nonnull)handlerUniqueId {
20
+  return @"ios.permission.BLUETOOTH_PERIPHERAL";
21
+}
22
+
23
+- (void)checkWithResolver:(void (^ _Nonnull)(RNPermissionStatus))resolve
24
+                 rejecter:(void (__unused ^ _Nonnull)(NSError * _Nonnull))reject {
21 25
 #if TARGET_OS_SIMULATOR
22 26
   return resolve(RNPermissionStatusNotAvailable);
23 27
 #else
24
-  if (![RNPermissionsManager hasBackgroundModeEnabled:@"bluetooth-peripheral"]) {
28
+  if (![RNPermissions isBackgroundModeEnabled:@"bluetooth-peripheral"]) {
25 29
     return resolve(RNPermissionStatusNotAvailable);
26 30
   }
27 31
 
@@ -38,10 +42,9 @@
38 42
 #endif
39 43
 }
40 44
 
41
-- (void)requestWithOptions:(__unused NSDictionary * _Nullable)options
42
-              withResolver:(void (^)(RNPermissionStatus status))resolve
43
-              withRejecter:(void (^)(NSError *error))reject {
44
-  if (![RNPermissionsManager hasBackgroundModeEnabled:@"bluetooth-peripheral"]) {
45
+- (void)requestWithResolver:(void (^ _Nonnull)(RNPermissionStatus))resolve
46
+                   rejecter:(void (^ _Nonnull)(NSError * _Nonnull))reject {
47
+  if (![RNPermissions isBackgroundModeEnabled:@"bluetooth-peripheral"]) {
45 48
     return resolve(RNPermissionStatusNotAvailable);
46 49
   }
47 50
 
@@ -71,7 +74,7 @@
71 74
     case CBManagerStateUnauthorized:
72 75
       return _resolve(RNPermissionStatusDenied);
73 76
     case CBManagerStatePoweredOn:
74
-      return [self checkWithResolver:_resolve withRejecter:_reject];
77
+      return [self checkWithResolver:_resolve rejecter:_reject];
75 78
   }
76 79
 }
77 80
 

+ 19
- 0
ios/Calendars.podspec View File

@@ -0,0 +1,19 @@
1
+require 'json'
2
+package = JSON.parse(File.read('../package.json'))
3
+
4
+Pod::Spec.new do |s|
5
+  s.name            = "Permission-Calendars"
6
+  s.dependency        "RNPermissions"
7
+
8
+  s.version         = package["version"]
9
+  s.license         = package["license"]
10
+  s.summary         = package["description"]
11
+  s.authors         = package["author"]
12
+  s.homepage        = package["homepage"]
13
+
14
+  s.platform        = :ios, "9.0"
15
+  s.requires_arc    = true
16
+
17
+  s.source          = { :git => s.homepage, :tag => s.version }
18
+  s.source_files           = "Calendars/*.{h,m}"
19
+end

ios/PermissionHandlers/Calendars/RNPermissionHandlerCalendars.h → ios/Calendars/RNPermissionHandlerCalendars.h View File

@@ -1,4 +1,4 @@
1
-#import "RNPermissionsManager.h"
1
+#import "RNPermissions.h"
2 2
 
3 3
 @interface RNPermissionHandlerCalendars : NSObject<RNPermissionHandler>
4 4
 

ios/PermissionHandlers/Calendars/RNPermissionHandlerCalendars.m → ios/Calendars/RNPermissionHandlerCalendars.m View File

@@ -4,12 +4,16 @@
4 4
 
5 5
 @implementation RNPermissionHandlerCalendars
6 6
 
7
-+ (NSArray<NSString *> *)usageDescriptionKeys {
7
++ (NSArray<NSString *> * _Nonnull)usageDescriptionKeys {
8 8
   return @[@"NSCalendarsUsageDescription"];
9 9
 }
10 10
 
11
-- (void)checkWithResolver:(void (^)(RNPermissionStatus status))resolve
12
-             withRejecter:(void (__unused ^)(NSError *error))reject {
11
++ (NSString * _Nonnull)handlerUniqueId {
12
+  return @"ios.permission.CALENDARS";
13
+}
14
+
15
+- (void)checkWithResolver:(void (^ _Nonnull)(RNPermissionStatus))resolve
16
+                 rejecter:(void (__unused ^ _Nonnull)(NSError * _Nonnull))reject {
13 17
   switch ([EKEventStore authorizationStatusForEntityType:EKEntityTypeEvent]) {
14 18
     case EKAuthorizationStatusNotDetermined:
15 19
       return resolve(RNPermissionStatusNotDetermined);
@@ -22,14 +26,14 @@
22 26
   }
23 27
 }
24 28
 
25
-- (void)requestWithOptions:(__unused NSDictionary * _Nullable)options
26
-              withResolver:(void (^)(RNPermissionStatus status))resolve
27
-              withRejecter:(void (^)(NSError *error))reject {
28
-  [[EKEventStore new] requestAccessToEntityType:EKEntityTypeEvent completion:^(__unused BOOL granted, NSError * _Nullable error) {
29
+- (void)requestWithResolver:(void (^ _Nonnull)(RNPermissionStatus))resolve
30
+                   rejecter:(void (^ _Nonnull)(NSError * _Nonnull))reject {
31
+  [[EKEventStore new] requestAccessToEntityType:EKEntityTypeEvent
32
+                                     completion:^(__unused BOOL granted, NSError * _Nullable error) {
29 33
     if (error != nil) {
30 34
       reject(error);
31 35
     } else {
32
-      [self checkWithResolver:resolve withRejecter:reject];
36
+      [self checkWithResolver:resolve rejecter:reject];
33 37
     }
34 38
   }];
35 39
 }

+ 19
- 0
ios/Camera.podspec View File

@@ -0,0 +1,19 @@
1
+require 'json'
2
+package = JSON.parse(File.read('../package.json'))
3
+
4
+Pod::Spec.new do |s|
5
+  s.name            = "Permission-Camera"
6
+  s.dependency        "RNPermissions"
7
+
8
+  s.version         = package["version"]
9
+  s.license         = package["license"]
10
+  s.summary         = package["description"]
11
+  s.authors         = package["author"]
12
+  s.homepage        = package["homepage"]
13
+
14
+  s.platform        = :ios, "9.0"
15
+  s.requires_arc    = true
16
+
17
+  s.source          = { :git => s.homepage, :tag => s.version }
18
+  s.source_files           = "Camera/*.{h,m}"
19
+end

ios/PermissionHandlers/Camera/RNPermissionHandlerCamera.h → ios/Camera/RNPermissionHandlerCamera.h View File

@@ -1,4 +1,4 @@
1
-#import "RNPermissionsManager.h"
1
+#import "RNPermissions.h"
2 2
 
3 3
 @interface RNPermissionHandlerCamera : NSObject<RNPermissionHandler>
4 4
 

+ 37
- 0
ios/Camera/RNPermissionHandlerCamera.m View File

@@ -0,0 +1,37 @@
1
+#import "RNPermissionHandlerCamera.h"
2
+
3
+@import AVFoundation;
4
+
5
+@implementation RNPermissionHandlerCamera
6
+
7
++ (NSArray<NSString *> * _Nonnull)usageDescriptionKeys {
8
+  return @[@"NSCameraUsageDescription"];
9
+}
10
+
11
++ (NSString * _Nonnull)handlerUniqueId {
12
+  return @"ios.permission.CAMERA";
13
+}
14
+
15
+- (void)checkWithResolver:(void (^ _Nonnull)(RNPermissionStatus))resolve
16
+                 rejecter:(void (__unused ^ _Nonnull)(NSError * _Nonnull))reject {
17
+  switch ([AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo]) {
18
+    case AVAuthorizationStatusNotDetermined:
19
+      return resolve(RNPermissionStatusNotDetermined);
20
+    case AVAuthorizationStatusRestricted:
21
+      return resolve(RNPermissionStatusRestricted);
22
+    case AVAuthorizationStatusDenied:
23
+      return resolve(RNPermissionStatusDenied);
24
+    case AVAuthorizationStatusAuthorized:
25
+      return resolve(RNPermissionStatusAuthorized);
26
+  }
27
+}
28
+
29
+- (void)requestWithResolver:(void (^ _Nonnull)(RNPermissionStatus))resolve
30
+                   rejecter:(void (^ _Nonnull)(NSError * _Nonnull))reject {
31
+  [AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo
32
+                           completionHandler:^(__unused BOOL granted) {
33
+    [self checkWithResolver:resolve rejecter:reject];
34
+  }];
35
+}
36
+
37
+@end

+ 19
- 0
ios/Contacts.podspec View File

@@ -0,0 +1,19 @@
1
+require 'json'
2
+package = JSON.parse(File.read('../package.json'))
3
+
4
+Pod::Spec.new do |s|
5
+  s.name            = "Permission-Contacts"
6
+  s.dependency        "RNPermissions"
7
+
8
+  s.version         = package["version"]
9
+  s.license         = package["license"]
10
+  s.summary         = package["description"]
11
+  s.authors         = package["author"]
12
+  s.homepage        = package["homepage"]
13
+
14
+  s.platform        = :ios, "9.0"
15
+  s.requires_arc    = true
16
+
17
+  s.source          = { :git => s.homepage, :tag => s.version }
18
+  s.source_files           = "Contacts/*.{h,m}"
19
+end

ios/PermissionHandlers/Contacts/RNPermissionHandlerContacts.h → ios/Contacts/RNPermissionHandlerContacts.h View File

@@ -1,4 +1,4 @@
1
-#import "RNPermissionsManager.h"
1
+#import "RNPermissions.h"
2 2
 
3 3
 @interface RNPermissionHandlerContacts : NSObject<RNPermissionHandler>
4 4
 

ios/PermissionHandlers/Contacts/RNPermissionHandlerContacts.m → ios/Contacts/RNPermissionHandlerContacts.m View File

@@ -4,12 +4,16 @@
4 4
 
5 5
 @implementation RNPermissionHandlerContacts
6 6
 
7
-+ (NSArray<NSString *> *)usageDescriptionKeys {
7
++ (NSArray<NSString *> * _Nonnull)usageDescriptionKeys {
8 8
   return @[@"NSContactsUsageDescription"];
9 9
 }
10 10
 
11
-- (void)checkWithResolver:(void (^)(RNPermissionStatus status))resolve
12
-             withRejecter:(void (__unused ^)(NSError *error))reject {
11
++ (NSString * _Nonnull)handlerUniqueId {
12
+  return @"ios.permission.CONTACTS";
13
+}
14
+
15
+- (void)checkWithResolver:(void (^ _Nonnull)(RNPermissionStatus))resolve
16
+                 rejecter:(void (__unused ^ _Nonnull)(NSError * _Nonnull))reject {
13 17
   switch ([CNContactStore authorizationStatusForEntityType:CNEntityTypeContacts]) {
14 18
     case CNAuthorizationStatusNotDetermined:
15 19
       return resolve(RNPermissionStatusNotDetermined);
@@ -22,14 +26,14 @@
22 26
   }
23 27
 }
24 28
 
25
-- (void)requestWithOptions:(__unused NSDictionary * _Nullable)options
26
-              withResolver:(void (^)(RNPermissionStatus status))resolve
27
-              withRejecter:(void (^)(NSError *error))reject {
28
-  [[CNContactStore new] requestAccessForEntityType:CNEntityTypeContacts completionHandler:^(__unused BOOL granted, NSError * _Nullable error) {
29
-    if (error != nil && error.code != 100) {
29
+- (void)requestWithResolver:(void (^ _Nonnull)(RNPermissionStatus))resolve
30
+                   rejecter:(void (^ _Nonnull)(NSError * _Nonnull))reject {
31
+  [[CNContactStore new] requestAccessForEntityType:CNEntityTypeContacts
32
+                                 completionHandler:^(__unused BOOL granted, NSError * _Nullable error) {
33
+    if (error != nil && error.code != 100) { // error code 100 is permission denied
30 34
       reject(error);
31 35
     } else {
32
-      [self checkWithResolver:resolve withRejecter:reject];
36
+      [self checkWithResolver:resolve rejecter:reject];
33 37
     }
34 38
   }];
35 39
 }

+ 19
- 0
ios/FaceID.podspec View File

@@ -0,0 +1,19 @@
1
+require 'json'
2
+package = JSON.parse(File.read('../package.json'))
3
+
4
+Pod::Spec.new do |s|
5
+  s.name            = "Permission-FaceID"
6
+  s.dependency        "RNPermissions"
7
+
8
+  s.version         = package["version"]
9
+  s.license         = package["license"]
10
+  s.summary         = package["description"]
11
+  s.authors         = package["author"]
12
+  s.homepage        = package["homepage"]
13
+
14
+  s.platform        = :ios, "9.0"
15
+  s.requires_arc    = true
16
+
17
+  s.source          = { :git => s.homepage, :tag => s.version }
18
+  s.source_files           = "FaceID/*.{h,m}"
19
+end

ios/PermissionHandlers/FaceID/RNPermissionHandlerFaceID.h → ios/FaceID/RNPermissionHandlerFaceID.h View File

@@ -1,4 +1,4 @@
1
-#import "RNPermissionsManager.h"
1
+#import "RNPermissions.h"
2 2
 
3 3
 @interface RNPermissionHandlerFaceID : NSObject<RNPermissionHandler>
4 4
 

+ 115
- 0
ios/FaceID/RNPermissionHandlerFaceID.m View File

@@ -0,0 +1,115 @@
1
+#import "RNPermissionHandlerFaceID.h"
2
+
3
+@import LocalAuthentication;
4
+@import UIKit;
5
+
6
+@interface RNPermissionHandlerFaceID()
7
+
8
+@property (nonatomic, strong) LAContext *laContext;
9
+@property (nonatomic, strong) void (^resolve)(RNPermissionStatus status);
10
+@property (nonatomic, strong) void (^reject)(NSError *error);
11
+
12
+@end
13
+
14
+@implementation RNPermissionHandlerFaceID
15
+
16
++ (NSArray<NSString *> * _Nonnull)usageDescriptionKeys {
17
+  return @[@"NSFaceIDUsageDescription"];
18
+}
19
+
20
++ (NSString * _Nonnull)handlerUniqueId {
21
+  return @"ios.permission.FACE_ID";
22
+}
23
+
24
+- (void)checkWithResolver:(void (^ _Nonnull)(RNPermissionStatus))resolve
25
+                 rejecter:(void (^ _Nonnull)(NSError * _Nonnull))reject {
26
+  if (@available(iOS 11.0.1, *)) {
27
+    LAContext *context = [LAContext new];
28
+    NSError *error;
29
+
30
+    [context canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&error];
31
+    bool hasFaceID = context.biometryType == LABiometryTypeFaceID;
32
+
33
+    if (!hasFaceID) {
34
+      return resolve(RNPermissionStatusNotAvailable);
35
+    }
36
+
37
+    if (error != nil) {
38
+      if (error.code == LAErrorBiometryNotEnrolled)
39
+        return resolve(RNPermissionStatusNotAvailable);
40
+      if (error.code != LAErrorBiometryNotAvailable)
41
+        return reject(error);
42
+      if (hasFaceID)
43
+        return resolve(RNPermissionStatusDenied);
44
+
45
+      return resolve(RNPermissionStatusNotAvailable);
46
+    }
47
+
48
+    if (![RNPermissions hasAlreadyBeenRequested:self]) {
49
+      return resolve(RNPermissionStatusNotDetermined);
50
+    }
51
+
52
+    resolve(RNPermissionStatusAuthorized);
53
+  } else {
54
+    resolve(RNPermissionStatusNotAvailable);
55
+  }
56
+}
57
+
58
+- (void)requestWithResolver:(void (^ _Nonnull)(RNPermissionStatus))resolve
59
+                   rejecter:(void (^ _Nonnull)(NSError * _Nonnull))reject {
60
+  if (@available(iOS 11.0.1, *)) {
61
+    LAContext *context = [LAContext new];
62
+    NSError *error;
63
+
64
+    [context canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&error];
65
+    bool hasFaceID = context.biometryType == LABiometryTypeFaceID;
66
+
67
+    if (!hasFaceID) {
68
+      return resolve(RNPermissionStatusNotAvailable);
69
+    }
70
+
71
+    if (error != nil) {
72
+      if (error.code == LAErrorBiometryNotEnrolled)
73
+        return resolve(RNPermissionStatusNotAvailable);
74
+      if (error.code != LAErrorBiometryNotAvailable)
75
+        return reject(error);
76
+      if (hasFaceID)
77
+        return resolve(RNPermissionStatusDenied);
78
+
79
+      return resolve(RNPermissionStatusNotAvailable);
80
+    }
81
+
82
+    _resolve = resolve;
83
+    _reject = reject;
84
+    _laContext = context;
85
+
86
+    [[NSNotificationCenter defaultCenter] addObserver:self
87
+                                             selector:@selector(UIApplicationDidBecomeActiveNotification:)
88
+                                                 name:UIApplicationDidBecomeActiveNotification
89
+                                               object:nil];
90
+
91
+    [context evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics
92
+            localizedReason:[[NSBundle mainBundle] objectForInfoDictionaryKey:@"NSFaceIDUsageDescription"]
93
+                      reply:^(__unused BOOL success, __unused NSError * _Nullable error) {}];
94
+
95
+    // Hack to invalidate FaceID verification immediately after being requested
96
+    [self performSelector:@selector(invalidateContext) withObject:self afterDelay:0.015];
97
+  } else {
98
+    resolve(RNPermissionStatusNotAvailable);
99
+  }
100
+}
101
+
102
+- (void)invalidateContext {
103
+  [_laContext invalidate];
104
+  _laContext = nil;
105
+}
106
+
107
+- (void)UIApplicationDidBecomeActiveNotification:(__unused NSNotification *)notification {
108
+  [[NSNotificationCenter defaultCenter] removeObserver:self
109
+                                                  name:UIApplicationDidBecomeActiveNotification
110
+                                                object:nil];
111
+
112
+  [self checkWithResolver:_resolve rejecter:_reject];
113
+}
114
+
115
+@end

+ 19
- 0
ios/LocationAlways.podspec View File

@@ -0,0 +1,19 @@
1
+require 'json'
2
+package = JSON.parse(File.read('../package.json'))
3
+
4
+Pod::Spec.new do |s|
5
+  s.name            = "Permission-LocationAlways"
6
+  s.dependency        "RNPermissions"
7
+
8
+  s.version         = package["version"]
9
+  s.license         = package["license"]
10
+  s.summary         = package["description"]
11
+  s.authors         = package["author"]
12
+  s.homepage        = package["homepage"]
13
+
14
+  s.platform        = :ios, "9.0"
15
+  s.requires_arc    = true
16
+
17
+  s.source          = { :git => s.homepage, :tag => s.version }
18
+  s.source_files           = "LocationAlways/*.{h,m}"
19
+end

ios/PermissionHandlers/LocationAlways/RNPermissionHandlerLocationAlways.h → ios/LocationAlways/RNPermissionHandlerLocationAlways.h View File

@@ -1,4 +1,4 @@
1
-#import "RNPermissionsManager.h"
1
+#import "RNPermissions.h"
2 2
 
3 3
 @interface RNPermissionHandlerLocationAlways : NSObject<RNPermissionHandler>
4 4
 

+ 107
- 0
ios/LocationAlways/RNPermissionHandlerLocationAlways.m View File

@@ -0,0 +1,107 @@
1
+#import "RNPermissionHandlerLocationAlways.h"
2
+
3
+@import CoreLocation;
4
+@import UIKit;
5
+
6
+@interface RNPermissionHandlerLocationAlways() <CLLocationManagerDelegate>
7
+
8
+@property (nonatomic, strong) CLLocationManager *locationManager;
9
+@property (nonatomic) bool initialChangeEventFired;
10
+@property (nonatomic) bool isWaitingDidBecomeActive;
11
+@property (nonatomic, strong) void (^resolve)(RNPermissionStatus status);
12
+@property (nonatomic, strong) void (^reject)(NSError *error);
13
+
14
+@end
15
+
16
+@implementation RNPermissionHandlerLocationAlways
17
+
18
++ (NSArray<NSString *> * _Nonnull)usageDescriptionKeys {
19
+  return @[
20
+    @"NSLocationAlwaysAndWhenInUseUsageDescription",
21
+    @"NSLocationAlwaysUsageDescription",
22
+    @"NSLocationWhenInUseUsageDescription",
23
+  ];
24
+}
25
+
26
++ (NSString * _Nonnull)handlerUniqueId {
27
+  return @"ios.permission.LOCATION_ALWAYS";
28
+}
29
+
30
+- (void)checkWithResolver:(void (^ _Nonnull)(RNPermissionStatus))resolve
31
+                 rejecter:(void (__unused ^ _Nonnull)(NSError * _Nonnull))reject {
32
+  if (![CLLocationManager locationServicesEnabled] || ![RNPermissions isBackgroundModeEnabled:@"location"]) {
33
+    return resolve(RNPermissionStatusNotAvailable);
34
+  }
35
+
36
+  switch ([CLLocationManager authorizationStatus]) {
37
+    case kCLAuthorizationStatusNotDetermined:
38
+      return resolve(RNPermissionStatusNotDetermined);
39
+    case kCLAuthorizationStatusRestricted:
40
+      return resolve(RNPermissionStatusRestricted);
41
+    case kCLAuthorizationStatusAuthorizedWhenInUse:
42
+    case kCLAuthorizationStatusDenied:
43
+      return resolve(RNPermissionStatusDenied);
44
+    case kCLAuthorizationStatusAuthorizedAlways:
45
+      return resolve(RNPermissionStatusAuthorized);
46
+  }
47
+}
48
+
49
+- (void)requestWithResolver:(void (^ _Nonnull)(RNPermissionStatus))resolve
50
+                   rejecter:(void (^ _Nonnull)(NSError * _Nonnull))reject {
51
+  if (![CLLocationManager locationServicesEnabled] || ![RNPermissions isBackgroundModeEnabled:@"location"]) {
52
+    return resolve(RNPermissionStatusNotAvailable);
53
+  }
54
+
55
+  CLAuthorizationStatus status = [CLLocationManager authorizationStatus];
56
+
57
+  if (status == kCLAuthorizationStatusAuthorizedAlways) {
58
+    return resolve(RNPermissionStatusAuthorized);
59
+  }
60
+
61
+  _resolve = resolve;
62
+  _reject = reject;
63
+  _initialChangeEventFired = false;
64
+  _isWaitingDidBecomeActive = false;
65
+
66
+  if (status == kCLAuthorizationStatusAuthorizedWhenInUse && ![RNPermissions hasAlreadyBeenRequested:self]) {
67
+    _isWaitingDidBecomeActive = true;
68
+
69
+    [[NSNotificationCenter defaultCenter] addObserver:self
70
+                                             selector:@selector(UIApplicationDidBecomeActiveNotification:)
71
+                                                 name:UIApplicationDidBecomeActiveNotification object:nil];
72
+  }
73
+
74
+  _locationManager = [CLLocationManager new];
75
+  [_locationManager setDelegate:self];
76
+  [_locationManager requestAlwaysAuthorization];
77
+}
78
+
79
+- (void)onAuthorizationStatus {
80
+  [self checkWithResolver:_resolve rejecter:_reject];
81
+
82
+  [_locationManager setDelegate:nil];
83
+  _locationManager = nil;
84
+
85
+  if (_isWaitingDidBecomeActive) {
86
+    [[NSNotificationCenter defaultCenter] removeObserver:self
87
+                                                    name:UIApplicationDidBecomeActiveNotification
88
+                                                  object:nil];
89
+  }
90
+}
91
+
92
+- (void)UIApplicationDidBecomeActiveNotification:(NSNotification *)notification {
93
+  if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusAuthorizedWhenInUse) {
94
+    [self onAuthorizationStatus];
95
+  }
96
+}
97
+
98
+- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status {
99
+  // @see https://github.com/iosphere/ISHPermissionKit/blob/2.1.2/ISHPermissionKit/Requests/ISHPermissionRequestLocation.m#L127
100
+  if (status != kCLAuthorizationStatusNotDetermined && _initialChangeEventFired) {
101
+    [self onAuthorizationStatus];
102
+  } else {
103
+    _initialChangeEventFired = true;
104
+  }
105
+}
106
+
107
+@end

+ 19
- 0
ios/LocationWhenInUse.podspec View File

@@ -0,0 +1,19 @@
1
+require 'json'
2
+package = JSON.parse(File.read('../package.json'))
3
+
4
+Pod::Spec.new do |s|
5
+  s.name            = "Permission-LocationWhenInUse"
6
+  s.dependency        "RNPermissions"
7
+
8
+  s.version         = package["version"]
9
+  s.license         = package["license"]
10
+  s.summary         = package["description"]
11
+  s.authors         = package["author"]
12
+  s.homepage        = package["homepage"]
13
+
14
+  s.platform        = :ios, "9.0"
15
+  s.requires_arc    = true
16
+
17
+  s.source          = { :git => s.homepage, :tag => s.version }
18
+  s.source_files           = "LocationWhenInUse/*.{h,m}"
19
+end

ios/PermissionHandlers/LocationWhenInUse/RNPermissionHandlerLocationWhenInUse.h → ios/LocationWhenInUse/RNPermissionHandlerLocationWhenInUse.h View File

@@ -1,4 +1,4 @@
1
-#import "RNPermissionsManager.h"
1
+#import "RNPermissions.h"
2 2
 
3 3
 @interface RNPermissionHandlerLocationWhenInUse : NSObject<RNPermissionHandler>
4 4
 

+ 78
- 0
ios/LocationWhenInUse/RNPermissionHandlerLocationWhenInUse.m View File

@@ -0,0 +1,78 @@
1
+#import "RNPermissionHandlerLocationWhenInUse.h"
2
+
3
+@import CoreLocation;
4
+
5
+@interface RNPermissionHandlerLocationWhenInUse() <CLLocationManagerDelegate>
6
+
7
+@property (nonatomic, strong) CLLocationManager *locationManager;
8
+@property (nonatomic) bool initialChangeEventFired;
9
+@property (nonatomic, strong) void (^resolve)(RNPermissionStatus status);
10
+@property (nonatomic, strong) void (^reject)(NSError *error);
11
+
12
+@end
13
+
14
+@implementation RNPermissionHandlerLocationWhenInUse
15
+
16
++ (NSArray<NSString *> * _Nonnull)usageDescriptionKeys {
17
+  return @[@"NSLocationWhenInUseUsageDescription"];
18
+}
19
+
20
++ (NSString * _Nonnull)handlerUniqueId {
21
+  return @"ios.permission.LOCATION_WHEN_IN_USE";
22
+}
23
+
24
+- (void)checkWithResolver:(void (^ _Nonnull)(RNPermissionStatus))resolve
25
+                 rejecter:(void (__unused ^ _Nonnull)(NSError * _Nonnull))reject {
26
+  if (![CLLocationManager locationServicesEnabled]) {
27
+    return resolve(RNPermissionStatusNotAvailable);
28
+  }
29
+
30
+  switch ([CLLocationManager authorizationStatus]) {
31
+    case kCLAuthorizationStatusNotDetermined:
32
+      return resolve(RNPermissionStatusNotDetermined);
33
+    case kCLAuthorizationStatusRestricted:
34
+      return resolve(RNPermissionStatusRestricted);
35
+    case kCLAuthorizationStatusDenied:
36
+      return resolve(RNPermissionStatusDenied);
37
+    case kCLAuthorizationStatusAuthorizedWhenInUse:
38
+    case kCLAuthorizationStatusAuthorizedAlways:
39
+      return resolve(RNPermissionStatusAuthorized);
40
+  }
41
+}
42
+
43
+- (void)requestWithResolver:(void (^ _Nonnull)(RNPermissionStatus))resolve
44
+                   rejecter:(void (^ _Nonnull)(NSError * _Nonnull))reject {
45
+  if (![CLLocationManager locationServicesEnabled]) {
46
+    return resolve(RNPermissionStatusNotAvailable);
47
+  }
48
+
49
+  if ([CLLocationManager authorizationStatus] != kCLAuthorizationStatusNotDetermined) {
50
+    return [self checkWithResolver:resolve rejecter:reject];
51
+  }
52
+
53
+  _resolve = resolve;
54
+  _reject = reject;
55
+  _initialChangeEventFired = false;
56
+
57
+  _locationManager = [CLLocationManager new];
58
+  [_locationManager setDelegate:self];
59
+  [_locationManager requestWhenInUseAuthorization];
60
+}
61
+
62
+- (void)onAuthorizationStatus {
63
+  [self checkWithResolver:_resolve rejecter:_reject];
64
+
65
+  [_locationManager setDelegate:nil];
66
+  _locationManager = nil;
67
+}
68
+
69
+- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status {
70
+  // @see https://github.com/iosphere/ISHPermissionKit/blob/2.1.2/ISHPermissionKit/Requests/ISHPermissionRequestLocation.m#L127
71
+  if (status != kCLAuthorizationStatusNotDetermined && _initialChangeEventFired) {
72
+    [self onAuthorizationStatus];
73
+  } else {
74
+    _initialChangeEventFired = true;
75
+  }
76
+}
77
+
78
+@end

+ 19
- 0
ios/MediaLibrary.podspec View File

@@ -0,0 +1,19 @@
1
+require 'json'
2
+package = JSON.parse(File.read('../package.json'))
3
+
4
+Pod::Spec.new do |s|
5
+  s.name            = "Permission-MediaLibrary"
6
+  s.dependency        "RNPermissions"
7
+
8
+  s.version         = package["version"]
9
+  s.license         = package["license"]
10
+  s.summary         = package["description"]
11
+  s.authors         = package["author"]
12
+  s.homepage        = package["homepage"]
13
+
14
+  s.platform        = :ios, "9.0"
15
+  s.requires_arc    = true
16
+
17
+  s.source          = { :git => s.homepage, :tag => s.version }
18
+  s.source_files           = "MediaLibrary/*.{h,m}"
19
+end

ios/PermissionHandlers/MediaLibrary/RNPermissionHandlerMediaLibrary.h → ios/MediaLibrary/RNPermissionHandlerMediaLibrary.h View File

@@ -1,4 +1,4 @@
1
-#import "RNPermissionsManager.h"
1
+#import "RNPermissions.h"
2 2
 
3 3
 @interface RNPermissionHandlerMediaLibrary : NSObject<RNPermissionHandler>
4 4
 

ios/PermissionHandlers/MediaLibrary/RNPermissionHandlerMediaLibrary.m → ios/MediaLibrary/RNPermissionHandlerMediaLibrary.m View File

@@ -4,12 +4,19 @@
4 4
 
5 5
 @implementation RNPermissionHandlerMediaLibrary
6 6
 
7
-+ (NSArray<NSString *> *)usageDescriptionKeys {
7
++ (NSArray<NSString *> * _Nonnull)usageDescriptionKeys {
8 8
   return @[@"NSAppleMusicUsageDescription"];
9 9
 }
10 10
 
11
-- (void)checkWithResolver:(void (^)(RNPermissionStatus status))resolve
12
-             withRejecter:(void (__unused ^)(NSError *error))reject {
11
++ (NSString * _Nonnull)handlerUniqueId {
12
+  return @"ios.permission.MEDIA_LIBRARY";
13
+}
14
+
15
+- (void)checkWithResolver:(void (^ _Nonnull)(RNPermissionStatus))resolve
16
+                 rejecter:(void (__unused ^ _Nonnull)(NSError * _Nonnull))reject {
17
+#if TARGET_OS_SIMULATOR
18
+  resolve(RNPermissionStatusNotAvailable);
19
+#else
13 20
   if (@available(iOS 9.3, *)) {
14 21
     switch ([MPMediaLibrary authorizationStatus]) {
15 22
       case MPMediaLibraryAuthorizationStatusNotDetermined:
@@ -24,18 +31,22 @@
24 31
   } else {
25 32
     resolve(RNPermissionStatusAuthorized);
26 33
   }
34
+#endif
27 35
 }
28 36
 
29
-- (void)requestWithOptions:(__unused NSDictionary * _Nullable)options
30
-              withResolver:(void (^)(RNPermissionStatus status))resolve
31
-              withRejecter:(void (^)(NSError *error))reject {
37
+- (void)requestWithResolver:(void (^ _Nonnull)(RNPermissionStatus))resolve
38
+                   rejecter:(void (^ _Nonnull)(NSError * _Nonnull))reject {
39
+#if TARGET_OS_SIMULATOR
40
+  resolve(RNPermissionStatusNotAvailable);
41
+#else
32 42
   if (@available(iOS 9.3, *)) {
33 43
     [MPMediaLibrary requestAuthorization:^(__unused MPMediaLibraryAuthorizationStatus status) {
34
-      [self checkWithResolver:resolve withRejecter:reject];
44
+      [self checkWithResolver:resolve rejecter:reject];
35 45
     }];
36 46
   } else {
37 47
     resolve(RNPermissionStatusAuthorized);
38 48
   }
49
+#endif
39 50
 }
40 51
 
41 52
 @end

+ 19
- 0
ios/Microphone.podspec View File

@@ -0,0 +1,19 @@
1
+require 'json'
2
+package = JSON.parse(File.read('../package.json'))
3
+
4
+Pod::Spec.new do |s|
5
+  s.name            = "Permission-Microphone"
6
+  s.dependency        "RNPermissions"
7
+
8
+  s.version         = package["version"]
9
+  s.license         = package["license"]
10
+  s.summary         = package["description"]
11
+  s.authors         = package["author"]
12
+  s.homepage        = package["homepage"]
13
+
14
+  s.platform        = :ios, "9.0"
15
+  s.requires_arc    = true
16
+
17
+  s.source          = { :git => s.homepage, :tag => s.version }
18
+  s.source_files           = "Microphone/*.{h,m}"
19
+end

ios/PermissionHandlers/Microphone/RNPermissionHandlerMicrophone.h → ios/Microphone/RNPermissionHandlerMicrophone.h View File

@@ -1,4 +1,4 @@
1
-#import "RNPermissionsManager.h"
1
+#import "RNPermissions.h"
2 2
 
3 3
 @interface RNPermissionHandlerMicrophone : NSObject<RNPermissionHandler>
4 4
 

ios/PermissionHandlers/Microphone/RNPermissionHandlerMicrophone.m → ios/Microphone/RNPermissionHandlerMicrophone.m View File

@@ -4,12 +4,16 @@
4 4
 
5 5
 @implementation RNPermissionHandlerMicrophone
6 6
 
7
-+ (NSArray<NSString *> *)usageDescriptionKeys {
7
++ (NSArray<NSString *> * _Nonnull)usageDescriptionKeys {
8 8
   return @[@"NSMicrophoneUsageDescription"];
9 9
 }
10 10
 
11
-- (void)checkWithResolver:(void (^)(RNPermissionStatus status))resolve
12
-             withRejecter:(void (__unused ^)(NSError *error))reject {
11
++ (NSString * _Nonnull)handlerUniqueId {
12
+  return @"ios.permission.MICROPHONE";
13
+}
14
+
15
+- (void)checkWithResolver:(void (^ _Nonnull)(RNPermissionStatus))resolve
16
+                 rejecter:(void (__unused ^ _Nonnull)(NSError * _Nonnull))reject {
13 17
   switch ([AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeAudio]) {
14 18
     case AVAuthorizationStatusNotDetermined:
15 19
       return resolve(RNPermissionStatusNotDetermined);
@@ -22,11 +26,11 @@
22 26
   }
23 27
 }
24 28
 
25
-- (void)requestWithOptions:(__unused NSDictionary * _Nullable)options
26
-              withResolver:(void (^)(RNPermissionStatus status))resolve
27
-              withRejecter:(void (^)(NSError *error))reject {
28
-  [AVCaptureDevice requestAccessForMediaType:AVMediaTypeAudio completionHandler:^(__unused BOOL granted) {
29
-    [self checkWithResolver:resolve withRejecter:reject];
29
+- (void)requestWithResolver:(void (^ _Nonnull)(RNPermissionStatus))resolve
30
+                   rejecter:(void (^ _Nonnull)(NSError * _Nonnull))reject {
31
+  [AVCaptureDevice requestAccessForMediaType:AVMediaTypeAudio
32
+                           completionHandler:^(__unused BOOL granted) {
33
+    [self checkWithResolver:resolve rejecter:reject];
30 34
   }];
31 35
 }
32 36
 

+ 19
- 0
ios/Motion.podspec View File

@@ -0,0 +1,19 @@
1
+require 'json'
2
+package = JSON.parse(File.read('../package.json'))
3
+
4
+Pod::Spec.new do |s|
5
+  s.name            = "Permission-Motion"
6
+  s.dependency        "RNPermissions"
7
+
8
+  s.version         = package["version"]
9
+  s.license         = package["license"]
10
+  s.summary         = package["description"]
11
+  s.authors         = package["author"]
12
+  s.homepage        = package["homepage"]
13
+
14
+  s.platform        = :ios, "9.0"
15
+  s.requires_arc    = true
16
+
17
+  s.source          = { :git => s.homepage, :tag => s.version }
18
+  s.source_files           = "Motion/*.{h,m}"
19
+end

ios/PermissionHandlers/Motion/RNPermissionHandlerMotion.h → ios/Motion/RNPermissionHandlerMotion.h View File

@@ -1,4 +1,4 @@
1
-#import "RNPermissionsManager.h"
1
+#import "RNPermissions.h"
2 2
 
3 3
 @interface RNPermissionHandlerMotion : NSObject<RNPermissionHandler>
4 4
 

+ 79
- 0
ios/Motion/RNPermissionHandlerMotion.m View File

@@ -0,0 +1,79 @@
1
+#import "RNPermissionHandlerMotion.h"
2
+
3
+@import CoreMotion;
4
+
5
+@interface RNPermissionHandlerMotion()
6
+
7
+@property (nonatomic, strong) CMMotionActivityManager *activityManager;
8
+@property (nonatomic, strong) NSOperationQueue *operationQueue;
9
+
10
+@end
11
+
12
+@implementation RNPermissionHandlerMotion
13
+
14
++ (NSArray<NSString *> * _Nonnull)usageDescriptionKeys {
15
+  return @[@"NSMotionUsageDescription"];
16
+}
17
+
18
++ (NSString * _Nonnull)handlerUniqueId {
19
+  return @"ios.permission.MOTION";
20
+}
21
+
22
+- (void)checkWithResolver:(void (^ _Nonnull)(RNPermissionStatus))resolve
23
+                 rejecter:(void (^ _Nonnull)(NSError * _Nonnull))reject {
24
+  if (![CMMotionActivityManager isActivityAvailable]) {
25
+    return resolve(RNPermissionStatusNotAvailable);
26
+  }
27
+
28
+  if (@available(iOS 11.0, *)) {
29
+    switch ([CMMotionActivityManager authorizationStatus]) {
30
+      case CMAuthorizationStatusNotDetermined:
31
+        return resolve(RNPermissionStatusNotDetermined);
32
+      case CMAuthorizationStatusRestricted:
33
+        return resolve(RNPermissionStatusRestricted);
34
+      case CMAuthorizationStatusDenied:
35
+        return resolve(RNPermissionStatusDenied);
36
+      case CMAuthorizationStatusAuthorized:
37
+        return resolve(RNPermissionStatusAuthorized);
38
+    }
39
+  }
40
+
41
+  if (![RNPermissions hasAlreadyBeenRequested:self]) {
42
+    return resolve(RNPermissionStatusNotDetermined);
43
+  }
44
+
45
+  [self requestWithResolver:resolve rejecter:reject];
46
+}
47
+
48
+- (void)requestWithResolver:(void (^ _Nonnull)(RNPermissionStatus))resolve
49
+                   rejecter:(void (^ _Nonnull)(NSError * _Nonnull))reject {
50
+  if (![CMMotionActivityManager isActivityAvailable]) {
51
+    return resolve(RNPermissionStatusNotAvailable);
52
+  }
53
+
54
+  _activityManager = [CMMotionActivityManager new];
55
+  _operationQueue = [NSOperationQueue new];
56
+
57
+  [_activityManager queryActivityStartingFromDate:[NSDate distantPast]
58
+                                           toDate:[NSDate date]
59
+                                          toQueue:_operationQueue
60
+                                      withHandler:^(NSArray<CMMotionActivity *> * _Nullable activities, NSError * _Nullable error) {
61
+    if (error != nil) {
62
+      if (error.code != CMErrorNotAuthorized &&
63
+          error.code != CMErrorMotionActivityNotAuthorized) {
64
+        reject(error);
65
+      } else {
66
+        resolve(RNPermissionStatusDenied);
67
+      }
68
+    } else if (activities) {
69
+      resolve(RNPermissionStatusAuthorized);
70
+    } else {
71
+      resolve(RNPermissionStatusNotDetermined);
72
+    }
73
+
74
+    self->_operationQueue = nil;
75
+    self->_activityManager = nil;
76
+  }];
77
+}
78
+
79
+@end

+ 19
- 0
ios/Notifications.podspec View File

@@ -0,0 +1,19 @@
1
+require 'json'
2
+package = JSON.parse(File.read('../package.json'))
3
+
4
+Pod::Spec.new do |s|
5
+  s.name            = "Permission-Notifications"
6
+  s.dependency        "RNPermissions"
7
+
8
+  s.version         = package["version"]
9
+  s.license         = package["license"]
10
+  s.summary         = package["description"]
11
+  s.authors         = package["author"]
12
+  s.homepage        = package["homepage"]
13
+
14
+  s.platform        = :ios, "9.0"
15
+  s.requires_arc    = true
16
+
17
+  s.source          = { :git => s.homepage, :tag => s.version }
18
+  s.source_files           = "Notifications/*.{h,m}"
19
+end

+ 7
- 0
ios/Notifications/RNPermissionHandlerNotifications.h View File

@@ -0,0 +1,7 @@
1
+#import "RNPermissions.h"
2
+
3
+@interface RNPermissionHandlerNotifications : NSObject<RNPermissionHandler, RNPermissionWithRequestOptions>
4
+
5
+- (void)getSettingsWithResolver:(void (^ _Nonnull)(NSDictionary * _Nonnull settings))resolve;
6
+
7
+@end

+ 183
- 0
ios/Notifications/RNPermissionHandlerNotifications.m View File

@@ -0,0 +1,183 @@
1
+#import "RNPermissionHandlerNotifications.h"
2
+
3
+@import UserNotifications;
4
+@import UIKit;
5
+
6
+@interface RNPermissionHandlerNotifications()
7
+
8
+@property (nonatomic, strong) void (^resolve)(RNPermissionStatus status);
9
+@property (nonatomic, strong) void (^reject)(NSError *error);
10
+
11
+@end
12
+
13
+@implementation RNPermissionHandlerNotifications
14
+
15
++ (NSArray<NSString *> * _Nonnull)usageDescriptionKeys {
16
+  return @[];
17
+}
18
+
19
++ (NSString * _Nonnull)handlerUniqueId {
20
+  return @"ios.permission.NOTIFICATIONS";
21
+}
22
+
23
+- (void)checkWithResolver:(void (^ _Nonnull)(RNPermissionStatus))resolve
24
+                 rejecter:(void (__unused ^ _Nonnull)(NSError * _Nonnull))reject {
25
+  if (@available(iOS 10.0, *)) {
26
+    UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
27
+
28
+    [center getNotificationSettingsWithCompletionHandler:^(UNNotificationSettings * _Nonnull settings) {
29
+      switch (settings.authorizationStatus) {
30
+        case UNAuthorizationStatusNotDetermined:
31
+#ifdef __IPHONE_12_0
32
+        case UNAuthorizationStatusProvisional:
33
+#endif
34
+          return resolve(RNPermissionStatusNotDetermined);
35
+        case UNAuthorizationStatusDenied:
36
+          return resolve(RNPermissionStatusDenied);
37
+        case UNAuthorizationStatusAuthorized:
38
+          return resolve(RNPermissionStatusAuthorized);
39
+      }
40
+    }];
41
+  } else {
42
+    UIUserNotificationSettings *settings = [[UIApplication sharedApplication] currentUserNotificationSettings];
43
+
44
+    if ([settings types] != UIUserNotificationTypeNone) {
45
+      return resolve(RNPermissionStatusAuthorized);
46
+    } else if ([RNPermissions hasAlreadyBeenRequested:self]) {
47
+      return resolve(RNPermissionStatusDenied);
48
+    } else {
49
+      return resolve(RNPermissionStatusNotDetermined);
50
+    }
51
+  }
52
+}
53
+
54
+- (void)requestWithResolver:(void (^ _Nonnull)(RNPermissionStatus))resolve
55
+                   rejecter:(void (^ _Nonnull)(NSError * _Nonnull))reject {
56
+  NSArray<NSString *> *options = [[NSArray alloc] initWithObjects:@"alert", @"badge", @"sound", nil];
57
+  [self requestWithResolver:resolve rejecter:reject options:options];
58
+}
59
+
60
+- (void)requestWithResolver:(void (^ _Nonnull)(RNPermissionStatus))resolve
61
+                   rejecter:(void (^ _Nonnull)(NSError * _Nonnull))reject
62
+                    options:(NSArray<NSString *> * _Nonnull)options {
63
+  bool alert = [options containsObject:@"alert"];
64
+  bool badge = [options containsObject:@"badge"];
65
+  bool sound = [options containsObject:@"sound"];
66
+  bool criticalAlert = [options containsObject:@"criticalAlert"];
67
+  bool carPlay = [options containsObject:@"carPlay"];
68
+  bool provisional = [options containsObject:@"provisional"];
69
+
70
+  if (@available(iOS 10.0, *)) {
71
+    UNAuthorizationOptions types = UNAuthorizationOptionNone;
72
+
73
+    if (alert) types += UNAuthorizationOptionAlert;
74
+    if (badge) types += UNAuthorizationOptionBadge;
75
+    if (sound) types += UNAuthorizationOptionSound;
76
+    if (carPlay) types += UNAuthorizationOptionCarPlay;
77
+
78
+    if (@available(iOS 12.0, *)) {
79
+      if (criticalAlert) types += UNAuthorizationOptionCriticalAlert;
80
+      if (provisional) types += UNAuthorizationOptionProvisional;
81
+    }
82
+
83
+    if (!alert && !badge && !sound && !criticalAlert && !carPlay && !provisional) {
84
+      types += UNAuthorizationOptionAlert;
85
+      types += UNAuthorizationOptionBadge;
86
+      types += UNAuthorizationOptionSound;
87
+    }
88
+
89
+    UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
90
+
91
+    [center requestAuthorizationWithOptions:types
92
+                          completionHandler:^(BOOL granted, NSError * _Nullable error) {
93
+      if (error != nil) {
94
+        return reject(error);
95
+      }
96
+      if (granted) {
97
+        dispatch_async(dispatch_get_main_queue(), ^{
98
+          [[UIApplication sharedApplication] registerForRemoteNotifications];
99
+        });
100
+      }
101
+
102
+      [self checkWithResolver:resolve rejecter:reject];
103
+    }];
104
+  } else {
105
+    UIUserNotificationType types = UIUserNotificationTypeNone;
106
+
107
+    if (alert) types += UIUserNotificationTypeAlert;
108
+    if (badge) types += UIUserNotificationTypeBadge;
109
+    if (sound) types += UIUserNotificationTypeSound;
110
+
111
+    if (!alert && !badge && !sound) {
112
+      types += UIUserNotificationTypeAlert;
113
+      types += UIUserNotificationTypeBadge;
114
+      types += UIUserNotificationTypeSound;
115
+    }
116
+
117
+    _resolve = resolve;
118
+    _reject = reject;
119
+
120
+    [[NSNotificationCenter defaultCenter] addObserver:self
121
+                                            selector:@selector(onApplicationDidBecomeActive)
122
+                                                name:UIApplicationDidBecomeActiveNotification
123
+                                              object:nil];
124
+
125
+    UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:types categories:nil];
126
+    [[UIApplication sharedApplication] registerUserNotificationSettings:settings];
127
+    [[UIApplication sharedApplication] registerForRemoteNotifications];
128
+  }
129
+}
130
+
131
+- (void)onApplicationDidBecomeActive {
132
+  [[NSNotificationCenter defaultCenter] removeObserver:self
133
+                                                  name:UIApplicationDidBecomeActiveNotification
134
+                                                object:nil];
135
+
136
+  [self checkWithResolver:_resolve rejecter:_reject];
137
+}
138
+
139
+- (void)getSettingsWithResolver:(void (^ _Nonnull)(NSDictionary * _Nonnull settings))resolve {
140
+  if (@available(iOS 10.0, *)) {
141
+    UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
142
+
143
+    [center getNotificationSettingsWithCompletionHandler:^(UNNotificationSettings * _Nonnull settings) {
144
+      NSMutableDictionary *result = [NSMutableDictionary new];
145
+
146
+      bool alert = settings.alertSetting == UNNotificationSettingEnabled;
147
+      bool badge = settings.badgeSetting == UNNotificationSettingEnabled;
148
+      bool sound = settings.soundSetting == UNNotificationSettingEnabled;
149
+      bool lockScreen = settings.lockScreenSetting == UNNotificationSettingEnabled;
150
+      bool carPlay = settings.carPlaySetting == UNNotificationSettingEnabled;
151
+
152
+      if (settings.alertSetting != UNNotificationSettingNotSupported)
153
+        [result setValue:@(alert) forKey:@"alert"];
154
+      if (settings.badgeSetting != UNNotificationSettingNotSupported)
155
+        [result setValue:@(badge) forKey:@"badge"];
156
+      if (settings.soundSetting != UNNotificationSettingNotSupported)
157
+        [result setValue:@(sound) forKey:@"sound"];
158
+      if (settings.lockScreenSetting != UNNotificationSettingNotSupported)
159
+        [result setValue:@(lockScreen) forKey:@"lockScreen"];
160
+      if (settings.carPlaySetting != UNNotificationSettingNotSupported)
161
+        [result setValue:@(carPlay) forKey:@"carPlay"];
162
+
163
+      if (@available(iOS 12.0, *)) {
164
+        bool criticalAlert = settings.criticalAlertSetting == UNNotificationSettingEnabled;
165
+
166
+        if (settings.criticalAlertSetting != UNNotificationSettingNotSupported)
167
+          [result setValue:@(criticalAlert) forKey:@"criticalAlert"];
168
+      }
169
+
170
+      resolve(result);
171
+    }];
172
+  } else {
173
+    UIUserNotificationType types = [[[UIApplication sharedApplication] currentUserNotificationSettings] types];
174
+
175
+    resolve(@{
176
+      @"alert": @((bool)(types & UIUserNotificationTypeAlert)),
177
+      @"badge": @((bool)(types & UIUserNotificationTypeBadge)),
178
+      @"sound": @((bool)(types & UIUserNotificationTypeSound)),
179
+    });
180
+  }
181
+}
182
+
183
+@end

+ 0
- 33
ios/PermissionHandlers/Camera/RNPermissionHandlerCamera.m View File

@@ -1,33 +0,0 @@
1
-#import "RNPermissionHandlerCamera.h"
2
-
3
-@import AVFoundation;
4
-
5
-@implementation RNPermissionHandlerCamera
6
-
7
-+ (NSArray<NSString *> *)usageDescriptionKeys {
8
-  return @[@"NSCameraUsageDescription"];
9
-}
10
-
11
-- (void)checkWithResolver:(void (^)(RNPermissionStatus status))resolve
12
-             withRejecter:(void (__unused ^)(NSError *error))reject {
13
-  switch ([AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo]) {
14
-    case AVAuthorizationStatusNotDetermined:
15
-      return resolve(RNPermissionStatusNotDetermined);
16
-    case AVAuthorizationStatusRestricted:
17
-      return resolve(RNPermissionStatusRestricted);
18
-    case AVAuthorizationStatusDenied:
19
-      return resolve(RNPermissionStatusDenied);
20
-    case AVAuthorizationStatusAuthorized:
21
-      return resolve(RNPermissionStatusAuthorized);
22
-  }
23
-}
24
-
25
-- (void)requestWithOptions:(__unused NSDictionary * _Nullable)options
26
-              withResolver:(void (^)(RNPermissionStatus status))resolve
27
-              withRejecter:(void (^)(NSError *error))reject {
28
-  [AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(__unused BOOL granted) {
29
-    [self checkWithResolver:resolve withRejecter:reject];
30
-  }];
31
-}
32
-
33
-@end

+ 0
- 75
ios/PermissionHandlers/FaceID/RNPermissionHandlerFaceID.m View File

@@ -1,75 +0,0 @@
1
-#import "RNPermissionHandlerFaceID.h"
2
-
3
-@import LocalAuthentication;
4
-
5
-@implementation RNPermissionHandlerFaceID
6
-
7
-+ (NSArray<NSString *> *)usageDescriptionKeys {
8
-  return @[@"NSFaceIDUsageDescription"];
9
-}
10
-
11
-- (void)handleError:(NSError *)error
12
-       withResolver:(void (^)(RNPermissionStatus status))resolve
13
-       withRejecter:(void (^)(NSError *error))reject {
14
-  if (error.code == -6) {
15
-    resolve(RNPermissionStatusDenied);
16
-  } else {
17
-    reject(error);
18
-  }
19
-}
20
-
21
-- (void)checkWithResolver:(void (^)(RNPermissionStatus status))resolve
22
-             withRejecter:(void (^)(NSError *error))reject {
23
-  if (@available(iOS 11.0, *)) {
24
-    if (![RNPermissionsManager hasBeenRequestedOnce:self]) {
25
-      return resolve(RNPermissionStatusNotDetermined);
26
-    }
27
-
28
-    LAContext *context = [LAContext new];
29
-    NSError *error;
30
-    [context canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&error];
31
-
32
-    if (error != nil) {
33
-      return [self handleError:error withResolver:resolve withRejecter:reject];
34
-    }
35
-    if (context.biometryType != LABiometryTypeFaceID) {
36
-      return resolve(RNPermissionStatusNotAvailable);
37
-    }
38
-
39
-    resolve(RNPermissionStatusAuthorized);
40
-  } else {
41
-    resolve(RNPermissionStatusNotAvailable);
42
-  }
43
-}
44
-
45
-- (void)requestWithOptions:(__unused NSDictionary * _Nullable)options
46
-              withResolver:(void (^)(RNPermissionStatus status))resolve
47
-              withRejecter:(void (^)(NSError *error))reject {
48
-  if (@available(iOS 11.0, *)) {
49
-    LAContext *context = [LAContext new];
50
-    NSError *error;
51
-    [context canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&error];
52
-
53
-    if (error != nil) {
54
-      return [self handleError:error withResolver:resolve withRejecter:reject];
55
-    }
56
-    if (context.biometryType != LABiometryTypeFaceID) {
57
-      return resolve(RNPermissionStatusNotAvailable);
58
-    }
59
-    if ([RNPermissionsManager hasBeenRequestedOnce:self]) {
60
-      return resolve(RNPermissionStatusAuthorized);
61
-    }
62
-
63
-    [context evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics localizedReason:[[NSBundle mainBundle] objectForInfoDictionaryKey:@"NSFaceIDUsageDescription"] reply:^(BOOL success, NSError * _Nullable error) {
64
-      if (error != nil) {
65
-        [self handleError:error withResolver:resolve withRejecter:reject];
66
-      } else {
67
-        resolve(success ? RNPermissionStatusAuthorized : RNPermissionStatusDenied);
68
-      }
69
-    }];
70
-  } else {
71
-    resolve(RNPermissionStatusNotAvailable);
72
-  }
73
-}
74
-
75
-@end

+ 0
- 88
ios/PermissionHandlers/LocationAlways/RNPermissionHandlerLocationAlways.m View File

@@ -1,88 +0,0 @@
1
-#import "RNPermissionHandlerLocationAlways.h"
2
-
3
-@import CoreLocation;
4
-@import UIKit;
5
-
6
-@interface RNPermissionHandlerLocationAlways() <CLLocationManagerDelegate>
7
-
8
-@property (nonatomic) CLLocationManager *locationManager;
9
-@property (nonatomic) bool initialChangeEventFired;
10
-@property (nonatomic, copy) void (^resolve)(RNPermissionStatus status);
11
-@property (nonatomic, copy) void (^reject)(NSError *error);
12
-
13
-@end
14
-
15
-@implementation RNPermissionHandlerLocationAlways
16
-
17
-+ (NSArray<NSString *> *)usageDescriptionKeys {
18
-  return @[
19
-    @"NSLocationAlwaysAndWhenInUseUsageDescription",
20
-    @"NSLocationAlwaysUsageDescription",
21
-  ];
22
-}
23
-
24
-- (void)checkWithResolver:(void (^)(RNPermissionStatus status))resolve
25
-             withRejecter:(void (__unused ^)(NSError *error))reject {
26
-  if (![CLLocationManager locationServicesEnabled]) {
27
-    return resolve(RNPermissionStatusNotAvailable);
28
-  }
29
-
30
-  switch ([CLLocationManager authorizationStatus]) {
31
-    case kCLAuthorizationStatusNotDetermined:
32
-      return resolve(RNPermissionStatusNotDetermined);
33
-    case kCLAuthorizationStatusRestricted:
34
-      return resolve(RNPermissionStatusRestricted);
35
-    case kCLAuthorizationStatusAuthorizedWhenInUse:
36
-    case kCLAuthorizationStatusDenied:
37
-      return resolve(RNPermissionStatusDenied);
38
-    case kCLAuthorizationStatusAuthorizedAlways:
39
-      return resolve(RNPermissionStatusAuthorized);
40
-  }
41
-}
42
-
43
-- (void)requestWithOptions:(__unused NSDictionary * _Nullable)options
44
-              withResolver:(void (^)(RNPermissionStatus status))resolve
45
-              withRejecter:(void (^)(NSError *error))reject {
46
-  CLAuthorizationStatus status = [CLLocationManager authorizationStatus];
47
-
48
-  if ((status != kCLAuthorizationStatusNotDetermined && status != kCLAuthorizationStatusAuthorizedWhenInUse) ||
49
-      ([RNPermissionsManager hasBeenRequestedOnce:self] && status == kCLAuthorizationStatusAuthorizedWhenInUse)) {
50
-    return [self checkWithResolver:resolve withRejecter:reject];
51
-  }
52
-
53
-  _resolve = resolve;
54
-  _reject = reject;
55
-
56
-  if (status == kCLAuthorizationStatusAuthorizedWhenInUse) {
57
-    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(UIApplicationDidBecomeActiveNotification:) name:UIApplicationDidBecomeActiveNotification object:nil];
58
-  }
59
-
60
-  _locationManager = [CLLocationManager new];
61
-  [_locationManager setDelegate:self];
62
-  [_locationManager requestAlwaysAuthorization];
63
-}
64
-
65
-- (void)onAuthorizationStatus {
66
-  [self checkWithResolver:_resolve withRejecter:_reject];
67
-
68
-  [_locationManager setDelegate:nil];
69
-  _locationManager = nil;
70
-}
71
-
72
-- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status {
73
-  if (!_initialChangeEventFired) {
74
-    _initialChangeEventFired = true;
75
-  } else {
76
-    [self onAuthorizationStatus];
77
-  }
78
-}
79
-
80
-- (void)UIApplicationDidBecomeActiveNotification:(NSNotification *)notification {
81
-  if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusAuthorizedWhenInUse) {
82
-    [self onAuthorizationStatus];
83
-  }
84
-
85
-  [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidBecomeActiveNotification object:nil];
86
-}
87
-
88
-@end

+ 0
- 67
ios/PermissionHandlers/LocationWhenInUse/RNPermissionHandlerLocationWhenInUse.m View File

@@ -1,67 +0,0 @@
1
-#import "RNPermissionHandlerLocationWhenInUse.h"
2
-
3
-@import CoreLocation;
4
-
5
-@interface RNPermissionHandlerLocationWhenInUse() <CLLocationManagerDelegate>
6
-
7
-@property (nonatomic) CLLocationManager *locationManager;
8
-@property (nonatomic) bool initialChangeEventFired;
9
-@property (nonatomic, copy) void (^resolve)(RNPermissionStatus status);
10
-@property (nonatomic, copy) void (^reject)(NSError *error);
11
-
12
-@end
13
-
14
-@implementation RNPermissionHandlerLocationWhenInUse
15
-
16
-+ (NSArray<NSString *> *)usageDescriptionKeys {
17
-  return @[@"NSLocationWhenInUseUsageDescription"];
18
-}
19
-
20
-- (void)checkWithResolver:(void (^)(RNPermissionStatus status))resolve
21
-             withRejecter:(void (__unused ^)(NSError *error))reject {
22
-  if (![CLLocationManager locationServicesEnabled]) {
23
-    return resolve(RNPermissionStatusNotAvailable);
24
-  }
25
-
26
-  switch ([CLLocationManager authorizationStatus]) {
27
-    case kCLAuthorizationStatusNotDetermined:
28
-      return resolve(RNPermissionStatusNotDetermined);
29
-    case kCLAuthorizationStatusRestricted:
30
-      return resolve(RNPermissionStatusRestricted);
31
-    case kCLAuthorizationStatusDenied:
32
-      return resolve(RNPermissionStatusDenied);
33
-    case kCLAuthorizationStatusAuthorizedWhenInUse:
34
-    case kCLAuthorizationStatusAuthorizedAlways:
35
-      return resolve(RNPermissionStatusAuthorized);
36
-  }
37
-}
38
-
39
-- (void)requestWithOptions:(__unused NSDictionary * _Nullable)options
40
-              withResolver:(void (^)(RNPermissionStatus status))resolve
41
-              withRejecter:(void (^)(NSError *error))reject {
42
-  CLAuthorizationStatus status = [CLLocationManager authorizationStatus];
43
-
44
-  if (status != kCLAuthorizationStatusNotDetermined) {
45
-    return [self checkWithResolver:resolve withRejecter:reject];
46
-  }
47
-
48
-  _resolve = resolve;
49
-  _reject = reject;
50
-
51
-  _locationManager = [CLLocationManager new];
52
-  [_locationManager setDelegate:self];
53
-  [_locationManager requestWhenInUseAuthorization];
54
-}
55
-
56
-- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status {
57
-  if (!_initialChangeEventFired) {
58
-    _initialChangeEventFired = true;
59
-  } else {
60
-    [self checkWithResolver:_resolve withRejecter:_reject];
61
-
62
-    [_locationManager setDelegate:nil];
63
-    _locationManager = nil;
64
-  }
65
-}
66
-
67
-@end

+ 0
- 74
ios/PermissionHandlers/Motion/RNPermissionHandlerMotion.m View File

@@ -1,74 +0,0 @@
1
-#import "RNPermissionHandlerMotion.h"
2
-
3
-@import CoreMotion;
4
-
5
-static NSString* handlerKey = @"motion";
6
-
7
-@interface RNPermissionHandlerMotion()
8
-
9
-@property (nonatomic, strong) CMMotionActivityManager *motionActivityManager;
10
-@property (nonatomic, strong) NSOperationQueue *motionActivityQueue;
11
-
12
-@end
13
-
14
-@implementation RNPermissionHandlerMotion
15
-
16
-+ (NSArray<NSString *> *)usageDescriptionKeys {
17
-  return @[@"NSMotionUsageDescription"];
18
-}
19
-
20
-- (void)checkWithResolver:(void (^)(RNPermissionStatus status))resolve
21
-             withRejecter:(void (^)(NSError *error))reject {
22
-  if (![CMMotionActivityManager isActivityAvailable]) {
23
-    return resolve(RNPermissionStatusNotAvailable);
24
-  }
25
-
26
-  if (@available(iOS 11.0, *)) {
27
-    switch ([CMMotionActivityManager authorizationStatus]) {
28
-      case CMAuthorizationStatusNotDetermined:
29
-        return resolve(RNPermissionStatusNotDetermined);
30
-      case CMAuthorizationStatusRestricted:
31
-        return resolve(RNPermissionStatusRestricted);
32
-      case CMAuthorizationStatusDenied:
33
-        return resolve(RNPermissionStatusDenied);
34
-      case CMAuthorizationStatusAuthorized:
35
-        return resolve(RNPermissionStatusAuthorized);
36
-    }
37
-  }
38
-
39
-  if (![RNPermissionsManager hasBeenRequestedOnce:self]) {
40
-    return resolve(RNPermissionStatusNotDetermined);
41
-  }
42
-
43
-  [self requestWithOptions:nil withResolver:resolve withRejecter:reject];
44
-}
45
-
46
-- (void)requestWithOptions:(__unused NSDictionary * _Nullable)options
47
-              withResolver:(void (^)(RNPermissionStatus status))resolve
48
-              withRejecter:(void (^)(NSError *error))reject {
49
-  if (![CMMotionActivityManager isActivityAvailable]) {
50
-    return resolve(RNPermissionStatusNotAvailable);
51
-  }
52
-
53
-  _motionActivityManager = [CMMotionActivityManager new];
54
-  _motionActivityQueue = [NSOperationQueue new];
55
-
56
-  [_motionActivityManager queryActivityStartingFromDate:[NSDate distantPast] toDate:[NSDate date] toQueue:_motionActivityQueue withHandler:^(NSArray<CMMotionActivity *> * _Nullable activities, NSError * _Nullable error) {
57
-    if (error != nil) {
58
-      if (error.code == CMErrorNotAuthorized || error.code == CMErrorMotionActivityNotAuthorized) {
59
-        resolve(RNPermissionStatusDenied);
60
-      } else {
61
-        reject(error);
62
-      }
63
-    } else if (activities) {
64
-      resolve(RNPermissionStatusAuthorized);
65
-    } else {
66
-      resolve(RNPermissionStatusNotDetermined);
67
-    }
68
-
69
-    self->_motionActivityManager = nil;
70
-    self->_motionActivityQueue = nil;
71
-  }];
72
-}
73
-
74
-@end

+ 0
- 5
ios/PermissionHandlers/Notifications/RNPermissionHandlerNotifications.h View File

@@ -1,5 +0,0 @@
1
-#import "RNPermissionsManager.h"
2
-
3
-@interface RNPermissionHandlerNotifications : NSObject<RNPermissionHandler>
4
-
5
-@end

+ 0
- 98
ios/PermissionHandlers/Notifications/RNPermissionHandlerNotifications.m View File

@@ -1,98 +0,0 @@
1
-#import "RNPermissionHandlerNotifications.h"
2
-
3
-@import UserNotifications;
4
-@import UIKit;
5
-
6
-@implementation RNPermissionHandlerNotifications
7
-
8
-- (void)checkWithResolver:(void (^)(RNPermissionStatus status))resolve
9
-             withRejecter:(void (__unused ^)(NSError *error))reject {
10
-  if (@available(iOS 10.0, *)) {
11
-    [[UNUserNotificationCenter currentNotificationCenter] getNotificationSettingsWithCompletionHandler:^(UNNotificationSettings * _Nonnull settings) {
12
-      switch (settings.authorizationStatus) {
13
-        case UNAuthorizationStatusNotDetermined:
14
-          return resolve(RNPermissionStatusNotDetermined);
15
-        case UNAuthorizationStatusDenied:
16
-          return resolve(RNPermissionStatusDenied);
17
-#ifdef __IPHONE_12_0
18
-        case UNAuthorizationStatusProvisional:
19
-#endif
20
-        case UNAuthorizationStatusAuthorized:
21
-          return resolve(RNPermissionStatusAuthorized);
22
-      }
23
-    }];
24
-  } else {
25
-    UIUserNotificationSettings *settings = [[UIApplication sharedApplication] currentUserNotificationSettings];
26
-
27
-    if (settings == nil || settings.types == UIUserNotificationTypeNone) {
28
-      resolve(RNPermissionStatusNotDetermined);
29
-    } else {
30
-      resolve(RNPermissionStatusAuthorized);
31
-    }
32
-  }
33
-}
34
-
35
-- (void)requestWithOptions:(NSDictionary * _Nullable)options
36
-              withResolver:(void (^)(RNPermissionStatus status))resolve
37
-              withRejecter:(void (^)(NSError *error))reject {
38
-  if (@available(iOS 10.0, *)) {
39
-    UNAuthorizationOptions toRequest = UNAuthorizationOptionNone;
40
-
41
-    if (options != nil) {
42
-      NSArray<NSString *> *notificationOptions = [options objectForKey:@"notificationOptions"];
43
-
44
-      if (notificationOptions != nil && [notificationOptions isKindOfClass:[NSArray class]]) {
45
-#if RCT_DEV
46
-        // @TODO check if it's possible to use RCTConvert + RCT_ENUM_CONVERTER
47
-        // https://developer.apple.com/documentation/usernotifications/unnotificationsettings?language=objc
48
-
49
-        NSArray<NSString *> *possible = [[NSArray alloc] initWithObjects:@"badge", @"sound", @"alert", @"carPlay", @"provisional", @"criticalAlert", nil];
50
-
51
-        for (NSString *option in notificationOptions) {
52
-          if (![possible containsObject:option]) {
53
-            return [RNPermissionsManager logErrorMessage:[NSString stringWithFormat:@"Invalid notificationOptions value : %@. Must be one of : %@.", option, [possible componentsJoinedByString:@", "]]];
54
-          }
55
-        }
56
-#endif
57
-
58
-        if ([notificationOptions containsObject:@"badge"]) {
59
-          toRequest += UNAuthorizationOptionBadge;
60
-        }
61
-        if ([notificationOptions containsObject:@"sound"]) {
62
-          toRequest += UNAuthorizationOptionSound;
63
-        }
64
-        if ([notificationOptions containsObject:@"alert"]) {
65
-          toRequest += UNAuthorizationOptionAlert;
66
-        }
67
-        if ([notificationOptions containsObject:@"carPlay"]) {
68
-          toRequest += UNAuthorizationOptionCarPlay;
69
-        }
70
-
71
-        if (@available(iOS 12.0, *)) {
72
-          if ([notificationOptions containsObject:@"provisional"]) {
73
-            toRequest += UNAuthorizationOptionProvisional;
74
-          }
75
-          if ([notificationOptions containsObject:@"criticalAlert"]) {
76
-            toRequest += UNAuthorizationOptionCriticalAlert;
77
-          }
78
-        }
79
-      } else {
80
-        toRequest += UNAuthorizationOptionBadge;
81
-        toRequest += UNAuthorizationOptionSound;
82
-        toRequest += UNAuthorizationOptionAlert;
83
-      }
84
-    }
85
-
86
-    [[UNUserNotificationCenter currentNotificationCenter] requestAuthorizationWithOptions:toRequest completionHandler:^(BOOL granted, NSError * _Nullable error) {
87
-      if (error != nil) {
88
-        reject(error);
89
-      } else {
90
-        [self checkWithResolver:resolve withRejecter:reject];
91
-      }
92
-    }];
93
-  } else {
94
-    [self checkWithResolver:resolve withRejecter:reject];
95
-  }
96
-}
97
-
98
-@end

+ 19
- 0
ios/PhotoLibrary.podspec View File

@@ -0,0 +1,19 @@
1
+require 'json'
2
+package = JSON.parse(File.read('../package.json'))
3
+
4
+Pod::Spec.new do |s|
5
+  s.name            = "Permission-PhotoLibrary"
6
+  s.dependency        "RNPermissions"
7
+
8
+  s.version         = package["version"]
9
+  s.license         = package["license"]
10
+  s.summary         = package["description"]
11
+  s.authors         = package["author"]
12
+  s.homepage        = package["homepage"]
13
+
14
+  s.platform        = :ios, "9.0"
15
+  s.requires_arc    = true
16
+
17
+  s.source          = { :git => s.homepage, :tag => s.version }
18
+  s.source_files           = "PhotoLibrary/*.{h,m}"
19
+end

ios/PermissionHandlers/PhotoLibrary/RNPermissionHandlerPhotoLibrary.h → ios/PhotoLibrary/RNPermissionHandlerPhotoLibrary.h View File

@@ -1,4 +1,4 @@
1
-#import "RNPermissionsManager.h"
1
+#import "RNPermissions.h"
2 2
 
3 3
 @interface RNPermissionHandlerPhotoLibrary : NSObject<RNPermissionHandler>
4 4
 

ios/PermissionHandlers/PhotoLibrary/RNPermissionHandlerPhotoLibrary.m → ios/PhotoLibrary/RNPermissionHandlerPhotoLibrary.m View File


Some files were not shown because too many files changed in this diff