Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

web: add setting to control reminder notifications

Abdullah Atta9b747d1d2bbf
diff --git a/apps/web/src/stores/reminder-store.js b/apps/web/src/stores/reminder-store.js
index 8d99993c3..321f1f421 100644
--- a/apps/web/src/stores/reminder-store.js
+++ b/apps/web/src/stores/reminder-store.js
@@ -24,6 +24,7 @@ import { groupReminders } from "@notesnook/core/utils/grouping";
import { TaskScheduler } from "../utils/task-scheduler";
import { showReminderPreviewDialog } from "../common/dialog-controller";
import dayjs from "dayjs";
+import Config from "../utils/config";
class ReminderStore extends BaseStore {
reminders = [];
@@ -74,6 +75,8 @@ async function resetReminders(reminders) {
function scheduleReminder(id, reminder, cron) {
return TaskScheduler.register(`reminder:${id}`, cron, () => {
+ if (!Config.get("reminderNotifications", true)) return;
+
const notification = new Notification(reminder.title, {
body: reminder.description,
vibrate: reminder.priority === "vibrate",
diff --git a/apps/web/src/views/settings.js b/apps/web/src/views/settings.js
index 73e22b3fd..db4df703d 100644
--- a/apps/web/src/views/settings.js
+++ b/apps/web/src/views/settings.js
@@ -135,6 +135,7 @@ function Settings() {
importer: false,
privacy: false,
developer: false,
+ notifications: false,
other: true
});
const isVaultCreated = useAppStore((store) => store.isVaultCreated);
@@ -179,6 +180,8 @@ function Settings() {
"telemetry",
true
);
+ const [showReminderNotifications, setShowReminderNotifications] =
+ usePersistentState("reminderNotifications", true);
useEffect(() => {
(async () => {
@@ -528,6 +531,25 @@ function Settings() {
</Button>
</>
)}
+
+ <Header
+ title="Notifications"
+ isOpen={groups.notifications}
+ onClick={() => {
+ setGroups((g) => ({ ...g, notifications: !g.notifications }));
+ }}
+ />
+ {groups.notifications && (
+ <>
+ <Toggle
+ title="Show reminder notifications"
+ onTip="Reminder notifications will be shown on this device"
+ offTip="Reminder notifications will not be shown on this device"
+ onToggled={() => setShowReminderNotifications((s) => !s)}
+ isToggled={showReminderNotifications}
+ />
+ </>
+ )}
<Header
testId={"backup-restore"}
title="Backup & restore"