if we're not granted, show an ErrorDialog with some text which needs changing

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2017-04-23 06:16:25 +01:00
parent 0590ce7faf
commit 5e8b43f3ed

View file

@ -20,6 +20,8 @@ import PlatformPeg from './PlatformPeg';
import TextForEvent from './TextForEvent'; import TextForEvent from './TextForEvent';
import Avatar from './Avatar'; import Avatar from './Avatar';
import dis from './dispatcher'; import dis from './dispatcher';
import sdk from './index';
import Modal from './Modal';
/* /*
* Dispatches: * Dispatches:
@ -131,6 +133,14 @@ const Notifier = {
plaf.requestNotificationPermission().done((result) => { plaf.requestNotificationPermission().done((result) => {
if (result !== 'granted') { if (result !== 'granted') {
// The permission request was dismissed or denied // The permission request was dismissed or denied
const description = result === 'denied'
? 'Your browser is not permitting this app to send you notifications.'
: 'It seems you didn\'t accept notifications when your browser asked';
const ErrorDialog = sdk.getComponent('dialogs.ErrorDialog');
Modal.createDialog(ErrorDialog, {
title: 'Unable to enable Notifications',
description,
});
return; return;
} }