|
1 | | -# PermissionsKit |
| 1 | +# FirebaseWrapper |
2 | 2 |
|
3 | | -Universal API for request permission and get its statuses — available `.authorized`, `.denied` & `.notDetermined`. |
4 | | - |
5 | | -<p float="left"> |
6 | | - <img src="https://cdn.sparrowcode.io/github/permissionskit/icons/camera.png" width="38"> |
7 | | - <img src="https://cdn.sparrowcode.io/github/permissionskit/icons/photos.png" width="38"> |
8 | | - <img src="https://cdn.sparrowcode.io/github/permissionskit/icons/notifications.png" width="38"> |
9 | | - <img src="https://cdn.sparrowcode.io/github/permissionskit/icons/location.png" width="38"> |
10 | | - <img src="https://cdn.sparrowcode.io/github/permissionskit/icons/microphone.png" width="38"> |
11 | | - <img src="https://cdn.sparrowcode.io/github/permissionskit/icons/calendar.png" width="38"> |
12 | | - <img src="https://cdn.sparrowcode.io/github/permissionskit/icons/contacts.png" width="38"> |
13 | | - <img src="https://cdn.sparrowcode.io/github/permissionskit/icons/reminders.png" width="38"> |
14 | | - <img src="https://cdn.sparrowcode.io/github/permissionskit/icons/motion.png" width="38"> |
15 | | - <img src="https://cdn.sparrowcode.io/github/permissionskit/icons/music.png" width="38"> |
16 | | - <img src="https://cdn.sparrowcode.io/github/permissionskit/icons/speech.png" width="38"> |
17 | | - <img src="https://cdn.sparrowcode.io/github/permissionskit/icons/bluetooth.png" width="38"> |
18 | | - <img src="https://cdn.sparrowcode.io/github/permissionskit/icons/health.png" width="38"> |
19 | | - <img src="https://cdn.sparrowcode.io/github/permissionskit/icons/tracking.png" width="38"> |
20 | | - <img src="https://cdn.sparrowcode.io/github/permissionskit/icons/faceid.png" width="38"> |
21 | | - <img src="https://cdn.sparrowcode.io/github/permissionskit/icons/siri.png" width="38"> |
22 | | -</p> |
23 | | - |
24 | | -### Community |
25 | | - |
26 | | -<p float="left"> |
27 | | - <a href="https://twitter.com/sparrowcode_en"> |
28 | | - <img src="https://cdn.sparrowcode.io/github/badges/twitter-en.png?version=5" height="52"> |
29 | | - </a> |
30 | | - <a href="https://twitter.com/sparrowcode_"> |
31 | | - <img src="https://cdn.sparrowcode.io/github/badges/twitter-ru.png?version=5" height="52"> |
32 | | - </a> |
33 | | - <a href="https://t.me/sparrowcode_en"> |
34 | | - <img src="https://cdn.sparrowcode.io/github/badges/telegram-en.png?version=2" height="52"> |
35 | | - </a> |
36 | | - <a href="https://t.me/sparrowcode"> |
37 | | - <img src="https://cdn.sparrowcode.io/github/badges/telegram-ru.png?version=2" height="52"> |
38 | | - </a> |
39 | | - <a href="https://youtube.com/@sparrowcode"> |
40 | | - <img src="https://cdn.sparrowcode.io/github/badges/youtube-ru.png?version=1" height="52"> |
41 | | - </a> |
42 | | - <a href="#apps-using"> |
43 | | - <img src="https://cdn.sparrowcode.io/github/badges/download-on-the-appstore.png?version=4" height="52"> |
44 | | - </a> |
45 | | -</p> |
46 | | - |
47 | | -## Navigate |
48 | | - |
49 | | -- [Permissions](#permissions) |
50 | | -- [Installation](#installation) |
51 | | - - [Swift Package Manager](#swift-package-manager) |
52 | | - - [CocoaPods](#cocoapods) |
53 | | -- [Usage](#request-permission) |
54 | | - - [Request Permission](#request-permission) |
55 | | - - [Get Status Permission](#get-status-permission) |
56 | | -- [Keys in Info.plist](#keys-in-infoplist) |
57 | | - - [Localisations](#localisation) |
58 | | -- [Apps Using](#apps-using) |
59 | | - |
60 | | -### Permissions |
61 | | - |
62 | | -| Icon | Permission | Key for `Info.plist` | Get Status | Make Request | |
63 | | -| :--: | :---------- | :------------------- | :--------: | :----------: | |
64 | | -| <img src="https://cdn.sparrowcode.io/github/permissionskit/icons/bluetooth.png" width="38"> | Bluetooth | NSBluetoothAlwaysUsageDescription, NSBluetoothPeripheralUsageDescription | ✅ | ✅ | |
65 | | -| <img src="https://cdn.sparrowcode.io/github/permissionskit/icons/calendar.png" width="38"> | Calendar | NSCalendarsUsageDescription, NSCalendarsFullAccessUsageDescription, NSCalendarsWriteOnlyAccessUsageDescription | ✅ | ✅ | |
66 | | -| <img src="https://cdn.sparrowcode.io/github/permissionskit/icons/camera.png" width="38"> | Camera | NSCameraUsageDescription | ✅ | ✅ | |
67 | | -| <img src="https://cdn.sparrowcode.io/github/permissionskit/icons/contacts.png" width="38"> | Contacts | NSContactsUsageDescription | ✅ | ✅ | |
68 | | -| <img src="https://cdn.sparrowcode.io/github/permissionskit/icons/faceid.png" width="38"> | FaceID | NSFaceIDUsageDescription | ☑️ | ✅ | |
69 | | -| <img src="https://cdn.sparrowcode.io/github/permissionskit/icons/health.png" width="38"> | Health | NSHealthUpdateUsageDescription, NSHealthShareUsageDescription | ✅ | ✅ | |
70 | | -| <img src="https://cdn.sparrowcode.io/github/permissionskit/icons/location.png" width="38"> | Location | NSLocationAlwaysAndWhenInUseUsageDescription NSLocationWhenInUseUsageDescription | ✅ | ✅ | |
71 | | -| <img src="https://cdn.sparrowcode.io/github/permissionskit/icons/music.png" width="38"> | Media Library | NSAppleMusicUsageDescription | ✅ | ✅ | |
72 | | -| <img src="https://cdn.sparrowcode.io/github/permissionskit/icons/microphone.png" width="38"> | Microphone | NSMicrophoneUsageDescription | ✅ | ✅ | |
73 | | -| <img src="https://cdn.sparrowcode.io/github/permissionskit/icons/motion.png" width="38"> | Motion | NSMotionUsageDescription | ✅ | ✅ | |
74 | | -| <img src="https://cdn.sparrowcode.io/github/permissionskit/icons/notifications.png" width="38"> | Notification | | ✅ | ✅ | |
75 | | -| <img src="https://cdn.sparrowcode.io/github/permissionskit/icons/photos.png" width="38"> | Photo Library | NSPhotoLibraryUsageDescription, NSPhotoLibraryAddUsageDescription | ✅ | ✅ | |
76 | | -| <img src="https://cdn.sparrowcode.io/github/permissionskit/icons/reminders.png" width="38"> | Reminders | NSRemindersUsageDescription, NSRemindersFullAccessUsageDescription | ✅ | ✅ | |
77 | | -| <img src="https://cdn.sparrowcode.io/github/permissionskit/icons/siri.png" width="38"> | Siri | NSSiriUsageDescription | ✅ | ✅ | |
78 | | -| <img src="https://cdn.sparrowcode.io/github/permissionskit/icons/speech.png" width="38"> | Speech Recognizer | NSSpeechRecognitionUsageDescription | ✅ | ✅ | |
79 | | -| <img src="https://cdn.sparrowcode.io/github/permissionskit/icons/tracking.png" width="38"> | Tracking | NSUserTrackingUsageDescription | ✅ | ✅ | |
80 | | - |
81 | | -## Installation |
82 | | - |
83 | | -Ready to use on iOS 11+. Supports iOS, tvOS. Working with `UIKit` and `SwiftUI`. |
84 | | - |
85 | | -### Swift Package Manager |
86 | | - |
87 | | -In Xcode go to Project -> Your Project Name -> `Package Dependencies` -> Tap *Plus*. Insert url: |
88 | | - |
89 | | -``` |
90 | | -https://github.com/sparrowcode/PermissionsKit |
91 | | -``` |
92 | | - |
93 | | -Next, choose the permissions that you need. But don't add all of them, because apple will reject app. |
94 | | -Or adding it to the `dependencies` of your `Package.swift`: |
95 | | - |
96 | | -```swift |
97 | | -dependencies: [ |
98 | | - .package(url: "https://github.com/sparrowcode/PermissionsKit", .upToNextMajor(from: "10.0.1")) |
99 | | -] |
100 | | -``` |
101 | | - |
102 | | -and choose valid targets. |
103 | | - |
104 | | -### CocoaPods: |
105 | | - |
106 | | -This is an outdated way. I advise you to use [SPM](#swift-package-manager). However, I will continue to support Cocoapods for some time. |
107 | | - |
108 | | -<details><summary>Cocoapods Installation</summary> |
109 | | - |
110 | | -[CocoaPods](https://cocoapods.org) is a dependency manager. For usage and installation instructions, visit their website. To integrate using CocoaPods, specify it in your `Podfile`: |
111 | | - |
112 | | -```ruby |
113 | | -pod 'PermissionsKit/NotificationPermission', :git => 'https://github.com/sparrowcode/PermissionsKit' |
114 | | -``` |
115 | | - |
116 | | -Due to Apple's new policy regarding permission access you need to specifically define what kind of permissions you want to access using subspecs. |
117 | | - |
118 | | -```ruby |
119 | | -pod 'PermissionsKit/CameraPermission', :git => 'https://github.com/sparrowcode/PermissionsKit' |
120 | | -pod 'PermissionsKit/ContactsPermission', :git => 'https://github.com/sparrowcode/PermissionsKit' |
121 | | -pod 'PermissionsKit/CalendarPermission', :git => 'https://github.com/sparrowcode/PermissionsKit' |
122 | | -pod 'PermissionsKit/PhotoLibraryPermission', :git => 'https://github.com/sparrowcode/PermissionsKit' |
123 | | -pod 'PermissionsKit/NotificationPermission', :git => 'https://github.com/sparrowcode/PermissionsKit' |
124 | | -pod 'PermissionsKit/MicrophonePermission', :git => 'https://github.com/sparrowcode/PermissionsKit' |
125 | | -pod 'PermissionsKit/RemindersPermission', :git => 'https://github.com/sparrowcode/PermissionsKit' |
126 | | -pod 'PermissionsKit/SpeechRecognizerPermission', :git => 'https://github.com/sparrowcode/PermissionsKit' |
127 | | -pod 'PermissionsKit/LocationWhenInUsePermission', :git => 'https://github.com/sparrowcode/PermissionsKit' |
128 | | -pod 'PermissionsKit/LocationAlwaysPermission', :git => 'https://github.com/sparrowcode/PermissionsKit' |
129 | | -pod 'PermissionsKit/MotionPermission', :git => 'https://github.com/sparrowcode/PermissionsKit' |
130 | | -pod 'PermissionsKit/MediaLibraryPermission', :git => 'https://github.com/sparrowcode/PermissionsKit' |
131 | | -pod 'PermissionsKit/BluetoothPermission', :git => 'https://github.com/sparrowcode/PermissionsKit' |
132 | | -pod 'PermissionsKit/TrackingPermission', :git => 'https://github.com/sparrowcode/PermissionsKit' |
133 | | -pod 'PermissionsKit/FaceIDPermission', :git => 'https://github.com/sparrowcode/PermissionsKit' |
134 | | -pod 'PermissionsKit/SiriPermission', :git => 'https://github.com/sparrowcode/PermissionsKit' |
135 | | -pod 'PermissionsKit/HealthPermission', :git => 'https://github.com/sparrowcode/PermissionsKit' |
136 | | -``` |
137 | | -</details> |
138 | | - |
139 | | -## Request Permission |
140 | | - |
141 | | -```swift |
142 | | -import PermissionsKit |
143 | | -import NotificationPermission |
144 | | - |
145 | | -Permission.notification.request { |
146 | | - |
147 | | -} |
148 | | -``` |
149 | | - |
150 | | -## Get Status Permission |
151 | | - |
152 | | -```swift |
153 | | -import PermissionsKit |
154 | | -import NotificationPermission |
155 | | - |
156 | | -let authorized = Permission.notification.authorized |
157 | | -``` |
158 | | - |
159 | | -> **Warning** |
160 | | -> For FaceID permission no way detect if request `.authorized` or `.notDetermined` accurate. Status `.denied` detect well. For now for both states return `.notDetermined`. |
161 | | -
|
162 | | -## Keys in `Info.plist` |
163 | | - |
164 | | -You need to add some strings to the `Info.plist` file with descriptions per Apple's requirements. You can get a plist of keys for permissions as follows: |
165 | | - |
166 | | -```swift |
167 | | -let key = Permission.bluetooth.usageDescriptionKey |
168 | | -``` |
169 | | - |
170 | | -> **Warning** |
171 | | -> Do not use the description as the name of the key. Xcode can't build this. |
172 | | -
|
173 | | -### Localisation |
174 | | - |
175 | | -If you use xliff localization export, keys will be create automatically. If you prefer do the localization file manually, you need to create `InfoPlist.strings`, select languages on the right side menu and add keys as keys in plist-file. See: |
176 | | - |
177 | | -``` |
178 | | -"NSCameraUsageDescription" = "Here description of usage camera"; |
179 | | -``` |
180 | | - |
181 | | -## Apps Using |
182 | | - |
183 | | -<p float="left"> |
184 | | - <a href="https://apps.apple.com/app/id1487937127"><img src="https://cdn.sparrowcode.io/github/apps-using/id1487937127.png?version=2" height="65"></a> |
185 | | - <a href="https://apps.apple.com/app/id1624477055"><img src="https://cdn.sparrowcode.io/github/apps-using/id1624477055.png?version=2" height="65"></a> |
186 | | - <a href="https://apps.apple.com/app/id1625641322"><img src="https://cdn.sparrowcode.io/github/apps-using/id1625641322.png?version=2" height="65"></a> |
187 | | - <a href="https://apps.apple.com/app/id1625641322"><img src="https://cdn.sparrowcode.io/github/apps-using/id6449774982.png?version=2" height="65"></a> |
188 | | - <a href="https://apps.apple.com/app/id875280793"><img src="https://cdn.sparrowcode.io/github/apps-using/id875280793.png?version=2" height="65"></a> |
189 | | - <a href="https://apps.apple.com/app/id743843090"><img src="https://cdn.sparrowcode.io/github/apps-using/id743843090.png?version=2" height="65"></a> |
190 | | - <a href="https://apps.apple.com/app/id537070378"><img src="https://cdn.sparrowcode.io/github/apps-using/id537070378.png?version=2" height="65"></a> |
191 | | - <a href="https://apps.apple.com/app/id1617055933"><img src="https://cdn.sparrowcode.io/github/apps-using/id1617055933.png?version=2" height="65"></a> |
192 | | - <a href="https://apps.apple.com/app/id1596657751"><img src="https://cdn.sparrowcode.io/github/apps-using/id1596657751.png?version=2" height="65"></a> |
193 | | - <a href="https://apps.apple.com/app/id1459483980"><img src="https://cdn.sparrowcode.io/github/apps-using/id1459483980.png?version=2" height="65"></a> |
194 | | - <a href="https://apps.apple.com/app/id1544749600"><img src="https://cdn.sparrowcode.io/github/apps-using/id1544749600.png" height="65"></a> |
195 | | - <a href="https://apps.apple.com/app/id6452079114"><img src="https://cdn.sparrowcode.io/github/apps-using/id6452079114.png" height="65"></a> |
196 | | -</p> |
197 | | - |
198 | | -If you use a `PermissionsKit`, add your app via Pull Request. |
| 3 | +## Remote Config ✅ |
0 commit comments