Ariver
2026-05-18 440d4dc270ac33348f2aeed7fbafddfe284acabe
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
import Foundation
 
// MARK: - Smart Start Category Identity
 
enum SmartCategoryID: String, CaseIterable, Codable, Hashable, Identifiable {
    case browser
    case communication
    case productivity
    case fileManagement = "file-management"
    case transfer
    case development
    case design
    case writing
    case media
    case video
    case audio
    case picturePhoto = "picture-photo"
    case utilities
    case system
    case systemEnhancement = "system-enhancement"
    case entertainment
    case game
    case finance
    case education
    case aiTools = "ai-tools"
    case security
    case other
 
    var id: String { rawValue }
 
    var localizationKey: String {
        "smart.category.\(rawValue)"
    }
 
    var defaultDisplayName: String {
        switch self {
        case .browser:
            return "Browsers"
        case .communication:
            return "Communication"
        case .productivity:
            return "Productivity"
        case .fileManagement:
            return "File Management"
        case .transfer:
            return "Uploads & Downloads"
        case .development:
            return "Development"
        case .design:
            return "Design"
        case .writing:
            return "Writing"
        case .media:
            return "Media"
        case .video:
            return "Video"
        case .audio:
            return "Audio"
        case .picturePhoto:
            return "Pictures & Photos"
        case .utilities:
            return "Utilities"
        case .system:
            return "System Apps"
        case .systemEnhancement:
            return "System Enhancements"
        case .entertainment:
            return "Entertainment"
        case .game:
            return "Games"
        case .finance:
            return "Finance"
        case .education:
            return "Education"
        case .aiTools:
            return "AI Tools"
        case .security:
            return "Security"
        case .other:
            return "Other"
        }
    }
 
    var localizedDisplayName: String {
        let localized = tr(localizationKey)
        return localized == localizationKey ? defaultDisplayName : localized
    }
 
    func displayName(forLanguageCode code: String) -> String {
        let localized = L10n.loadedTranslation(localizationKey, for: code)?
            .trimmingCharacters(in: .whitespacesAndNewlines)
        if let localized, !localized.isEmpty {
            return localized
        }
        return defaultDisplayName
    }
 
    var defaultColorIndex: Int {
        switch self {
        case .browser:
            return 4
        case .communication:
            return 3
        case .productivity:
            return 2
        case .fileManagement:
            return 5
        case .transfer:
            return 2
        case .development:
            return 4
        case .design:
            return 3
        case .writing:
            return 1
        case .media:
            return 7
        case .video:
            return 7
        case .audio:
            return 3
        case .picturePhoto:
            return 4
        case .utilities:
            return 5
        case .system:
            return 0
        case .systemEnhancement:
            return 6
        case .entertainment:
            return 6
        case .game:
            return 6
        case .finance:
            return 2
        case .education:
            return 5
        case .aiTools:
            return 6
        case .security:
            return 1
        case .other:
            return 0
        }
    }
}
 
struct SmartCategoryDefinition: Codable, Hashable, Identifiable {
    let id: SmartCategoryID
    let localizationKey: String
    let defaultDisplayName: String
    let colorIndex: Int
 
    init(
        id: SmartCategoryID,
        localizationKey: String? = nil,
        defaultDisplayName: String? = nil,
        colorIndex: Int? = nil
    ) {
        self.id = id
        self.localizationKey = localizationKey ?? id.localizationKey
        self.defaultDisplayName = defaultDisplayName ?? id.defaultDisplayName
        self.colorIndex = colorIndex ?? id.defaultColorIndex
    }
}
 
enum SmartCategoryDefaults {
    static let orderedIDs: [SmartCategoryID] = [
        .browser,
        .communication,
        .productivity,
        .fileManagement,
        .transfer,
        .development,
        .design,
        .writing,
        .media,
        .video,
        .audio,
        .picturePhoto,
        .utilities,
        .system,
        .systemEnhancement,
        .entertainment,
        .game,
        .finance,
        .education,
        .aiTools,
        .security,
        .other
    ]
 
    static let definitions: [SmartCategoryDefinition] = orderedIDs.map {
        SmartCategoryDefinition(id: $0)
    }
}