Closed Bug 1775136 Opened 2 years ago Closed 2 years ago

Support `requireInteraction` and `actions` in alert service and Windows native notifications

Categories

(Toolkit Graveyard :: Notifications and Alerts, enhancement)

enhancement

Tracking

(firefox104 fixed)

RESOLVED FIXED
104 Branch
Tracking Status
firefox104 --- fixed

People

(Reporter: nalexander, Assigned: nalexander)

References

(Blocks 2 open bugs)

Details

(Whiteboard: [fidedi-notifications])

Attachments

(2 files)

Right now, Firefox does not support requireInteraction from the Web Notifications API: see Bug 1417846 for DOM exposure, Bug 1417848 for Web Extension exposure, etc. This ticket is more narrow: I would like to be able to specify requireInteraction to the Alert service in some form for use in Bug 1775128; it might just be a chrome-only option.

This is conceptually similar to Bug 1771164.

  1. requireInteraction already existed, but it doesn't do anything.
    This patch makes it mean scenario="reminder" in the Windows Toast
    notification schema: see
    https://docs.microsoft.com/en-us/uwp/schemas/tiles/toastschema/element-toast.

  2. actions is intended to eventually support the Chrome-only
    extension to the Web Notifications API: see
    https://developer.mozilla.org/en-US/docs/Web/API/Notification/actions.

  3. We run into an xpconnect limit on the number of supported
    parameters. Rather than bump the limit, which has global consequence,
    I added a second init* method. The existing abstraction is
    horrible, but I can't rework it within my timelines. Should we choose
    to invest, we might migrate to WebIDL so that we can sensibly use
    options objects.

  4. I intend to follow with a commit that adds
    nsIWindowsAlertService, exposing both the produced XML for testing
    but also some Windows-specific options like changing the toast
    template and making any provided image be a hero image.

This also provides an entry point for Windows-specific styling of
alerts, should specific consumers want one: e.g.,
nsIWindowsAlertsService.showWindowsAlert(...) allowing to configure
the toast template, for example.

Assignee: nobody → nalexander
Status: NEW → ASSIGNED
Attachment #9283532 - Attachment description: WIP: Bug 1775136 - Support `requireInteraction` and `actions` in alert service and native Windows notifications. → Bug 1775136 - Part 2: Support `requireInteraction` and `actions` in alert service and native Windows notifications. r?mhowell!,nrishel!,smaug!
Summary: Support `requireInteraction` in Windows native notifications → Support `requireInteraction` and `actions` in alert service and Windows native notifications
Blocks: 1778596

smaug: are you the right person to review this (alert service/notifications stuff)? Please suggest somebody else if not.

Flags: needinfo?(bugs)
Pushed by nalexander@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/5e75e93d9ba3
Part 1: Add `nsIWindowsAlertService` to enable testing. r=mhowell
https://hg.mozilla.org/integration/autoland/rev/bfa523daaf13
Part 2: Support `requireInteraction` and `actions` in alert service and native Windows notifications. r=mhowell,smaug
Pushed by nalexander@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c0e9183224fb
Part 1: Add `nsIWindowsAlertService` to enable testing. r=mhowell
https://hg.mozilla.org/integration/autoland/rev/e3c0f3ee6bd1
Part 2: Support `requireInteraction` and `actions` in alert service and native Windows notifications. r=mhowell,smaug
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 104 Branch

(I was on vacation last week, so the review too a bit time ;) )

Flags: needinfo?(bugs)
Flags: needinfo?(nalexander)
Whiteboard: [fidedi-notifications]
Blocks: 1805514
Product: Toolkit → Toolkit Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: