mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 23:19:40 +01:00
mobile: save last set notification mode
This commit is contained in:
@@ -20,9 +20,9 @@ import React, { RefObject, useRef, useState } from "react";
|
||||
import {
|
||||
Platform,
|
||||
ScrollView,
|
||||
View,
|
||||
TextInput,
|
||||
useWindowDimensions
|
||||
useWindowDimensions,
|
||||
View
|
||||
} from "react-native";
|
||||
import ActionSheet from "react-native-actions-sheet";
|
||||
import DateTimePickerModal from "react-native-modal-datetime-picker";
|
||||
@@ -36,17 +36,16 @@ import { SIZE } from "../../../utils/size";
|
||||
import { Button } from "../../ui/button";
|
||||
import Input from "../../ui/input";
|
||||
|
||||
import { formatReminderTime } from "@notesnook/core/collections/reminders";
|
||||
import dayjs from "dayjs";
|
||||
import Icon from "react-native-vector-icons/MaterialCommunityIcons";
|
||||
import DatePicker from "react-native-date-picker";
|
||||
import { db } from "../../../common/database";
|
||||
import Navigation from "../../../services/navigation";
|
||||
import Notifications, { Reminder } from "../../../services/notifications";
|
||||
import { useRelationStore } from "../../../stores/use-relation-store";
|
||||
import Paragraph from "../../ui/typography/paragraph";
|
||||
import PremiumService from "../../../services/premium";
|
||||
import DatePicker from "react-native-date-picker";
|
||||
import SettingsService from "../../../services/settings";
|
||||
import { useRelationStore } from "../../../stores/use-relation-store";
|
||||
import { ReminderTime } from "../../ui/reminder-time";
|
||||
import Paragraph from "../../ui/typography/paragraph";
|
||||
|
||||
type ReminderSheetProps = {
|
||||
actionSheetRef: RefObject<ActionSheet>;
|
||||
@@ -113,7 +112,7 @@ export default function ReminderSheet({
|
||||
);
|
||||
const [reminderNotificationMode, setReminderNotificatioMode] = useState<
|
||||
Reminder["priority"]
|
||||
>(reminder?.priority || "silent");
|
||||
>(reminder?.priority || SettingsService.get().reminderNotificationMode);
|
||||
const [isDatePickerVisible, setDatePickerVisibility] = useState(false);
|
||||
const [repeatFrequency, setRepeatFrequency] = useState(1);
|
||||
const title = useRef<string | undefined>(reminder?.title);
|
||||
@@ -480,11 +479,13 @@ export default function ReminderSheet({
|
||||
: "gray"
|
||||
}
|
||||
onPress={() => {
|
||||
setReminderNotificatioMode(
|
||||
ReminderNotificationModes[
|
||||
mode as keyof typeof ReminderNotificationModes
|
||||
] as Reminder["priority"]
|
||||
);
|
||||
const _mode = ReminderNotificationModes[
|
||||
mode as keyof typeof ReminderNotificationModes
|
||||
] as Reminder["priority"];
|
||||
SettingsService.set({
|
||||
reminderNotificationMode: _mode
|
||||
});
|
||||
setReminderNotificatioMode(_mode);
|
||||
}}
|
||||
/>
|
||||
))}
|
||||
@@ -539,7 +540,6 @@ export default function ReminderSheet({
|
||||
alignSelf: "flex-start"
|
||||
}}
|
||||
/>
|
||||
|
||||
</ScrollView>
|
||||
<Button
|
||||
style={{
|
||||
|
||||
@@ -23,6 +23,7 @@ import { FileType } from "react-native-scoped-storage";
|
||||
import create, { State } from "zustand";
|
||||
import { ACCENT } from "../utils/color-scheme";
|
||||
import { initialWindowMetrics } from "react-native-safe-area-context";
|
||||
import { Reminder } from "../services/notifications";
|
||||
|
||||
export type Settings = {
|
||||
showToolbarOnTop?: boolean;
|
||||
@@ -67,6 +68,7 @@ export type Settings = {
|
||||
disableSync?: boolean;
|
||||
reminderNotifications?: boolean;
|
||||
defaultSnoozeTime?: string;
|
||||
reminderNotificationMode: Reminder["priority"];
|
||||
corsProxy: string;
|
||||
disableRealtimeSync?:boolean
|
||||
};
|
||||
@@ -143,7 +145,8 @@ export const useSettingStore = create<SettingStore>((set) => ({
|
||||
doubleSpacedLines: true,
|
||||
reminderNotifications: true,
|
||||
defaultSnoozeTime: "5",
|
||||
corsProxy: "https://cors.notesnook.com"
|
||||
corsProxy: "https://cors.notesnook.com",
|
||||
reminderNotificationMode: "urgent"
|
||||
},
|
||||
sheetKeyboardHandler: true,
|
||||
fullscreen: false,
|
||||
|
||||
Reference in New Issue
Block a user