Skip to content

feat(backup): timestamp the exported config filename#30

Merged
BlackHole1 merged 1 commit into
mainfrom
imporve-export-name
Jun 23, 2026
Merged

feat(backup): timestamp the exported config filename#30
BlackHole1 merged 1 commit into
mainfrom
imporve-export-name

Conversation

@BlackHole1

Copy link
Copy Markdown
Member

Config export always suggested the same "LockIME Backup.lockime" name, so successive exports were indistinguishable in Finder. The suggested name now carries a local-time stamp (e.g. LockIME Backup 2026-06-22 23-15-28.lockime), which is also sortable by name.

The stamp is built from calendar components in a fixed, locale- independent layout rather than a DateFormatter string, so it never leaks the system locale into a name the app's language override is meant to govern.

Feed NSSavePanel the extension-less stem and let allowedContentTypes append the single .lockime: embedding the extension makes the panel append a second one (.lockime.lockime), especially once the stem contains dots. Time fields use "-" (not ":" or ".") so the stem stays filename-legal and free of anything the panel could mistake for an existing extension.

Config export always suggested the same "LockIME Backup.lockime"
name, so successive exports were indistinguishable in Finder. The
suggested name now carries a local-time stamp (e.g. LockIME Backup
2026-06-22 23-15-28.lockime), which is also sortable by name.

The stamp is built from calendar components in a fixed, locale-
independent layout rather than a DateFormatter string, so it never
leaks the system locale into a name the app's language override is
meant to govern.

Feed NSSavePanel the extension-less stem and let allowedContentTypes
append the single .lockime: embedding the extension makes the panel
append a second one (.lockime.lockime), especially once the stem
contains dots. Time fields use "-" (not ":" or ".") so the stem
stays filename-legal and free of anything the panel could mistake
for an existing extension.

Signed-off-by: Kevin Cui <bh@bugs.cc>
@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 20e3d521-ed4a-4ea4-953e-1c10619ec670

📥 Commits

Reviewing files that changed from the base of the PR and between 493eb7a and 8fa2000.

📒 Files selected for processing (3)
  • Sources/LockIME/UI/Settings/BackupSettingsPane.swift
  • Sources/LockIMEKit/Backup/ConfigBackup.swift
  • Tests/LockIMEKitTests/ConfigBackupTests.swift

Summary by CodeRabbit

  • New Features

    • Backup export filenames now automatically include date/time stamps, making it easier to identify and organize multiple backups.
  • Tests

    • Added comprehensive test coverage for backup filename generation logic.

Walkthrough

ConfigBackup gains three new static members: fileNamePrefix (a fixed ASCII brand string), suggestedFileNameStem(date:timeZone:) (builds a locale-independent yyyy-MM-dd HH-mm-ss stem using Gregorian calendar components in the supplied time zone), and suggestedFileName(date:timeZone:) (appends fileExtension to the stem). BackupSettingsPane.exportConfiguration() replaces the hardcoded "LockIME Backup.<ext>" string with ConfigBackup.suggestedFileNameStem(date: Date()) as the save panel's nameFieldStringValue, while the .lockime extension is still enforced through allowedContentTypes. A new test suite validates formatting, zero-padding, time-zone rendering, character legality, single-dot enforcement, default time-zone behavior, and chronological lexicographic ordering.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat(backup): timestamp the exported config filename' follows the required format of type(scope): subject and clearly describes the main change of adding timestamps to exported config filenames.
Description check ✅ Passed The description comprehensively explains the rationale, implementation approach, and specific technical details (locale-independence, extension handling, timestamp formatting) that directly relate to the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch imporve-export-name

Comment @coderabbitai help to get the list of available commands.

@BlackHole1 BlackHole1 merged commit a24f146 into main Jun 23, 2026
3 checks passed
@BlackHole1 BlackHole1 deleted the imporve-export-name branch June 23, 2026 03:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant