No description
Enhanced CacheService with smart sync capabilities that automatically detect and resolve conflicts by comparing modification timestamps. Major changes: - Add smartSync() method for bidirectional sync with automatic direction detection - Enhanced syncToiCloud() and syncFromiCloud() with detailed logging - Sync now compares timestamps and only syncs when one side is newer - Handles all sync scenarios: no data, one-sided data, and conflicting data - App automatically syncs on launch using smart sync Sync scenarios handled: • No data on either side → No action needed • Only local data exists → Auto-upload to iCloud • Only iCloud data exists → Auto-download to device • Both exist with different timestamps → Sync newer to older • Both in sync → No transfer needed Settings improvements: - Changed "Sync Now" button to "Smart Sync" - Added restoreFromiCloud() function for manual force download - Smart Sync automatically saves settings before syncing - Better user feedback with detailed console logging Benefits: - New device setup automatically downloads iCloud data - Switching between devices keeps data in sync - Never overwrites newer data with older data - Manual restore option available when needed - Encrypted settings (API keys, tokens) sync securely Debug features: - Console logs show sync direction and reason - File counts displayed after sync - Timestamp comparisons logged for transparency |
||
|---|---|---|
| Managarr | ||
| Managarr.xcodeproj | ||
| .gitignore | ||
| CLAUDE.md | ||
| README.md | ||
Managarr
An iOS app for managing your Sonarr instance.
Features
- View all your series in a clean, organized list
- See detailed information about each series including seasons, episodes, and statistics
- Browse upcoming episodes in a calendar view
- Search and add new series to your Sonarr instance
- Configure multiple Sonarr servers
Requirements
- iOS 17.0 or later
- Xcode 15.0 or later
- A running Sonarr instance (v3 API)
Getting Started
- Open
Managarr.xcodeprojin Xcode - Select your target device or simulator
- Build and run the project
- In the Settings tab, configure your Sonarr server:
- Enter your Sonarr server URL (e.g.,
http://192.168.1.100:8989) - Enter your API key (found in Sonarr: Settings → General → Security → API Key)
- Tap "Test Connection" to verify the settings
- Enter your Sonarr server URL (e.g.,
Project Structure
Managarr/
├── ManagearrApp.swift # App entry point
├── ContentView.swift # Main tab view
├── Models/
│ ├── Series.swift # Series data model
│ └── Episode.swift # Episode data model
├── Services/
│ └── SonarrService.swift # API client for Sonarr
├── Views/
│ ├── SeriesListView.swift # List of all series
│ ├── SeriesDetailView.swift # Detailed series view
│ ├── CalendarView.swift # Upcoming episodes
│ ├── SettingsView.swift # App settings
│ └── AddSeriesView.swift # Search and add series
├── Assets.xcassets/ # App assets and icons
└── Info.plist # App configuration
API Integration
This app uses the Sonarr v3 API. The following endpoints are implemented:
GET /api/v3/series- Fetch all seriesGET /api/v3/calendar- Fetch upcoming episodesGET /api/v3/series/lookup- Search for series
Configuration
The app stores your Sonarr server configuration in UserDefaults:
sonarr_url: Your Sonarr server URLsonarr_api_key: Your Sonarr API key
Security
- API keys are stored securely in UserDefaults
- The app allows arbitrary loads in NSAppTransportSecurity to support HTTP connections to local Sonarr instances
- For production use, consider using HTTPS and the iOS Keychain for API key storage
Future Enhancements
- Support for multiple Sonarr instances
- Episode file management
- Quality profile management
- Series monitoring controls
- Push notifications for new episodes
- Search for missing episodes
- Series statistics and charts
License
This project is provided as-is for personal use.