PrivacyInsights/
├── Services/ # Business logic
│ ├── URLScannerService.swift
│ ├── DomainSecurityCheckerService.swift
│ ├── DeviceSecurityCheckerService.swift
│ ├── NetworkScannerService.swift
│ ├── IPDeviceAnalyzerService.swift
│ ├── GeoIPService.swift
│ ├── TracerouteEngine.swift
│ ├── BluetoothDiscoveryService.swift
│ ├── TrackerMonitoringService.swift
│ ├── QRCodeScannerService.swift
│ ├── CookieInspectorService.swift
│ ├── ContentBlockerService.swift
│ ├── PrivacyLeakDetectorService.swift
│ ├── ThreatIntelligenceService.swift
│ ├── LongRunningTaskManager.swift # Screen lock & state restoration
│ ├── SpeechTranscriptionService.swift
│ ├── AdaptiveLMSFilter.swift # Audio noise cancellation
│ ├── ExtendedProfiling/ # Photo analysis services
│ │ ├── ExtendedProfilingService.swift
│ │ ├── PhotoFilterService.swift
│ │ ├── SmartSamplingService.swift
│ │ ├── ActivityDetectionService.swift
│ │ ├── SocialPatternService.swift
│ │ ├── LifeEventService.swift
│ │ ├── VehicleDetectionService.swift
│ │ ├── FoodDetectionService.swift
│ │ ├── SensitiveDocumentService.swift
│ │ ├── HomeAnalysisService.swift
│ │ ├── WorkAnalysisService.swift
│ │ └── ExtendedCacheService.swift
│ └── ...
├── Views/ # SwiftUI views
│ ├── ContentView.swift
│ ├── OverviewView.swift
│ ├── ToolsView.swift
│ ├── LearnView.swift
│ ├── ProtectView.swift
│ ├── DeviceSecurityCheckerView.swift
│ ├── BluetoothDiscoveryView.swift
│ ├── TrackerMonitoringView.swift
│ ├── BluetoothLocationHistoryMapView.swift
│ ├── InterruptedTasksView.swift
│ ├── SpeechTranscriptionView.swift
│ ├── MeetingTranscriptionView.swift
│ ├── ExtendedProfiling/ # Photo analysis views
│ │ ├── ExtendedProfilingView.swift
│ │ ├── ScopeSelectionView.swift
│ │ ├── ExtendedDashboardView.swift
│ │ └── ExtendedAnalysisProgressView.swift
│ └── ...
├── Models/ # Data models
│ ├── ExtendedProfilingModels.swift
│ ├── BluetoothHistoryModels.swift
│ ├── TranscriptionModels.swift
├── Utilities/ # Helper functions
│ ├── AsyncContentView.swift
│ ├── DeferredView.swift
│ └── ...
├── Resources/ # Databases and configuration
│ ├── bluetooth_database.json # 170+ Bluetooth SIG Company IDs
│ ├── oui_database.json # MAC address to manufacturer
│ ├── country_coordinates.json # Country coordinates for map
│ └── geoip_city.bin # GeoIP binary database
├── PrivacyInsightsContentBlocker/ # Safari Content Blocker
│ └── blockerList.json # Standard blocking rules
└── PrivacyInsightsSafariExtension/ # Safari Web Extension
├── SafariWebExtensionHandler.swift # Native messaging
└── Resources/
├── background.js # Service worker with caching
├── popup.js # Extension popup logic
└── popup.html # Extension UI
MVVM with Services Layer
@State, @StateObject, @ObservedObjectPrivacyInsights/PrivacyInsights.xcodeprojgroup.com.privacyinsights.shared
customBlockerRules.json for custom blocking rulesbluetooth_database.json - Loaded dynamically at startupoui_database.json - MAC address lookupcountry_coordinates.json - Geographic datageoip_city.bin - Memory-mapped GeoIP database@AppStorage for user preferencesNavigationStack instead of NavigationViewLazyVStack for scrollable lists.foregroundStyle() instead of .foregroundColor().clipShape() instead of .cornerRadius().task modifier for async loadingsheet(item:) for robust state handling@MainActor for all UI-related classesasync/await for asynchronous operationsTask { } for async operations in viewsnonisolated for delegate methods@StateObject for view-owned services@ObservedObject for injected services@State for view-local state@AppStorage for persistent preferencesNWConnectionTaskGroupLazyVStack for large listsbodyMainActor.runService: LongRunningTaskManager
Centralised management for tasks that require extended execution time.
ExtendedProfilingService - Photo analysisSpeechTranscriptionService - Speech transcriptionMeetingTranscriptionView - Meeting recordingBluetoothDiscoveryService - Bluetooth scanningTrackerMonitoringService - Tracker monitoring and locating