Skip to content

Bugfix: schedule local notifications without a delegate - #555

Merged
fhasse95 merged 4 commits into
skiptools:mainfrom
shiaho777:fix-schedule-local-notifications
Oct 22, 2026
Merged

fhasse95 merged 4 commits into
skiptools:mainfrom
shiaho777:fix-schedule-local-notifications

Conversation

@shiaho777

Copy link
Copy Markdown
Contributor

UNUserNotificationCenter.add returned without scheduling anything unless a delegate was set and willPresent included .banner or .alert. On iOS, add schedules the notification either way, and willPresent runs only when a notification fires while the app is in the foreground.

Scheduling no longer consults the delegate. NotificationWorker also used to call IconCompat.createWithResource with resource id 0 when the app had neither ic_notification nor ic_launcher, which failed the worker. It now falls back to android.R.drawable.stat_notify_chat.

add() returned without enqueueing work unless a delegate was set and willPresent included banner or alert. Scheduling no longer depends on that callback. NotificationWorker also uses a platform status icon when the app has neither a notification icon nor a launcher icon, instead of failing on resource id 0.
@cla-bot

cla-bot Bot commented Oct 9, 2026

Copy link
Copy Markdown

Thank you for your pull request and welcome to the Skip community. We require contributors to sign our contributor license agreement (CLA), and we don't seem to have the user(s) @shiaho777 on file. In order for us to review and merge your code, for each noted user please add your GitHub username to Skip's .clabot file

@shiaho777

Copy link
Copy Markdown
Contributor Author

@cla-bot recheck

@cla-bot cla-bot Bot added the cla-signed label Oct 13, 2026
@shiaho777

Copy link
Copy Markdown
Contributor Author

Yes. IconCompat.createWithResource(context, id) records the app package, and android.R.drawable.stat_notify_chat is not in that package, so the fallback could fail while resolving the icon.

When neither ic_notification nor ic_launcher exists, the fallback is now IconCompat.createWithResource("android", android.R.drawable.stat_notify_chat). An icon from the app package still uses createWithResource(context, resId).

Head is c65380d. I did not run an Android notification posting pass here.

@fhasse95

Copy link
Copy Markdown
Member

Thanks for addressing my previous comment! Unfortunately, the pipeline now fails because IconCompat.createWithResource() expects a Context, not a String.

I think we could use context.createPackageContext("android", 0) to obtain the framework context and then pass that to IconCompat.createWithResource(). That should resolve the package mismatch while keeping the fallback icon.

@shiaho777

Copy link
Copy Markdown
Contributor Author

The fallback now takes a Context from context.createPackageContext("android", 0) and passes that to IconCompat.createWithResource. The framework status icon is resolved from the android package. An icon that exists in the app package still uses the app context.

Head is 157daca2c329346d32068a22ba9fbff855e90b23. I did not run the Skip framework build locally.

@fhasse95

Copy link
Copy Markdown
Member

Looks good! I think we can merge it once CI passes 😊👍🏻

@fhasse95
fhasse95 merged commit fb1c589 into skiptools:main Oct 22, 2026
2 checks passed
Ceylo pushed a commit to Ceylo/skip-ui that referenced this pull request Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants