From 210549445e63b2643d9dddae7ff04c53286141b0 Mon Sep 17 00:00:00 2001 From: Ammar Ahmed <40239442+ammarahm-ed@users.noreply.github.com> Date: Fri, 16 Jan 2026 10:55:40 +0500 Subject: [PATCH] global: add support for expiring notes (#9167) * core: expiring notes * core: add tests * mobile: support setting not expiry date * web: support note expiry dates Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com> * core: add tests for expiring notes * core: fix tests * mobile: delete expiring notes at startup * core: create index on expiry date * core: minor refactor * core: remove `.only` sync test * web: refactors * mobile: set limit on expiring notes * web: improve expiry date menu option && note item ui Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com> * web: add premium check for setting expiry for notes Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com> * web: move note expiry date dialog into its own file && minor changes Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com> * web: delete expired notes on startup * web: minor refactors --------- Co-authored-by: 01zulfi <85733202+01zulfi@users.noreply.github.com> Co-authored-by: Abdullah Atta --- .../app/components/date-picker/index.tsx | 66 +++++++++ apps/mobile/app/components/dialog/index.tsx | 1 - .../app/components/properties/index.jsx | 2 + .../app/components/properties/items.tsx | 2 + apps/mobile/app/hooks/use-actions.tsx | 52 ++++++- apps/mobile/app/hooks/use-app-events.tsx | 26 ++++ apps/mobile/fonts/MaterialCommunityIcons.ttf | Bin 25412 -> 26012 bytes apps/mobile/package-lock.json | 8 +- apps/mobile/scripts/optimize-fonts.mjs | 5 +- apps/web/src/app-effects.tsx | 7 +- apps/web/src/app.tsx | 5 - apps/web/src/common/index.ts | 9 ++ apps/web/src/common/notices.ts | 1 - apps/web/src/components/icons/index.tsx | 4 - apps/web/src/components/note/index.tsx | 68 ++++++++- .../src/dialogs/note-expiry-date-dialog.tsx | 130 ++++++++++++++++++ .../common/src/utils/is-feature-available.ts | 11 ++ packages/core/__e2e__/sync.test.js | 53 +++++++ packages/core/__tests__/notes.test.ts | 56 +++++++- packages/core/__tests__/trash.test.ts | 4 +- packages/core/src/api/sync/merger.ts | 22 +++ packages/core/src/collections/notes.ts | 29 +++- packages/core/src/collections/trash.ts | 16 ++- packages/core/src/database/index.ts | 4 + packages/core/src/database/migrations.ts | 13 ++ packages/core/src/types.ts | 6 +- packages/intl/locale/en.po | 12 ++ packages/intl/locale/pseudo-LOCALE.po | 12 ++ packages/intl/src/strings.ts | 5 +- 29 files changed, 591 insertions(+), 38 deletions(-) create mode 100644 apps/mobile/app/components/date-picker/index.tsx create mode 100644 apps/web/src/dialogs/note-expiry-date-dialog.tsx diff --git a/apps/mobile/app/components/date-picker/index.tsx b/apps/mobile/app/components/date-picker/index.tsx new file mode 100644 index 000000000..7abf8ee47 --- /dev/null +++ b/apps/mobile/app/components/date-picker/index.tsx @@ -0,0 +1,66 @@ +import { useThemeColors } from "@notesnook/theme"; +import { useRef } from "react"; +import { View } from "react-native"; +import { defaultBorderRadius } from "../../utils/size"; +import { DefaultAppStyles } from "../../utils/styles"; +import DatePicker from "react-native-date-picker"; +import dayjs from "dayjs"; +import { strings } from "@notesnook/intl"; +import { Button } from "../ui/button"; + +export default function DatePickerComponent(props: { + onConfirm: (date: Date) => void; + onCancel: () => void; +}) { + const { colors, isDark } = useThemeColors(); + const dateRef = useRef(dayjs().add(1, "day").toDate()); + return ( + + { + close?.(); + }} + date={dateRef.current} + onDateChange={(date) => { + dateRef.current = date; + }} + /> + +