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

iOS: Link to System Preferences for app permissions when necessary #3814

Open
chrisbobbe opened this issue Jan 16, 2020 · 5 comments
Open

iOS: Link to System Preferences for app permissions when necessary #3814

chrisbobbe opened this issue Jan 16, 2020 · 5 comments
Labels
a-compose/send Compose box, autocomplete, camera/upload, outbox, sending a-iOS a-onboarding Everything you would do when first joining a realm.

Comments

@chrisbobbe
Copy link
Contributor

iOS has a quirk where an app can only display the native alert requesting a specific permission once. If the user declines, and then they retry the action that requires the permission (and on all subsequent retries), it will fail. Currently, we handle this by displaying, e.g., “Error: photo library permissions not granted.” Instead, let’s provide a button that will navigate to the Zulip page in System Preferences and prompt the user to grant it manually. (I know there’s a way to do this linking, as I’ve done it before, but I can’t remember exactly — I think we can use the Linking API from React Native.)

@chrisbobbe chrisbobbe changed the title iOS: Link to app permissions when necessary iOS: Link to System Preferences for app permissions when necessary Jan 16, 2020
@chrisbobbe chrisbobbe added a-compose/send Compose box, autocomplete, camera/upload, outbox, sending a-iOS labels Jan 16, 2020
@gnprice gnprice added the a-onboarding Everything you would do when first joining a realm. label Feb 1, 2020
@jainkuniya jainkuniya self-assigned this Feb 6, 2020
@jainkuniya
Copy link
Member

I think we can use the Linking API from React Native.)

Yes, it will look like:

Linking.openURL('app-settings:')

I am thinking of adding a button (in right hand side, and rename current ok button to cancel) in current alert to open system preferences.

@gnprice @chrisbobbe thoughts?

@gnprice
Copy link
Member

gnprice commented Feb 20, 2020

I am thinking of adding a button (in right hand side, and rename current ok button to cancel) in current alert to open system preferences.

For the UI: we should do whatever is the standard thing that Apple recommends to do here. So the next step for figuring out the right UI is to find the relevant Apple documentation and see what it says.

@chrisbobbe
Copy link
Contributor Author

chrisbobbe commented Feb 20, 2020

Yes, it will look like:

Linking.openURL('app-settings:')

Ah, it looks like there's a safer way to do it in RN v0.60.0 (#3548), just Linking.openSettings(): facebook/react-native@fa426cf. It's probably not a bad idea to wait for RN v0.60.0 so we know all releases use the safer code, and we expect to be on v0.60.0 soon (EDIT: marking this as "blocked" for that reason).

I am thinking of adding a button (in right hand side, and rename current ok button to cancel) in current alert to open system preferences.

I think a two-button alert, with "Cancel" on the left and "Open Settings" on the right would be in line with the Human Interface Guidelines on Alerts. I wonder if we can produce the alert message itself by programmatically accessing the "usage string" for the particular permission: e.g., NSPhotoLibraryUsageDescription in Info.plist. On the other hand, perhaps we should have a more generic message, so there's a clear path forward for translations.

Apple's doc on requesting access to protected resources doesn't have specific guidance on navigating the user to Settings on access attempts following the first.

@chrisbobbe chrisbobbe added the blocked on other work To come back to after another related PR, or some other task. label Feb 20, 2020
@jainkuniya
Copy link
Member

jainkuniya commented Feb 22, 2020

facebook/react-native@fa426cf

Cool! wow, they have added support for Android as well. This will fix our Android case as well at the same time.

I think a two-button alert, with "Cancel" on the left and "Open Settings"

Agree 👍

Currently we get
image
as string in error. We can use this and append Open setting to grant now.

@gnprice
Copy link
Member

gnprice commented Jun 8, 2020

And that RN upgrade is complete! So we should now be able to do this using that improved support.

@gnprice gnprice removed the blocked on other work To come back to after another related PR, or some other task. label Jun 8, 2020
chrisbobbe added a commit to chrisbobbe/zulip-mobile that referenced this issue Oct 26, 2021
chrisbobbe added a commit to chrisbobbe/zulip-mobile that referenced this issue Oct 26, 2021
chrisbobbe added a commit to chrisbobbe/zulip-mobile that referenced this issue Oct 26, 2021
… first

An instance of zulip#3814.

Also log to Sentry when the error isn't one we've handled yet.
Somena1 pushed a commit to Somena1/zulip-mobile that referenced this issue Nov 4, 2021
… first

An instance of zulip#3814.

Also log to Sentry when the error isn't one we've handled yet.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a-compose/send Compose box, autocomplete, camera/upload, outbox, sending a-iOS a-onboarding Everything you would do when first joining a realm.
Projects
None yet
Development

No branches or pull requests

3 participants