Dimillian / Dimillian/IceCubesApp

Bug: NotificationService does not implement serviceExtensionTimeWillExpire

Open
#2,447 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Swift
Stars
7.1k
Forks
720
PR merge metrics
No merged PRs in 30d

Description

There are a few bugs like #2438 that mention getting blank notifications that just say "A new notification has been received."

It looks like NotificationService does not implement serviceExtensionTimeWillExpire which iOS will call when the extension is taking too long. That makes iOS fall back to showing whatever text your server put in the unencrypted APNS alert body which I'm assuming is "A new notification has been received." Implementing serviceExtensionTimeWillExpire and having it call contentHandler(bestAttemptContent) will let iOS use the title and body you decrypted and already set as bestAttemptContent.title and bestAttemptContent.body.

I did some testing by sending web pushes to your server and if I exclude the icon parameter from the encrypted payload, the notification text shows up properly.

If I include an icon parameter pointing to a valid URL, I can see on my server that the notification extension fetches the icon right away, but after about 30 seconds, a notification of "A new notification has been received." is posted and this gets logged on the device's console:

default	10:00:19.569634-0500	IceCubesNotifications	[D898FA6E-D54B-49B5-A649-5F0B8187B984] Service extension context initialized
default	10:00:19.569664-0500	IceCubesNotifications	Service extension was initialized
[...]
default	10:00:48.562565-0500	IceCubesNotifications	[D898FA6E-D54B-49B5-A649-5F0B8187B984] Service extension time will expire
error	10:00:48.562587-0500	IceCubesNotifications	Service extension base class recieved serviceExtensionTimeWillExpire

I would have submitted a pull request to implement serviceExtensionTimeWillExpire but the actual problem that causes the extension to hang should probably be fixed as well.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with NotificationService and the notification extension entry point, then reproduce the case where an encrypted payload includes an icon URL. Verify the extension's timeout behavior and the existing decrypted title and body handling; done means the timeout fallback is implemented and the icon-related hang is understood or fixed.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.