-
Notifications
You must be signed in to change notification settings - Fork 24.5k
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
[General] [add] - Add openSettings method to Linking module #23965
[General] [add] - Add openSettings method to Linking module #23965
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your PR. I think it makes sense to have this cross platform feature right out of the box.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cpojer is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
46f0b23
to
4d7a951
Compare
@cpojer I ended up overriding your commit by mistake with my force push. I just updated it including a commit doing the same you did. Thanks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cpojer is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
That's alright, thanks for letting me know :) |
This pull request was successfully merged by @elucaswork in fa426cf. When will my fix make it into a release? | Upcoming Releases |
Summary
This will create a cross-platform and safe way to programmatically open the app's settings into the iOS /Android Settings app.
Right now it's possible to open the app's settings, but only for iOS via
Linking.openURL("app-settings:")
To do the same for Android, you need to either create NodeModule or install a dependency such as react-native-open-settings.
Why this new method is useful: since Android 6, app permissions work similar to iOS. It's granular and it's requested in the app runtime.
https://developer.android.com/guide/topics/permissions/overview#runtime_requests_android_60_and_higher
Thus, if the user checks the "Never ask again box" and taps "Deny", for some specific permission, the only way to change the permission is going to the Android Setting app.
And that's where this new method becomes useful. It'll allow our apps to programmatically send the the user to settings app.
Also,
openSettings()
doesn't receive a parameter to redirect to specific subsections of the Settings app because there's no public API to do it on iOS (there's a way to have, via private API, but it causes the app to get rejected.)Changelog
Create
Linking.openSettings()
for iOS and Android;[General] [add ] - Add openSetting method to Linking module
Test Plan
With
<Button onPress={() => Linking.openSettings()} title="Settings" color="#841584" />
it's possible to test this new method.TODO:
Linking
mock