| | |
| | | let quickSearchDocuments: [QuickSearchDocument] |
| | | let tagColors: [String: Int] |
| | | let tagOrder: [String] |
| | | let tagDefinitions: [String: TagDatabase.TagDef] |
| | | let containerAppOrder: [String: [String]] |
| | | } |
| | | |
| | | struct AppLibraryRefreshResult { |
| | |
| | | struct AppLibrarySystemSchemeApplyResult { |
| | | let snapshot: AppLibrarySnapshot |
| | | let summary: SmartStartSummary? |
| | | } |
| | | |
| | | struct AppLibraryUncategorizedResetResult { |
| | | let snapshot: AppLibrarySnapshot |
| | | } |
| | | |
| | | enum AppLibraryController { |
| | |
| | | ) |
| | | } |
| | | |
| | | static func resetToUncategorized() -> AppLibraryUncategorizedResetResult { |
| | | let scannedApps = AppIndexer.scan(useCache: false) |
| | | let store = TagDatabase.resetAppTagAssignmentsToUncategorized() |
| | | return AppLibraryUncategorizedResetResult( |
| | | snapshot: makeSnapshot(scannedApps: scannedApps, store: store) |
| | | ) |
| | | } |
| | | |
| | | private static func makeSnapshot( |
| | | scannedApps: [AppInfo], |
| | | store: TagDatabase.Store |
| | |
| | | apps: apps, |
| | | quickSearchDocuments: QuickSearchEngine.makeDocuments(apps: apps, store: store), |
| | | tagColors: store.tags.mapValues { $0.color }, |
| | | tagOrder: TagEditor.orderedTagNames() |
| | | tagOrder: TagEditor.orderedTagNames(in: store), |
| | | tagDefinitions: store.tags, |
| | | containerAppOrder: TagDatabase.normalizedContainerAppOrder( |
| | | store.containerAppOrder, |
| | | tags: store.tags, |
| | | appTags: store.appTags |
| | | ) |
| | | ) |
| | | } |
| | | } |