lbryio / lbry-desktop

A browser and wallet for LBRY, the decentralized, user-controlled content marketplace.
https://lbry.tech
MIT License
3.56k stars 413 forks source link

In browser notifications #6174

Closed mayeaux closed 3 years ago

mayeaux commented 3 years ago

This was originally in the PWA ticket but it's its own functionality and should probably warrant its own ticket.

Desired functionality: When a notification is received, a user receives either a push notification (mobile, only available natively on Android) or an in browser notification on desktop.

Requires registration of a serviceworker and a user opt-in, then should hook into the receiving of notifications from the backend

tzarebczan commented 3 years ago

@dan-peterson will take this one.

dan-peterson commented 3 years ago

@mayeaux @tzarebczan As discussed, pivoted away from any integration with websocket notifications as a step one and opted to get everything set up for the real deal.

Feedback needed / appreciated on the current draft: https://github.com/lbryio/lbry-desktop/pull/7212

Thanks again @mayeaux for the nodetube reference code as well.

dan-peterson commented 3 years ago

Regarding the copy and layout: Assuming that for now we won't be adding fine-grained control over desktop notifications, we could consider something like this:

001

We might want to handle handle the edge-case where a user has blocked notifications with something like this:

002

For improved UX we could also consider dimming / disabling the email settings, if the user has opted-out of email notifications entirely:

003

dan-peterson commented 3 years ago

Regarding back-end implementation there are two things we haven't talked about yet that we should keep in mind:

1) Payload: We're going to want to try to keep this as simple and light weight as possible. Ideally the service worker doesn't need to do any extra work with the data to generate the notification.

Something like the following is ideal:

{ 
    "title": "New Video on Odysee!", 
    "opts": { 
        "body": "Click here to check out the video.", 
        "data": { 
            "url" : "https://odysee.com/url/to/video"
        } 
    }
}

2) Multiple browser subscriptions: Do we want to allow? Is there a max? and can we detect closed subscriptions server side?

tzarebczan commented 3 years ago

Will get the discussion started on backend side for this. We'd probably want to put the channel name and title somewhere in the title/body too.

Since these will also work on mobile, "Desktop" notifications is a bad name. Browser Notifications?

dan-peterson commented 3 years ago

Since these will also work on mobile, "Desktop" notifications is a bad name. Browser Notifications?

Hah. Yep good point. Browser Notifications sounds right to me unless we think of something better later.

tzarebczan commented 3 years ago

Issue moved to OdyseeTeam/odysee-frontend #21 via ZenHub