Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS14 - Local Network permission support #509

Open
vasyl-i opened this issue Sep 15, 2020 · 18 comments · May be fixed by #687
Open

iOS14 - Local Network permission support #509

vasyl-i opened this issue Sep 15, 2020 · 18 comments · May be fixed by #687
Labels
feature request New feature or request Fund Can be funded on Polar.sh

Comments

@vasyl-i
Copy link

vasyl-i commented Sep 15, 2020

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.
Fund with Polar
@zoontek zoontek added the feature request New feature or request label Sep 15, 2020
@zoontek
Copy link
Owner

zoontek commented Sep 15, 2020

@vahutson I'm not sure this is a requestable permission? I can't find any documentation about it on https://developer.apple.com/documentation/

@fernandesrenan
Copy link

idk if this helps: https://developer.apple.com/forums/thread/654916

@zoontek
Copy link
Owner

zoontek commented Sep 25, 2020

@fernandesrenan Not really:

I see this question has been asked on the forums already, and there is no API.

@fernandesrenan
Copy link

@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?

@zoontek
Copy link
Owner

zoontek commented Sep 25, 2020

@fernandesrenan Totally. We are not wizards, Apple has to do its job.

@jimji1005
Copy link

@voulgarakis
Copy link

is there a way to request user to allow Local Network permission in iOS 14?

@geroale
Copy link
Contributor

geroale commented Apr 5, 2021

Same issue here

@mikehardy
Copy link

@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?

@MarinaAmy
Copy link

@vahutson resolve ?

@verybluebot
Copy link

verybluebot commented Dec 16, 2021

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

@astrahov

This comment was marked as spam.

@zameschua
Copy link

+1 for support this permission

@mikehardy
Copy link

@zameschua this is interesting, I think https://medium.com/hackernoon/i-thought-i-understood-open-source-i-was-wrong-cf54999c097b

@zoontek
Copy link
Owner

zoontek commented Feb 14, 2022

+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 🙂

@geraintwhite
Copy link
Contributor

geraintwhite commented May 18, 2022

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.

@mikehardy
Copy link

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

@geraintwhite geraintwhite linked a pull request May 19, 2022 that will close this issue
5 tasks
@elmcapp
Copy link

elmcapp commented Apr 14, 2023

@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

@polar-sh polar-sh bot added Fund Can be funded on Polar.sh and removed Fund Can be funded on Polar.sh labels Oct 16, 2023
@polar-sh polar-sh bot added the Fund Can be funded on Polar.sh label Nov 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request Fund Can be funded on Polar.sh
Projects
None yet
Development

Successfully merging a pull request may close this issue.