Notification permission app variable is not updated when notification permission is granted

Problem:
When the action “request system permission for notification” is run, the value in the app variable notification permission is not updated. So it is not possible to do any visibility decisions based on that app variable (e.g. hide a banner when notification is granted)

Expected behavior:
The app variable is refreshed after the action node has run to get the new value.

If the app is reloaded, the new value is read.

Tested on Iphone.

This should be documented as a known caveat if it is not deemed worthy of fixing.

UPDATE. Unfortunately there is more to it. After permission is granted on the mobile, and the app is reopenened by clicking the push notification itself, which links to the app, the app variable is mistakenly reported as “prompt” even though it is granted. This only happens when I open the app from the push notification and does NOT happen when I open the app from the icon on the home screen.

It is consistently reproducible. I can then approve push notifications again to put the status to granted after opening the app again, but it will go back to prompt when opening the app from a URL in a notification.

So, after granting app permission opening the app on two different ways yield a different value on the app variable.

  1. App is closed.
    A. open from shortcut on homescreen. notification permission: granted
    B. open app by clicking the notification which points to the url of the app. notification permission: prompt.

I will happily create a video if you do not believe this, I know it is hard… :smiley:

The consequence of these issues is that I can´t use the app variable since it is not reporting the correct state in all situations, so it would (if used) ask users to enable notification permission when it has already been given.

Hi!

There are some general issues with the Request Permissions on iPhone / Safari it seems, that have been introduced lately (probably some changes on Apple’s side). We’re investigating this further.

In your case: Can you inspect what the value of the built-in app variable Notification Permission is when you load the app, and what is logged in the console when you try to Request Permissions?

And: Do you have the same problem if you click Request Permissions from the app when it is installed on the home screen?

Based on the initial testing internally, it might seem like it is working when installed on device, but not when the app is running in the browser.

None of this is from browser, everything is from installed app on Iphone 14.

ISSUE 1
okay, from scratch (no installed app)
Open safari - point to app - login
add to home screen
open app from home screen. notification permission = prompt (Correct)
run action - enable notification - request system permission for notification (clicking “OK”)
notification permission = prompt (Wrong, should be Granted) → This is BUG #1
This bug I can workaround by checking if they have tried to grant permission and hide the button if they already did. Its not optimal.

If I try to enable notification again, the same is shown in the log but no popup appears (probably since its already granted)

Now I close the app and launch it again from the home screen
Now; notification permission is updated to Granted.
So this bug is just about getting the updated permission to show up in app variable. Notifications WORK after I accept it on the phone.

ISSUE 2
Close down the app. Open the app from a push notification that points to the app.
First open - granted
then I just close the app, send it a new push notification and open the app via the link in the push (this is how push is used in this app). here are the result from launching the app ten times. Every time i close the app again. NO other actions are taken. (The app permission IS there (Granted) and should be shown as granted every time - the push notification work…)
1 - prompt
2 - granted
3 - prompt
4 - prompt
5 - granted
6 - prompt
7 - prompt
8 - granted
9 - prompt
10 - granted

It is almost not possible to believe how this can be, but I have shared the app with you so you can check yourself. To me it looks like some kind of timing issue. It happens in both dev and prod possibly slightly more often in dev.

To summarize your questions

  1. values of the notification setting is documented above
  2. nothing happens in the log. it just displays that the action is run. If it is ACTUAL prompt, the prompt is shown. if it is ACTUAL granted, nothing happens when I run the action
  3. all of this is from home screen. Exactly the same things are displayed in the log in both situations.
  4. It works inconsistenly when installed on the device. We require everyone to install the app and run it from the home screen (to get a consistent experience :wink:

Hello!

It seems like requesting permissions on installed iPhone pwa does not update the built-in App Variable Notification Permission until refresh. Probably some timing issue. Challenge registered!

You might try to use the function return Notification.permission instead, and build logic towards that string instead (granted, denied, default are the possible values of that string)

1 Like

There is another issue here as well. If a user denies notifications (tested on iPhone), the action node fails and the notification status is still Prompt after relaunching the app.
Notification.permission is also default (prompt).

Expected behavior; action node does not fail, notification permission = denied.

Regards,