-
Notifications
You must be signed in to change notification settings - Fork 4
feat(backup): automatic daily OPFS snapshot and silent Drive upload #62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,7 @@ import { | |
| getDaysSinceLastBackup, | ||
| markBackupReminderBannerShown, | ||
| shouldShowBackupReminderBanner, | ||
| toDateKey, | ||
| } from "@/lib/backup"; | ||
| import { type BackupReminderSchedule } from "@/db/userPreferences"; | ||
| import { BackupReminderBanner } from "@/components/BackupReminderBanner"; | ||
|
|
@@ -37,8 +38,24 @@ function getLastBackupText(daysSinceLastBackup: number | null): string { | |
| return `Last backup: ${daysSinceLastBackup} day${daysSinceLastBackup === 1 ? "" : "s"} ago.`; | ||
| } | ||
|
|
||
| const AUTO_BACKUP_FAILURE_THRESHOLD = 3; | ||
|
|
||
| function getInitialPromptState(): PromptState { | ||
| const preferences = getBackupReminderPreferences(); | ||
|
|
||
| // Sustained automatic-backup failure escalates to this same banner surface, gated by the | ||
| // existing once-a-day bannerLastShownDate check — one banner, not a daily nag on top of it. | ||
| if ( | ||
| preferences.autoBackupFailures >= AUTO_BACKUP_FAILURE_THRESHOLD && | ||
| preferences.bannerLastShownDate !== toDateKey(new Date()) | ||
| ) { | ||
| return { | ||
| visible: true, | ||
| schedule: preferences.reminderSchedule, | ||
| message: "Automatic backup has failed for 3 days in a row. Check your connection or Drive link.", | ||
|
Comment on lines
+49
to
+55
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Do not describe attempt failures as daily failures.
🤖 Prompt for AI Agents |
||
| }; | ||
| } | ||
|
|
||
| const visible = shouldShowBackupReminderBanner(preferences); | ||
|
|
||
| if (!visible) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
The Phase 4 heading now collides with a second Phase 4 section.
This heading changed to "Phase 4: Client-Side Encryption (Shipped)". Line 509 still carries "### Phase 4: Import from Drive (Low Priority, Future)". The document therefore has two Phase 4 sections, and the second one duplicates the Phase 5 section at line 499. The header at lines 4-5 states that Phase 5 is the only remaining scope, so the stale section contradicts it.
Delete the leftover section at lines 509-517.
🤖 Prompt for AI Agents