mozilla-mobile / firefox-ios

Firefox for iOS
Mozilla Public License 2.0
12.15k stars 2.91k forks source link

Nimbus iOS Messaging push notifications are not displayed #14335

Open Softvision-PatriciuPop opened 1 year ago

Softvision-PatriciuPop commented 1 year ago

Prerequisites

  1. Close the Firefox app.
  2. Change the system time to 2 days in the future.
  3. Observe the device's notifications tray.

    Expected behavior

┆Issue is synchronized with this Jira Task

data-sync-user commented 1 year ago

➤ Yoana Rios Diaz commented:

Patriciu Pop I’m getting up to speed with this bug as I’m not 100% familiar with this feature I did find however this Note to QA from the implementation ticket ( https://mozilla-hub.atlassian.net/browse/FXIOS-6019 ) For QA:

Please test that the engagement notification is send > 48h after first install when user is inactive after the first 24h and as well that it’s not send when the user is active in the second 24h. Additionally the users notification preferences need to be respected.

Please note that the notification will not be send exactly at 48h. The scheduling depends on when Apple wakes the app up in the background. It should happen every 4 hours but can also take much longer.

I think changing the system time right away to 2 days after might be breaking the flow of allowing Apple to wake up the app in the background and scheduling the notification.

data-sync-user commented 1 year ago

➤ Yoana Rios Diaz commented:

Andrei Bodea you tested https://mozilla-hub.atlassian.net/browse/FXIOS-6019 ( https://mozilla-hub.atlassian.net/browse/FXIOS-6019|smart-link ) and tip that you could share that will help testing this issue?

data-sync-user commented 1 year ago

➤ Yoana Rios Diaz commented:

Checking the implementation I realize we also check that the user allows “Tips and features“ in the App Settings > Notification

!Simulator Screenshot - iPhone 14 - 2023-05-11 at 13.33.11.png|width=1170,height=2532!

data-sync-user commented 1 year ago

➤ Patriciu Pop commented:

Hi Yoana Rios Diaz ! Sorry for the late reply, I’ve checked the device’s notification settings and the Firefox notifications are enabled. Also, I forgot to mention in the notes that I’ve enabled the “Tips and Features“ toggle in the app itself.

On the Android side changing the system time to 4h in the future was enough to trigger the notification. If we can’t use the same trick here is there another way we could force the notification to appear aside from waiting 2 days?

data-sync-user commented 1 year ago

➤ Yoana Rios Diaz commented:

Hi Patriciu Pop if the permission and Tips and Features are enabled I think the remaining issue is the background task to schedule the notification, we don’t have any control over this is Apple who wakes up the App which should happen every 4h.

I think is a good idea to first change the time to 4h after to see if that triggers the background task that schedules the notification. Another idea will be to install the app and wait 4h with the same purpose wait for the system to schedule the notification and then update the system time to 48h after the install.

data-sync-user commented 1 year ago

➤ Patriciu Pop commented:

I’ve tested just now by moving the time forward 4h, then 24h, and another 24h with no luck. I’ve set-up a new profile on the physical device and I’m waiting for the 4h to elapse before trying again. From what I saw there isn’t a notification option on the xcode simulator, is this something that can be verified only on physical devices?

data-sync-user commented 1 year ago

➤ Patriciu Pop commented:

Update: I’ve retested this by waiting 4h to pass naturally and then changed the system time in the future, but I haven’t managed to trigger the notifications. I also left the testing device on during the weekend and after 2 days no notifications were displayed.

thatswinnie commented 1 year ago

@Softvision-PatriciuPop I verified that the notifications are indeed working using TestFlight build 30885 as well as with a build from Xcode. Please note that using a simulator you will not get the notifications - you have to test on a real device. Apart from notifications being allowed and "Tips and Features" being enabled the app must also allow Background App Refresh. Could you check that this is enabled in Settings.app on your test device? Here is how I tested:

  1. Delete the existing app if installed
  2. Install app from TestFlight
  3. Go through onboarding and enable notifications
  4. Put the app in background
  5. Go to Settings.app and change the device time to +2 days and 2 minutes
  6. Wait a few minutes for the notification arrives

Hope that helps.

data-sync-user commented 1 year ago

➤ Patriciu Pop commented:

Hi Winnie! Thanks for the following up. I've verified that both the "Tips and Features" and "Background App Refresh" toggles are enabled and I've tried the steps provided above with and without being enrolled in the experiment. Sadly I could not get the notifications to trigger, I've also asked another colleague to verify this and she had the same issue.

data-sync-user commented 1 year ago

➤ Winnie Teichmann commented:

Patriciu Pop I made some changes that went into the latest Testflight build for v114 (31138) - could you please verify that the notifications work now?

data-sync-user commented 1 year ago

➤ Winnie Teichmann commented:

Patriciu Pop could you please test the new beta build (31343)? This one works for me even with developer mode off on the device.

data-sync-user commented 1 year ago

➤ Cosmin Muntean commented:

Hi Winnie Teichmann ! Patric is currently on PTO, but I have tried to verify this issue and I can still reproduce it, there is no notification triggered. I have verified this with the build for v114 (31343) from Test Flight on iPhone 13 mini (iOS 15.6). Here are the steps that I have tried:

  1. I have installed the (31343) build from Test Flight > Firefox Beta web browser > Previous Builds > 9000 > and tap on 9000 (31343) build to install it.
  2. Open the Firefox build.
  3. From the onboarding enable the notification.
  4. From Firefox Settings, tap 5 times on "Firefox 9000 (31343) to enable debug mode.
  5. Tap on the "Experiments" option.
  6. Tap on the "Edit" button from the Experiments page.
  7. Toggle the "Use Preview Collection" option.
  8. Restart the Firefox app twice.
  9. From Firefox Settings, tap 5 times on "Firefox 9000 (31343) to enable debug mode.
  10. Tap on the "Experiments" option then tap on the "Release iOS re-engagement notifications ..." experiment.
  11. Tap on any treatment branches.
  12. Sent the Firefox App in the background.
  13. Open the iOS Settings -> General > Time & Date > Disable the "Set Automatically" option and manually change the date 2 days and 2 minutes in the future.
  14. Close the iOS Settings and wait a few minutes.

Actual results:

I have also tried with the Firefox app closed, or restarting the Firefox app after enrolling in the experiment, but the notification is still not triggered. Please note that the movie device is not connected to any other devices. The "Background App Refresh" option is enabled.

Please let me know if I have missed any steps or if there is another Experiment that I can use for testing this.

data-sync-user commented 1 year ago

➤ Cosmin Muntean commented:

In the past few days, I have re-tested the iOS notifications using the Firefox Beta 9000 (31343) build on an iPhone 13 mini with iOS 15.6.

With the help received from Winnie Teichmann I have managed to trigger the notification from each treatment branch of the “Release iOS re-engagement notifications A/B experiment 114” experiment.

Considering this, we can mark this ticked as verified fixed.