-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1482 from RoboSats/disable-android-notifications
Manually disable android notifications
- Loading branch information
Showing
28 changed files
with
1,364 additions
and
1,374 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import React, { useContext, useEffect, useState } from 'react'; | ||
import { Box, CircularProgress, useTheme } from '@mui/material'; | ||
import { NotificationsActive, NotificationsOff } from '@mui/icons-material'; | ||
import { AppContext, UseAppStoreType } from '../../contexts/AppContext'; | ||
import { systemClient } from '../../services/System'; | ||
|
||
const NotificationSwitchBadge = (): JSX.Element => { | ||
const { setSettings, settings, torStatus } = useContext<UseAppStoreType>(AppContext); | ||
const theme = useTheme(); | ||
|
||
const [stopNotifications, setStopNotifications] = useState<boolean>(settings.stopNotifications); | ||
|
||
useEffect(() => { | ||
setStopNotifications(settings.stopNotifications); | ||
}, [settings.stopNotifications]); | ||
|
||
const onClick = () => { | ||
if (torStatus === 'ON' || !settings.useProxy) { | ||
setSettings({ ...settings, stopNotifications: !settings.stopNotifications }); | ||
systemClient.setItem('settings_stop_notifications', String(!settings.stopNotifications)); | ||
} | ||
}; | ||
|
||
const style = { | ||
width: 20, | ||
height: 20, | ||
color: stopNotifications ? theme.palette.secondary.main : theme.palette.primary.main, | ||
}; | ||
|
||
return ( | ||
<Box sx={{ display: 'inline-flex', position: 'fixed', right: '0.5em', top: '0.5em' }}> | ||
<Box> | ||
{torStatus === 'ON' || !settings.useProxy ? ( | ||
<> | ||
{stopNotifications ? ( | ||
<NotificationsOff sx={style} onClick={onClick} /> | ||
) : ( | ||
<NotificationsActive sx={style} onClick={onClick} /> | ||
)} | ||
</> | ||
) : ( | ||
<CircularProgress thickness={6} size={22} /> | ||
)} | ||
</Box> | ||
</Box> | ||
); | ||
}; | ||
|
||
export default NotificationSwitchBadge; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.