signalapp / Signal-iOS

A private messenger for iOS.
https://signal.org
GNU Affero General Public License v3.0
10.77k stars 3.02k forks source link

Missed Push Notifications for Messages Received During Periods of No Internet Connection #5747

Open MahdiNazemi opened 7 months ago

MahdiNazemi commented 7 months ago

Bug description

If a message is sent to a signal user during a period they have no internet connection, they will never receive a notification for that message unless they open the app. Additionally, the app icon badge does not reflect the correct number of unread messages (probably because of the same issue).

Steps to reproduce

Here are examples of situations that my family or I have experienced this issue:

Please note that all iPhones experiencing this issue had their background app refresh off for all apps, but Signal was the only app not showing any indication of new messages after regaining internet connectivity. In addition to that, in many instances, Signal was closed from the app switcher (so I assume the background app refresh settings have no impact anyway).

Re-registering push notifications does not solve the issue.

Actual result: No notifications are shown unless the user opens the app.

Expected result: Other apps show notifications after the user regains internet connection.

Device info

This issue was experienced on a variety of iPhones (e.g., 7, X, 15 Pro Max) for the past year or so.

Device: iPhone 15 Pro Max

iOS version: 17.3

Signal version: 6.58

stale[bot] commented 4 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

MahdiNazemi commented 4 months ago

Commenting to prevent the issue from being closed.

GithubUser452 commented 2 months ago

I experienced the same on my Android Phones.

Flip-ops commented 2 months ago

Hi, optimally you want all notifications when coming online. But there are limitations by design that hinders that possibility.

It might acctually be the expected result by design, but below numbered points do have an effect:

  1. How long time away from the internet?
  2. When you say ”they will never receive a notification for that message unless they open the app.”. Do you mean the user will receive a notifcation if they open the app, or do you simply mean they see the messages when opening the app?
  3. Since you are using iPhone, relevant info regarding there storage of Remote Push Notifications can be found in their offical documentations or W3C drafts etc. I would recomend reading up on APN specifically for Remote Notifications (in contrast to Local), and specifically on how it is stored, I can provide a sample below if the link becomes dead, as well as the corresponding sourcelink:

”If the destination device isn’t connected to APNs, then APNs saves the push notification in persistent storage to deliver later (unless it expires). APNs attempts to deliver an unexpired, stored push notification when the destination device connects to the APNs server the next time. When APNs delivers the push notification to the destination device, the delivery may take multiple attempts and some attempts may reach across multiple network interfaces. If the destination device is connected to APNs but it has power restrictions, APNs may defer delivery of a notification to conserve battery. In that case, APNs stores the notification in persistent storage. When the device revises its power assertions and removes the restriction on delivery, APNs reattempts to deliver the stored notification. When APNs tries to deliver a notification from the APNs persistent storage, it might get delivered successfully or get discarded, depending on a number of factors. See the figure below to understand the logical flow of a push notification getting discarded in APNs persistant storage.

While in APNs persistent storage, other notifications can overwrite notifications you send for the same device token and bundle ID. APNs persistent storage only stores one notification per application per device. If you send multiple notifications for the same bundle ID while APNs can’t deliver the notifications, APNs preserves only one of the accepted push notifications. Most of the time, it’s the last notification sent, but because APNs doesn’t have any ordering guarantees, this isn’t always the case.”

MahdiNazemi commented 15 hours ago
1. How long time away from the internet?

A few minutes to a few hours.

2. When you say ”they will never receive a notification for that message unless they open the app.”. Do you mean the user will receive a notifcation if they open the app, or do you simply mean they see the messages when opening the app?

When I open the app, I see the number of unread messages from each person or group.