Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setting up push notifications #23

Open
lemonspb opened this issue Aug 25, 2020 · 4 comments
Open

setting up push notifications #23

lemonspb opened this issue Aug 25, 2020 · 4 comments

Comments

@lemonspb
Copy link

Hi, is there a simple way to set up push notification through your app?

@arnav-t
Copy link
Owner

arnav-t commented Aug 25, 2020

Hello. Are you talking about desktop notifications?

@lemonspb
Copy link
Author

lemonspb commented Aug 25, 2020

yes, the question is rather what event should I listen to for push

@arnav-t
Copy link
Owner

arnav-t commented Aug 26, 2020

There aren't any globally visible events you can listen to yet. I can add something in the future to emit events for notifications.

@lemonspb
Copy link
Author

lemonspb commented Sep 17, 2020

here i found a pretty simple solution

sendingPushNotifications = (event) => {
          
        if (event.event.type === "m.room.message" 
        && event.event.sender !== this.props.userId 
        && document.hidden) {
            addNotification({
                title: `сообщение от ${event.sender.rawDisplayName}`,
                message: `${event.event.content.body}`,
                theme: 'darkblue',
                native: true
            });
        }
    };

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants