-
Notification Settings
+
Device Notification
-
Manage your notification settings
+
Manage your Device Notificaiton
+
+
+ Device Notification
+ {Capacitor.isNativePlatform()? 'Receive notification on your device when a task is due' : 'This feature is only available on mobile devices'}
+
+ {
+ event.preventDefault()
+ if (deviceNotification === false){
+ LocalNotifications.requestPermissions().then((resp) => {
+ if (resp.display === 'granted') {
+
+ setDeviceNotification(true)
+ setNotificationPreferences({granted: true})
+ }
+ else if (resp.display === 'denied') {
+ setIsSnackbarOpen(true)
+ setDeviceNotification(false)
+ setNotificationPreferences({granted: false})
+ }
+ })
+ }
+ else{
+ setDeviceNotification(false)
+ }
+ }
+ }
+ color={deviceNotification ? 'success' : 'neutral'}
+ variant={deviceNotification ? 'solid' : 'outlined'}
+ endDecorator={deviceNotification ? 'On' : 'Off'}
+ slotProps={{
+ endDecorator: {
+ sx: {
+ minWidth: 24,
+ },
+ },
+ }}
+ />
+
+{deviceNotification && (
+
+ {[
+ {
+ 'title': 'Due Date Notification',
+ 'checked': dueNotification,
+ 'set': setDueNotification,
+ 'label': 'Notification when the task is due',
+ 'property': 'dueNotification',
+ 'disabled': false
+ },
+ {
+ 'title': 'Pre-Due Date Notification',
+ 'checked': preDueNotification,
+ 'set': setPreDueNotification,
+ 'label': 'Notification a few hours before the task is due',
+ 'property': 'preDueNotification',
+ 'disabled': true
+ },
+ {
+ 'title': 'Overdue Notification',
+ 'checked': naggingNotification,
+ 'set': setNaggingNotification,
+ 'label': 'Notification when the task is overdue',
+ 'property': 'naggingNotification',
+ 'disabled': true
+ }
+]
+ .map(item => (
+
+
+ {item.title}
+ {item.label}
+
+
+ {
+ setNotificationPreferences({[item.property]: !item.checked})
+ item.set(!item.checked)
+ }}
+ color={item.checked ? 'success' : ''}
+ variant='solid' endDecorator={item.checked ? 'On' : 'Off'} slotProps={{ endDecorator: { sx: { minWidth: 24 } } }} />
+
+ ))}
+
+)}
+ {/*
+
+ Push Notifications
+ {Capacitor.isNativePlatform()? 'Receive push notification when someone complete task' : 'This feature is only available on mobile devices'}
+
+ {
+ event.preventDefault()
+ if (pushNotification === false){
+ PushNotifications.requestPermissions().then((resp) => {
+ console.log("user PushNotifications permission",resp);
+ if (resp.receive === 'granted') {
+
+ setPushNotification(true)
+ setPushNotificationPreferences({granted: true})
+ }
+ if (resp.receive!== 'granted') {
+ setIsSnackbarOpen(true)
+ setPushNotification(false)
+ setPushNotificationPreferences({granted: false})
+ console.log("User denied permission", resp)
+
+ }
+ })
+ }
+ else{
+ setPushNotification(false)
+ }
+ }
+ }
+ color={pushNotification ? 'success' : 'neutral'}
+ variant={pushNotification ? 'solid' : 'outlined'}
+ endDecorator={pushNotification ? 'On' : 'Off'}
+ slotProps={{
+ endDecorator: {
+ sx: {
+ minWidth: 24,
+ },
+ },
+ }}
+ />
+ */}
+
+
+
Custom Notification
+
+
Notificaiton through other platform like Telegram or Pushover
+
+
+
+
+ Custom Notification
+ Receive notification on other platform
+
+ {
+ event.preventDefault()
+ if (chatID !== 0){
+ setChatID(0)
+ }
+ else{
+ setChatID('')
+ UpdateUserDetails({
+ chatID: Number(0),
+ }).then(resp => {
+ resp.json().then(data => {
+ setUserProfile(data)
+ })
+ })
+ }
+ setNotificationTarget('0')
+ handleSave()
+
+ }
+
+ }
+ color={chatID!==0 ? 'success' : 'neutral'}
+ variant={chatID!==0 ? 'solid' : 'outlined'}
+ endDecorator={chatID!==0 ? 'On' : 'Off'}
+ slotProps={{
+ endDecorator: {
+ sx: {
+ minWidth: 24,
+ },
+ },
+ }}
+ />
+
+ {chatID !== 0&& (
+
+
+ )}
+
setIsSnackbarOpen(false)} endDecorator={ setIsSnackbarOpen(false)}>}>
+
+ Permission Denied
+
+ You have denied the permission to receive notification on this device. Please enable it in your device settings
+
+
+
)
}
diff --git a/src/views/components/NavBar.jsx b/src/views/components/NavBar.jsx
index 6545ac7..742da5d 100644
--- a/src/views/components/NavBar.jsx
+++ b/src/views/components/NavBar.jsx
@@ -120,6 +120,7 @@ const NavBar = () => {
tick✓
+