react-native-permissions
react-native-permissions copied to clipboard
iOS14 - Local Network permission support
Feature request
Support for Local Network permission needed (iOS14)
Why it is needed
With iOS 14 user may disallow Local Network permission for mobile app, which will deny access for app to local devices. https://developer.apple.com/videos/play/wwdc2020/10110/
Possible implementation
Should be used like something like this:
Permissions.getPermissionStatus('localNetwork').then((r) => {
if (r === 'authorized') {
// Do something
} else if (r === 'undetermined') {
Permissions.requestPermission('localNetwork').then((response) => {
if (response === 'authorized') {
// Do something
}
if (response === 'denied') {
// Notify user about Local Network permission denied, advice user to turn on permission
}
});
} else {
// Notify user about Local Network permission denied, advice user to turn on permission
}
});
Upvote & Fund
- This repository is using Polar.sh so you can help prioritize & fund this issue.
- The funding will only be unlocked once this issue is completed.
@vahutson I'm not sure this is a requestable permission? I can't find any documentation about it on https://developer.apple.com/documentation/
idk if this helps: https://developer.apple.com/forums/thread/654916
@fernandesrenan Not really:
I see this question has been asked on the forums already, and there is no API.
@fernandesrenan Not really:
I see this question has been asked on the forums already, and there is no API.
This means that no native API no feature on react-native-permissions?
@fernandesrenan Totally. We are not wizards, Apple has to do its job.
from Apple https://developer.apple.com/forums/thread/663858
How to trigger privacy permission https://developer.apple.com/forums/thread/663768
is there a way to request user to allow Local Network permission in iOS 14?
Same issue here
@geroale doesn't look like an "issue" at this point, based on @jimji1005 comment it looks like it needs someone to implement it. Do you have PR you could propose?
@vahutson resolve ?
It seems that still there is not native api to trigger at this point (end of 2021) so this is not an issue can be handled directly here. But.. There is a hack around this.
For popping up the permission prompt: send a dummy request on your network which will prompt the pop.
Can be handled "manually" or it can be implemented as an api in react-native-permissions
as an api so for the
end user it will handle as all other library permission api's
(Its a bit of a nasty hack, so guess its for the admins to decide)
Checking if Local Network permission is granted: This sill requite native code, but basically you will need to check the error type on connection fail and label it as Local Network. This will, require a PR as it not possible to do "manually" using only JS..
More in depth details about these solutions can be found in this SO answer - link
Personally Im going to write a small native library to perform these 2 hacks..
Can share the code for a PR to be added to this library if anyone is interested (I do write it in Swift though)
PS: All discussions I found about this issue on the native side are at the end of 2020, so maybe an api for these was added by now, if so I could not find such a thing.
Hope this helps
Resolve?
+1 for support this permission
@zameschua this is interesting, I think https://medium.com/hackernoon/i-thought-i-understood-open-source-i-was-wrong-cf54999c097b
+1 for support this permission
Sure, we can hire my as a contractor to do it if you want. If all the people here ask their companies to get some funding, it should be possible 🙂
I have a working solution which I am using in my app and I am interested in sharing it as a PR to this lib - the only caveat is that what I have is written in Swift, does anyone have any guidance on how to integrate it?
For reference, here is my implementation. It runs at app launch and currently just triggers the prompt without doing anything with the response.
That's pretty cool. I believe at this point every modern react-native project has already had to deal with the inclusion of swift files - I know I worked through tons of compilation issues with main repo in the 0.63/0.64 time frame and they should be all handled now
Stated differently: swift as a language should be valid for react-native modules
So then the question is whether you can easily include a single swift file in this module, and then wrap it as a separate cocoapods podspect to include for people, exposed in the typescript. Should be possible? Only way to know is to try I think
@grit96 I was looking at your pr and was wondering if it would be merged. If so do you have any idea approximately when? I tried to install the one from your PR on your fork but was not able to get it to install. Is there any chance you could create standalone version into we know if your pr is merged