Skip to content

Comments

feat: Import Configuration Feature (v1.2.0)#12

Merged
dernerl merged 4 commits intomainfrom
feature/issue-8-import-configuration
Dec 8, 2025
Merged

feat: Import Configuration Feature (v1.2.0)#12
dernerl merged 4 commits intomainfrom
feature/issue-8-import-configuration

Conversation

@dernerl
Copy link
Owner

@dernerl dernerl commented Dec 8, 2025

Import Configuration Feature (v1.2.0)

🎯 Overview

Implements Issue #8: Import existing JSON and Plist configuration files into the app.

This PR adds comprehensive import functionality with two distinct methods optimized for different use cases:

  • JSON Import via Copy/Paste (⌘I) - Quick and easy for testing and snippets
  • Plist Import via File Selection (⌘⇧I) - Full file support including Intune fragments

✨ Features

JSON Import (Copy/Paste)

  • New ImportJSONView with TextEditor dialog
  • Keyboard shortcut: ⌘I
  • Paste JSON directly from clipboard
  • Perfect for quick imports, testing, and sharing snippets
  • Immediate validation and error feedback

Plist Import (File Selection)

  • NSOpenPanel for file selection
  • Keyboard shortcut: ⌘⇧I
  • Supports both formats:
    • Full Plist files (with XML headers)
    • Plist fragments (Intune export format without XML headers)
  • Auto-wraps fragments in proper Plist structure
  • Handles both dictionary and direct array formats

General Import Features

  • ✅ Replace all existing favorites on import
  • ✅ Preserve folder hierarchies (children arrays)
  • ✅ Extract and update toplevel name
  • ✅ Automatic format detection
  • ✅ Comprehensive error handling with user-friendly messages
  • ✅ OSLog integration for debugging

🔧 Technical Implementation

New Files

  • ImportService.swift - NSOpenPanel file selection service
  • FormatParser.swift - JSON/Plist parsing with fragment support
  • ImportJSONView.swift - SwiftUI dialog for JSON paste
  • MockImportService.swift - Test mock for unit testing

Modified Files

  • AppError.swift - 3 new error types (fileReadFailed, importInvalidFormat, importUnsupportedFormat)
  • FavoritesViewModel.swift - Import logic with two entry points
  • ContentView.swift - Two import buttons in toolbar with shortcuts

Architecture

  • Service Layer - Clean separation of concerns
  • Dependency Injection - Testable design
  • MVVM Compliant - No UI code in ViewModel
  • Swift 6 Concurrency - async/await throughout
  • HIG Compliant - Toolbar buttons with keyboard shortcuts

🧪 Testing

Manual Testing Completed

  • ✅ JSON copy/paste import
  • ✅ Plist file import (full format)
  • ✅ Plist fragment import (Intune exports)
  • ✅ Folder structure preservation
  • ✅ Error handling for invalid formats
  • ✅ UI responsiveness and button visibility
  • ✅ Keyboard shortcuts (⌘I and ⌘⇧I)

Code Quality

  • ✅ Build successful (Debug & Release)
  • ✅ Pre-commit hooks passed
  • ✅ No Swift 6 concurrency warnings
  • ✅ OSLog integration for debugging
  • ✅ Proper error handling with LocalizedError

📝 Documentation

  • ✅ CHANGELOG.md updated with comprehensive v1.2.0 entry
  • ✅ README.md updated with import instructions and use cases
  • ✅ Inline code comments and documentation
  • ✅ Use cases documented (migration, backup, sharing, testing)

🎨 UI/UX

Import JSON Dialog

  • Clean, modern design with Liquid-Glass styling
  • TextEditor with monospaced font for code
  • Fixed height (250pt) for optimal button visibility
  • Cancel (Esc) and Import (Enter) keyboard shortcuts
  • Disabled import button when text is empty

Toolbar Buttons

  • Import JSON: doc.text SF Symbol (⌘I)
  • Import Plist: doc.badge.arrow.up SF Symbol (⌘⇧I)
  • Clear visual distinction between the two methods
  • Tooltips with keyboard shortcut hints

📊 Statistics

  • 4 commits with clear conventional commit messages
  • 9 files changed: 597 insertions, 3 deletions
  • 3 new services/components
  • 2 new import methods
  • 3 new error types

🔗 Related

🚀 Next Steps

After merge:

  1. ✅ Feature is ready for collection with other features
  2. ⏳ Wait for additional features before release
  3. ⏳ When ready: Set release date in CHANGELOG.md
  4. ⏳ Create release tag (v1.2.0) only when multiple features are ready

Ready for review and merge!

dernerl added 4 commits December 8, 2025 13:36
- Add ImportService for file selection with NSOpenPanel
- Add FormatParser for JSON/Plist parsing with folder support
- Add MockImportService for testing
- Extend AppError with import-specific error types
- Add importConfiguration() method to FavoritesViewModel
- Add Import button to toolbar with ⌘I keyboard shortcut
- Support recursive folder structure import
- Auto-detect file format from extension
- Replace all existing favorites on import

Implements #8
- Add ImportJSONView with TextEditor for copy/paste JSON import
- Split import into two methods:
  - importJSONString() for JSON copy/paste (⌘I)
  - importPlistFile() for Plist file selection (⌘⇧I)
- Fix Plist parser to handle fragments without XML headers
  - Auto-wrap fragments in proper Plist structure
  - Support Intune export format (fragments)
- Add parseJSONString() to FormatParser
- Add Import JSON button to toolbar (⌘I)
- Add Import Plist button to toolbar (⌘⇧I)
- Refactor shared import logic into performImport()
- Add sheet presentation for JSON import dialog

Fixes Plist import issue with Intune exports
Related to #8
- Change TextEditor from minHeight: 300 to fixed height: 250
- Reduce dialog height from 500 to 480
- Ensures buttons are fully visible and not cut off
- Add comprehensive CHANGELOG entry for v1.2.0
- Document JSON copy/paste import (⌘I)
- Document Plist file import (⌘⇧I)
- Explain Plist fragment support for Intune exports
- Add import section to README with use cases
- List all technical changes and new components
- Update numbering in How To Use section

Closes #8
@dernerl dernerl merged commit 5682f39 into main Dec 8, 2025
1 check passed
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.

feat: Import existing Plist/JSON configurations

1 participant