NMF-earth/nmf-app

Present PermissionsRequest in Notification screen

PierreBresson opened this issue · 2 comments

Summary

Show PermissionsRequest component in Notification screen instead of opening settings with Linking.

NB: First to submit a valid PR, first to merge. Except if you already have merged some good code in this repo, I won’t assign any issue due to spam and beginners unable to complete a PR without a lot of help from my side.

As far as I'm concerned you can't show the permission pop up twice to a user once they've rejected.
I also agree that just sending users to settings might not be a good UX, rather showing a popup saying :
you've rejected before if you want you can go to settings and give permission manually (sth like that) & then two buttons yes/no sth

@BatDroid indeed, you are right, you can only ask once with the native popup/dialog/prompt.
The idea is to do the same as in the BarCodeScanScreen. When user open for the notification screen for the first time, he should see the native dialog with empty screen behind, like line 102 of BarCodeScanScreen :

  if (hasPermission === null) {
    return <View style={styles.container}></View>;
  }

And then if user has denied the authorization in the dialog show the component:

  if (!hasPermission) {
    return <PermissionsRequest type="notification" />;
  }

otherwise, show normal render.