mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-11-07 07:40:29 +03:00
fix notification crash on ios (#2192)
* fix notification crash for ios * access notification from window variable * fix Notification check * catch notification variable error * fix missing check for Notification
This commit is contained in:
parent
5460e4922b
commit
b12228ee95
4 changed files with 31 additions and 14 deletions
|
|
@ -8,7 +8,7 @@ import LogoUnreadSVG from '../../../../public/res/svg/cinny-unread.svg';
|
|||
import LogoHighlightSVG from '../../../../public/res/svg/cinny-highlight.svg';
|
||||
import NotificationSound from '../../../../public/sound/notification.ogg';
|
||||
import InviteSound from '../../../../public/sound/invite.ogg';
|
||||
import { setFavicon } from '../../utils/dom';
|
||||
import { notificationPermission, setFavicon } from '../../utils/dom';
|
||||
import { useSetting } from '../../state/hooks/settings';
|
||||
import { settingsAtom } from '../../state/settings';
|
||||
import { allInvitesAtom } from '../../state/room-list/inviteList';
|
||||
|
|
@ -110,7 +110,7 @@ function InviteNotifications() {
|
|||
|
||||
useEffect(() => {
|
||||
if (invites.length > perviousInviteLen && mx.getSyncState() === 'SYNCING') {
|
||||
if (showNotifications && Notification.permission === 'granted') {
|
||||
if (showNotifications && notificationPermission('granted')) {
|
||||
notify(invites.length - perviousInviteLen);
|
||||
}
|
||||
|
||||
|
|
@ -212,7 +212,7 @@ function MessageNotifications() {
|
|||
return;
|
||||
}
|
||||
|
||||
if (showNotifications && Notification.permission === 'granted') {
|
||||
if (showNotifications && notificationPermission('granted')) {
|
||||
const avatarMxc =
|
||||
room.getAvatarFallbackMember()?.getMxcAvatarUrl() ?? room.getMxcAvatarUrl();
|
||||
notify({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue