Commit ee19a31ad8
Unsigned
Layout: unified · split
DomainDig/AppInfoView.swift +3 −3
| @@ -163,7 +163,7 @@ private struct WhatsNewView: View { | ||
| 163 | 163 | } else { |
| 164 | 164 | Section { |
| 165 | 165 | Text("Release notes are unavailable.") |
| 166 | .foregroundStyle(Color(.appTextSecondary)) | |
| 166 | .foregroundStyle(ThemeToken.textSecondary) | |
| 167 | 167 | } |
| 168 | 168 | } |
| 169 | 169 | } |
| @@ -188,7 +188,7 @@ private struct AcknowledgementsView: View { | ||
| 188 | 188 | Section("License") { |
| 189 | 189 | Text("DomainDig is released under the MIT License.") |
| 190 | 190 | Text(AppLinks.copyright) |
| 191 | .foregroundStyle(Color(.appTextSecondary)) | |
| 191 | .foregroundStyle(ThemeToken.textSecondary) | |
| 192 | 192 | } |
| 193 | 193 | } |
| 194 | 194 | .navigationTitle("Acknowledgements") |
| @@ -211,7 +211,7 @@ private struct ReportIssueView: View { | ||
| 211 | 211 | Form { |
| 212 | 212 | Section { |
| 213 | 213 | Text("These details are included so issues can be reproduced. They are only added when you send a report — nothing is collected in the background.") |
| 214 | .foregroundStyle(Color(.appTextSecondary)) | |
| 214 | .foregroundStyle(ThemeToken.textSecondary) | |
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | Section("Included Diagnostics") { |
DomainDig/AuditViews.swift +40 −40
| @@ -27,7 +27,7 @@ struct AuditListView: View { | ||
| 27 | 27 | showsCardBackground: false |
| 28 | 28 | ) |
| 29 | 29 | } |
| 30 | .listRowBackground(Color(.appSurface)) | |
| 30 | .themedListRowBackground(.surface) | |
| 31 | 31 | } else { |
| 32 | 32 | Section("Audit Domains") { |
| 33 | 33 | ForEach(groupedSessions, id: \.domain) { group in |
| @@ -41,13 +41,13 @@ struct AuditListView: View { | ||
| 41 | 41 | Spacer() |
| 42 | 42 | Text("\(group.sessions.count) audit\(group.sessions.count == 1 ? "" : "s")") |
| 43 | 43 | .font(appDensity.font(.caption2)) |
| 44 | .foregroundStyle(Color(.appTextSecondary)) | |
| 44 | .foregroundStyle(ThemeToken.textSecondary) | |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | if let latest = group.sessions.first { |
| 48 | 48 | Text(latest.findings.isEmpty ? "No findings recorded yet" : latest.findings.map(\.title).prefix(2).joined(separator: " • ")) |
| 49 | 49 | .font(appDensity.font(.caption)) |
| 50 | .foregroundStyle(Color(.appTextSecondary)) | |
| 50 | .foregroundStyle(ThemeToken.textSecondary) | |
| 51 | 51 | .lineLimit(2) |
| 52 | 52 | |
| 53 | 53 | HStack(spacing: 8) { |
| @@ -57,7 +57,7 @@ struct AuditListView: View { | ||
| 57 | 57 | } |
| 58 | 58 | Text("Checklist \(latest.completedChecklistCount)/\(latest.checklist.count)") |
| 59 | 59 | .font(appDensity.font(.caption2)) |
| 60 | .foregroundStyle(Color(.appTextSecondary)) | |
| 60 | .foregroundStyle(ThemeToken.textSecondary) | |
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | 63 | } |
| @@ -65,11 +65,11 @@ struct AuditListView: View { | ||
| 65 | 65 | } |
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | .listRowBackground(Color(.appSurface)) | |
| 68 | .themedListRowBackground(.surface) | |
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | 71 | .scrollContentBackground(.hidden) |
| 72 | .background(Color(.appBackground)) | |
| 72 | .background(ThemeToken.background) | |
| 73 | 73 | .navigationTitle("Audit Mode") |
| 74 | 74 | .toolbar { |
| 75 | 75 | if !viewModel.searchedDomain.isEmpty { |
| @@ -115,7 +115,7 @@ struct AuditDomainTimelineView: View { | ||
| 115 | 115 | |
| 116 | 116 | Text("Reviewer: \(session.reviewer)") |
| 117 | 117 | .font(appDensity.font(.caption)) |
| 118 | .foregroundStyle(Color(.appTextSecondary)) | |
| 118 | .foregroundStyle(ThemeToken.textSecondary) | |
| 119 | 119 | |
| 120 | 120 | HStack(spacing: 8) { |
| 121 | 121 | Text("\(session.findings.count) findings") |
| @@ -125,13 +125,13 @@ struct AuditDomainTimelineView: View { | ||
| 125 | 125 | } |
| 126 | 126 | } |
| 127 | 127 | .font(appDensity.font(.caption2)) |
| 128 | .foregroundStyle(Color(.appTextSecondary)) | |
| 128 | .foregroundStyle(ThemeToken.textSecondary) | |
| 129 | 129 | } |
| 130 | 130 | .padding(.vertical, 4) |
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | 133 | } |
| 134 | .listRowBackground(Color(.appSurface)) | |
| 134 | .themedListRowBackground(.surface) | |
| 135 | 135 | |
| 136 | 136 | Section("Trend") { |
| 137 | 137 | ForEach(viewModel.auditTimeline(for: domain)) { point in |
| @@ -142,19 +142,19 @@ struct AuditDomainTimelineView: View { | ||
| 142 | 142 | Spacer() |
| 143 | 143 | Text("\(point.findingCount) findings") |
| 144 | 144 | .font(appDensity.font(.caption2)) |
| 145 | .foregroundStyle(Color(.appTextSecondary)) | |
| 145 | .foregroundStyle(ThemeToken.textSecondary) | |
| 146 | 146 | } |
| 147 | 147 | Text("Open high severity: \(point.openHighSeverityCount) • Repeated issues: \(point.repeatedIssueCount)") |
| 148 | 148 | .font(appDensity.font(.caption2)) |
| 149 | .foregroundStyle(Color(.appTextSecondary)) | |
| 149 | .foregroundStyle(ThemeToken.textSecondary) | |
| 150 | 150 | } |
| 151 | 151 | .padding(.vertical, 2) |
| 152 | 152 | } |
| 153 | 153 | } |
| 154 | .listRowBackground(Color(.appSurface)) | |
| 154 | .themedListRowBackground(.surface) | |
| 155 | 155 | } |
| 156 | 156 | .scrollContentBackground(.hidden) |
| 157 | .background(Color(.appBackground)) | |
| 157 | .background(ThemeToken.background) | |
| 158 | 158 | .navigationTitle(domain) |
| 159 | 159 | .toolbar { |
| 160 | 160 | ToolbarItem(placement: .topBarTrailing) { |
| @@ -196,7 +196,7 @@ struct AuditSessionDetailView: View { | ||
| 196 | 196 | .font(appDensity.font(.headline, design: .default, weight: .semibold)) |
| 197 | 197 | Text("Reviewer: \(session.reviewer)") |
| 198 | 198 | .font(appDensity.font(.caption)) |
| 199 | .foregroundStyle(Color(.appTextSecondary)) | |
| 199 | .foregroundStyle(ThemeToken.textSecondary) | |
| 200 | 200 | } |
| 201 | 201 | Spacer() |
| 202 | 202 | auditStatusBadge(session.status) |
| @@ -214,10 +214,10 @@ struct AuditSessionDetailView: View { | ||
| 214 | 214 | |
| 215 | 215 | Text("Captured \(session.evidence.capturedAt.formatted(date: .abbreviated, time: .shortened))") |
| 216 | 216 | .font(appDensity.font(.caption2)) |
| 217 | .foregroundStyle(Color(.appTextSecondary)) | |
| 217 | .foregroundStyle(ThemeToken.textSecondary) | |
| 218 | 218 | } |
| 219 | 219 | } |
| 220 | .listRowBackground(Color(.appSurface)) | |
| 220 | .themedListRowBackground(.surface) | |
| 221 | 221 | |
| 222 | 222 | Section("Audit Summary") { |
| 223 | 223 | LabeledContent("Findings", value: "\(session.findings.count)") |
| @@ -227,7 +227,7 @@ struct AuditSessionDetailView: View { | ||
| 227 | 227 | LabeledContent("Highest Severity", value: severity.title) |
| 228 | 228 | } |
| 229 | 229 | } |
| 230 | .listRowBackground(Color(.appSurface)) | |
| 230 | .themedListRowBackground(.surface) | |
| 231 | 231 | |
| 232 | 232 | Section("Reviewer Notes") { |
| 233 | 233 | TextEditor(text: $notesDraft) |
| @@ -239,7 +239,7 @@ struct AuditSessionDetailView: View { | ||
| 239 | 239 | viewModel.updateAuditNotes(notesDraft, sessionID: session.id) |
| 240 | 240 | } |
| 241 | 241 | } |
| 242 | .listRowBackground(Color(.appSurface)) | |
| 242 | .themedListRowBackground(.surface) | |
| 243 | 243 | |
| 244 | 244 | Section("Checklist") { |
| 245 | 245 | ForEach(session.checklist) { item in |
| @@ -248,14 +248,14 @@ struct AuditSessionDetailView: View { | ||
| 248 | 248 | } label: { |
| 249 | 249 | HStack(alignment: .top, spacing: 10) { |
| 250 | 250 | Image(systemName: item.isComplete ? "checkmark.circle.fill" : "circle") |
| 251 | .foregroundStyle(item.isComplete ? Color(.statusPositive) : .secondary) | |
| 251 | .foregroundStyle(item.isComplete ? AnyShapeStyle(ThemeToken.positive) : AnyShapeStyle(.secondary)) | |
| 252 | 252 | VStack(alignment: .leading, spacing: 4) { |
| 253 | 253 | Text(item.title) |
| 254 | 254 | .font(appDensity.font(.callout)) |
| 255 | 255 | .foregroundStyle(.primary) |
| 256 | 256 | Text(item.detail) |
| 257 | 257 | .font(appDensity.font(.caption)) |
| 258 | .foregroundStyle(Color(.appTextSecondary)) | |
| 258 | .foregroundStyle(ThemeToken.textSecondary) | |
| 259 | 259 | } |
| 260 | 260 | Spacer() |
| 261 | 261 | } |
| @@ -265,13 +265,13 @@ struct AuditSessionDetailView: View { | ||
| 265 | 265 | .accessibilityHint(item.isComplete ? "Marks incomplete" : "Marks complete") |
| 266 | 266 | } |
| 267 | 267 | } |
| 268 | .listRowBackground(Color(.appSurface)) | |
| 268 | .themedListRowBackground(.surface) | |
| 269 | 269 | |
| 270 | 270 | Section("Findings") { |
| 271 | 271 | if session.findings.isEmpty { |
| 272 | 272 | Text("No findings recorded.") |
| 273 | 273 | .font(appDensity.font(.caption)) |
| 274 | .foregroundStyle(Color(.appTextSecondary)) | |
| 274 | .foregroundStyle(ThemeToken.textSecondary) | |
| 275 | 275 | } else { |
| 276 | 276 | ForEach(session.findings) { finding in |
| 277 | 277 | Button { |
| @@ -287,11 +287,11 @@ struct AuditSessionDetailView: View { | ||
| 287 | 287 | } |
| 288 | 288 | Text(finding.summary) |
| 289 | 289 | .font(appDensity.font(.caption)) |
| 290 | .foregroundStyle(Color(.appTextSecondary)) | |
| 290 | .foregroundStyle(ThemeToken.textSecondary) | |
| 291 | 291 | .lineLimit(2) |
| 292 | 292 | Text("\(finding.status.title) • \(finding.evidenceReferences.count) evidence refs") |
| 293 | 293 | .font(appDensity.font(.caption2)) |
| 294 | .foregroundStyle(Color(.appTextSecondary)) | |
| 294 | .foregroundStyle(ThemeToken.textSecondary) | |
| 295 | 295 | } |
| 296 | 296 | .padding(.vertical, 2) |
| 297 | 297 | } |
| @@ -302,7 +302,7 @@ struct AuditSessionDetailView: View { | ||
| 302 | 302 | } |
| 303 | 303 | } |
| 304 | 304 | } |
| 305 | .listRowBackground(Color(.appSurface)) | |
| 305 | .themedListRowBackground(.surface) | |
| 306 | 306 | |
| 307 | 307 | Section("Evidence Snapshot") { |
| 308 | 308 | LabeledContent("Availability", value: availabilityTitle(session.evidence.report.availability)) |
| @@ -312,7 +312,7 @@ struct AuditSessionDetailView: View { | ||
| 312 | 312 | LabeledContent("Reachability", value: session.evidence.report.network.reachabilitySummary) |
| 313 | 313 | LabeledContent("Registrar", value: session.evidence.report.ownership?.registrar ?? "Unavailable") |
| 314 | 314 | } |
| 315 | .listRowBackground(Color(.appSurface)) | |
| 315 | .themedListRowBackground(.surface) | |
| 316 | 316 | |
| 317 | 317 | if !session.evidence.historicalContext.isEmpty { |
| 318 | 318 | Section("Historical Context") { |
| @@ -322,11 +322,11 @@ struct AuditSessionDetailView: View { | ||
| 322 | 322 | .font(appDensity.font(.caption, weight: .semibold)) |
| 323 | 323 | Text(entry.changeSummaryMessage ?? "No change summary") |
| 324 | 324 | .font(appDensity.font(.caption2)) |
| 325 | .foregroundStyle(Color(.appTextSecondary)) | |
| 325 | .foregroundStyle(ThemeToken.textSecondary) | |
| 326 | 326 | } |
| 327 | 327 | } |
| 328 | 328 | } |
| 329 | .listRowBackground(Color(.appSurface)) | |
| 329 | .themedListRowBackground(.surface) | |
| 330 | 330 | } |
| 331 | 331 | |
| 332 | 332 | Section("Audit Timeline") { |
| @@ -338,18 +338,18 @@ struct AuditSessionDetailView: View { | ||
| 338 | 338 | Spacer() |
| 339 | 339 | Text(point.status.title) |
| 340 | 340 | .font(appDensity.font(.caption2)) |
| 341 | .foregroundStyle(Color(.appTextSecondary)) | |
| 341 | .foregroundStyle(ThemeToken.textSecondary) | |
| 342 | 342 | } |
| 343 | 343 | Text("Findings \(point.findingCount) • Open high \(point.openHighSeverityCount) • Repeated \(point.repeatedIssueCount)") |
| 344 | 344 | .font(appDensity.font(.caption2)) |
| 345 | .foregroundStyle(Color(.appTextSecondary)) | |
| 345 | .foregroundStyle(ThemeToken.textSecondary) | |
| 346 | 346 | } |
| 347 | 347 | } |
| 348 | 348 | } |
| 349 | .listRowBackground(Color(.appSurface)) | |
| 349 | .themedListRowBackground(.surface) | |
| 350 | 350 | } |
| 351 | 351 | .scrollContentBackground(.hidden) |
| 352 | .background(Color(.appBackground)) | |
| 352 | .background(ThemeToken.background) | |
| 353 | 353 | .navigationTitle("Audit Session") |
| 354 | 354 | .toolbar { |
| 355 | 355 | ToolbarItemGroup(placement: .topBarTrailing) { |
| @@ -399,7 +399,7 @@ struct AuditSessionDetailView: View { | ||
| 399 | 399 | } |
| 400 | 400 | } else { |
| 401 | 401 | ContentUnavailableView("Audit Session Missing", systemImage: "exclamationmark.triangle") |
| 402 | .background(Color(.appBackground)) | |
| 402 | .background(ThemeToken.background) | |
| 403 | 403 | } |
| 404 | 404 | } |
| 405 | 405 | } |
| @@ -459,7 +459,7 @@ private struct AuditFindingEditorView: View { | ||
| 459 | 459 | ForEach(session.evidence.screenshots) { asset in |
| 460 | 460 | Text("\(asset.title): \(asset.reference)") |
| 461 | 461 | .font(.caption) |
| 462 | .foregroundStyle(Color(.appTextSecondary)) | |
| 462 | .foregroundStyle(ThemeToken.textSecondary) | |
| 463 | 463 | } |
| 464 | 464 | } |
| 465 | 465 | } |
| @@ -477,7 +477,7 @@ private struct AuditFindingEditorView: View { | ||
| 477 | 477 | Text(area.title) |
| 478 | 478 | Spacer() |
| 479 | 479 | Image(systemName: selectedAreas.contains(area) ? "checkmark.circle.fill" : "circle") |
| 480 | .foregroundStyle(selectedAreas.contains(area) ? Color(.statusPositive) : .secondary) | |
| 480 | .foregroundStyle(selectedAreas.contains(area) ? AnyShapeStyle(ThemeToken.positive) : AnyShapeStyle(.secondary)) | |
| 481 | 481 | } |
| 482 | 482 | } |
| 483 | 483 | .buttonStyle(.plain) |
| @@ -529,11 +529,11 @@ private func auditStatusBadge(_ status: AuditStatus) -> some View { | ||
| 529 | 529 | let model: AppStatusBadgeModel |
| 530 | 530 | switch status { |
| 531 | 531 | case .draft: |
| 532 | model = .init(title: "Draft", systemImage: "square.and.pencil", foregroundColor: Color(.statusWarning), backgroundColor: Color(.statusWarningSurface)) | |
| 532 | model = .init(title: "Draft", systemImage: "square.and.pencil", foreground: .warning, background: .warningSurface) | |
| 533 | 533 | case .inReview: |
| 534 | model = .init(title: "In Review", systemImage: "doc.text.magnifyingglass", foregroundColor: Color(.statusInfo), backgroundColor: Color(.statusInfoSurface)) | |
| 534 | model = .init(title: "In Review", systemImage: "doc.text.magnifyingglass", foreground: .info, background: .infoSurface) | |
| 535 | 535 | case .complete: |
| 536 | model = .init(title: "Complete", systemImage: "checkmark.seal.fill", foregroundColor: Color(.statusPositive), backgroundColor: Color(.statusPositiveSurface)) | |
| 536 | model = .init(title: "Complete", systemImage: "checkmark.seal.fill", foreground: .positive, background: .positiveSurface) | |
| 537 | 537 | } |
| 538 | 538 | return AppStatusBadgeView(model: model) |
| 539 | 539 | } |
| @@ -554,8 +554,8 @@ private func findingSeverityBadge(_ severity: AuditFindingSeverity) -> some View | ||
| 554 | 554 | model: .init( |
| 555 | 555 | title: severity.title, |
| 556 | 556 | systemImage: "exclamationmark.circle.fill", |
| 557 | foregroundColor: tone.foreground, | |
| 558 | backgroundColor: tone.surface | |
| 557 | foreground: tone.foreground, | |
| 558 | background: tone.surface | |
| 559 | 559 | ) |
| 560 | 560 | ) |
| 561 | 561 | } |
DomainDig/BatchResultsView.swift +17 −17
| @@ -13,16 +13,16 @@ struct BatchResultsView: View { | ||
| 13 | 13 | if viewModel.batchLookupRunning { |
| 14 | 14 | VStack(alignment: .trailing, spacing: 4) { |
| 15 | 15 | ProgressView(value: Double(viewModel.batchCompletedCount), total: Double(max(viewModel.batchTotalCount, 1))) |
| 16 | .tint(Color(.statusInfo)) | |
| 16 | .tint(ThemeToken.info) | |
| 17 | 17 | .frame(width: 120) |
| 18 | 18 | Text(viewModel.batchProgressLabel) |
| 19 | 19 | .font(appDensity.font(.caption2)) |
| 20 | .foregroundStyle(Color(.appTextSecondary)) | |
| 20 | .foregroundStyle(ThemeToken.textSecondary) | |
| 21 | 21 | } |
| 22 | 22 | } else if !viewModel.batchResults.isEmpty { |
| 23 | 23 | Text("\(viewModel.batchResults.count) domains") |
| 24 | 24 | .font(appDensity.font(.caption2)) |
| 25 | .foregroundStyle(Color(.appTextSecondary)) | |
| 25 | .foregroundStyle(ThemeToken.textSecondary) | |
| 26 | 26 | } |
| 27 | 27 | } |
| 28 | 28 | |
| @@ -86,7 +86,7 @@ struct BatchResultRowView: View { | ||
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | 88 | .font(appDensity.font(.caption2)) |
| 89 | .foregroundStyle(Color(.appTextSecondary)) | |
| 89 | .foregroundStyle(ThemeToken.textSecondary) | |
| 90 | 90 | |
| 91 | 91 | HStack(spacing: 10) { |
| 92 | 92 | Text(result.primaryIP ?? "No IP") |
| @@ -99,12 +99,12 @@ struct BatchResultRowView: View { | ||
| 99 | 99 | .lineLimit(1) |
| 100 | 100 | } |
| 101 | 101 | .font(appDensity.font(.caption2)) |
| 102 | .foregroundStyle(Color(.appTextSecondary)) | |
| 102 | .foregroundStyle(ThemeToken.textSecondary) | |
| 103 | 103 | |
| 104 | 104 | if let summaryMessage = result.summaryMessage { |
| 105 | 105 | Text(summaryMessage) |
| 106 | 106 | .font(appDensity.font(.caption2)) |
| 107 | .foregroundStyle(Color(.appTextSecondary)) | |
| 107 | .foregroundStyle(ThemeToken.textSecondary) | |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | if let changeClassification = result.changeClassification { |
| @@ -116,7 +116,7 @@ struct BatchResultRowView: View { | ||
| 116 | 116 | if let errorMessage = result.errorMessage { |
| 117 | 117 | Text(errorMessage) |
| 118 | 118 | .font(appDensity.font(.caption2)) |
| 119 | .foregroundStyle(result.status == .failed ? Color(.statusCritical) : Color(.appTextSecondary)) | |
| 119 | .foregroundStyle(result.status == .failed ? ThemeToken.critical : ThemeToken.textSecondary) | |
| 120 | 120 | } |
| 121 | 121 | } |
| 122 | 122 | .frame(maxWidth: .infinity, alignment: .leading) |
| @@ -151,7 +151,7 @@ struct BatchResultRowView: View { | ||
| 151 | 151 | private var sourceLabel: some View { |
| 152 | 152 | Text(result.resultSource.label.lowercased()) |
| 153 | 153 | .font(appDensity.font(.caption2)) |
| 154 | .foregroundStyle(Color(.appTextSecondary)) | |
| 154 | .foregroundStyle(ThemeToken.textSecondary) | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | private var changeContentLabel: String { |
| @@ -191,30 +191,30 @@ struct BatchResultRowView: View { | ||
| 191 | 191 | return .init( |
| 192 | 192 | title: availabilityText, |
| 193 | 193 | systemImage: "exclamationmark.circle", |
| 194 | foregroundColor: Color(.appTextSecondary), | |
| 195 | backgroundColor: Color(.appSurfaceElevated) | |
| 194 | foreground: .textSecondary, | |
| 195 | background: .surfaceElevated | |
| 196 | 196 | ) |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | private var quickStatusBadge: AppStatusBadgeModel { |
| 200 | 200 | switch result.status { |
| 201 | 201 | case .pending: |
| 202 | return .init(title: "Pending", systemImage: "clock", foregroundColor: Color(.appTextSecondary), backgroundColor: Color(.appSurfaceElevated)) | |
| 202 | return .init(title: "Pending", systemImage: "clock", foreground: .textSecondary, background: .surfaceElevated) | |
| 203 | 203 | case .running: |
| 204 | return .init(title: "Running", systemImage: "arrow.clockwise", foregroundColor: Color(.statusInfo), backgroundColor: Color(.statusInfoSurface)) | |
| 204 | return .init(title: "Running", systemImage: "arrow.clockwise", foreground: .info, background: .infoSurface) | |
| 205 | 205 | case .completed: |
| 206 | 206 | if result.changeClassification == .critical || result.certificateWarningLevel == .critical || result.riskLevel == .high { |
| 207 | return .init(title: "Critical", systemImage: "exclamationmark.octagon.fill", foregroundColor: Color(.statusCritical), backgroundColor: Color(.statusCriticalSurface)) | |
| 207 | return .init(title: "Critical", systemImage: "exclamationmark.octagon.fill", foreground: .critical, background: .criticalSurface) | |
| 208 | 208 | } |
| 209 | 209 | if result.changeClassification == .warning || result.changeSeverity == .medium || result.certificateWarningLevel == .warning { |
| 210 | return .init(title: "Warning", systemImage: "exclamationmark.triangle.fill", foregroundColor: Color(.statusWarning), backgroundColor: Color(.statusWarningSurface)) | |
| 210 | return .init(title: "Warning", systemImage: "exclamationmark.triangle.fill", foreground: .warning, background: .warningSurface) | |
| 211 | 211 | } |
| 212 | 212 | if result.quickStatus == "Changed" { |
| 213 | return .init(title: "Changed", systemImage: "arrow.triangle.2.circlepath", foregroundColor: Color(.statusInfo), backgroundColor: Color(.statusInfoSurface)) | |
| 213 | return .init(title: "Changed", systemImage: "arrow.triangle.2.circlepath", foreground: .info, background: .infoSurface) | |
| 214 | 214 | } |
| 215 | return .init(title: "Stable", systemImage: "checkmark.circle.fill", foregroundColor: Color(.statusPositive), backgroundColor: Color(.statusPositiveSurface)) | |
| 215 | return .init(title: "Stable", systemImage: "checkmark.circle.fill", foreground: .positive, background: .positiveSurface) | |
| 216 | 216 | case .failed: |
| 217 | return .init(title: "Failed", systemImage: "xmark.circle.fill", foregroundColor: Color(.statusCritical), backgroundColor: Color(.statusCriticalSurface)) | |
| 217 | return .init(title: "Failed", systemImage: "xmark.circle.fill", foreground: .critical, background: .criticalSurface) | |
| 218 | 218 | } |
| 219 | 219 | } |
| 220 | 220 | } |
DomainDig/BatchSweepSummaryView.swift +2 −2
| @@ -43,7 +43,7 @@ struct BatchSweepSummaryView: View { | ||
| 43 | 43 | HStack { |
| 44 | 44 | Text(label) |
| 45 | 45 | .font(.system(.caption, design: .monospaced)) |
| 46 | .foregroundStyle(Color(.appTextSecondary)) | |
| 46 | .foregroundStyle(ThemeToken.textSecondary) | |
| 47 | 47 | Spacer() |
| 48 | 48 | Text(value) |
| 49 | 49 | .font(.system(.callout, design: .monospaced)) |
| @@ -65,7 +65,7 @@ struct BatchResultsSection: View { | ||
| 65 | 65 | if results.isEmpty { |
| 66 | 66 | Text(emptyText) |
| 67 | 67 | .font(.system(.caption, design: .monospaced)) |
| 68 | .foregroundStyle(Color(.appTextSecondary)) | |
| 68 | .foregroundStyle(ThemeToken.textSecondary) | |
| 69 | 69 | } else { |
| 70 | 70 | ForEach(results) { result in |
| 71 | 71 | if let entry = viewModel.historyEntry(for: result) { |
DomainDig/ContentView.swift +18 −18
| @@ -120,10 +120,10 @@ struct ContentView: View { | ||
| 120 | 120 | Section { recentSearchesSection } |
| 121 | 121 | } |
| 122 | 122 | } |
| 123 | .listRowBackground(Color(.appSurface)) | |
| 123 | .themedListRowBackground(.surface) | |
| 124 | 124 | .environment(\.cardProvidesSurface, false) |
| 125 | 125 | .scrollContentBackground(.hidden) |
| 126 | .background(Color(.appBackground)) | |
| 126 | .background(ThemeToken.background) | |
| 127 | 127 | .navigationTitle("DomainDig") |
| 128 | 128 | .toolbar { |
| 129 | 129 | ToolbarItem(placement: .topBarTrailing) { |
| @@ -140,7 +140,7 @@ struct ContentView: View { | ||
| 140 | 140 | viewModel.reset() |
| 141 | 141 | } label: { |
| 142 | 142 | Image(systemName: "xmark.circle") |
| 143 | .foregroundStyle(Color(.appTextSecondary)) | |
| 143 | .foregroundStyle(ThemeToken.textSecondary) | |
| 144 | 144 | } |
| 145 | 145 | .accessibilityLabel("Clear results") |
| 146 | 146 | } |
| @@ -280,7 +280,7 @@ struct ContentView: View { | ||
| 280 | 280 | .keyboardType(.URL) |
| 281 | 281 | .padding(.horizontal, 12) |
| 282 | 282 | .padding(.vertical, appDensity.metrics.controlVerticalPadding) |
| 283 | .background(Color(.appSurfaceElevated)) | |
| 283 | .background(ThemeToken.surfaceElevated) | |
| 284 | 284 | .clipShape(RoundedRectangle(cornerRadius: appDensity.metrics.cardCornerRadius)) |
| 285 | 285 | .focused($focusedInputField, equals: .singleDomain) |
| 286 | 286 | .onSubmit { |
| @@ -291,7 +291,7 @@ struct ContentView: View { | ||
| 291 | 291 | if let domainInputError = viewModel.domainInputError { |
| 292 | 292 | Text(domainInputError) |
| 293 | 293 | .font(appDensity.font(.caption)) |
| 294 | .foregroundStyle(Color(.statusCritical)) | |
| 294 | .foregroundStyle(ThemeToken.critical) | |
| 295 | 295 | .frame(maxWidth: .infinity, alignment: .leading) |
| 296 | 296 | } |
| 297 | 297 | |
| @@ -305,19 +305,19 @@ struct ContentView: View { | ||
| 305 | 305 | .frame(minHeight: appDensity.metrics.controlMinHeight) |
| 306 | 306 | } |
| 307 | 307 | .buttonStyle(.borderedProminent) |
| 308 | .tint(Color(.accentFill)) | |
| 308 | .tint(ThemeToken.accent) | |
| 309 | 309 | .disabled(viewModel.trimmedDomain.isEmpty) |
| 310 | 310 | } else { |
| 311 | 311 | if FeatureAccessService.hasAccess(to: .batchOperations) { |
| 312 | 312 | VStack(alignment: .leading, spacing: appDensity.metrics.cardSpacing) { |
| 313 | 313 | Text("Paste domains separated by new lines or commas.") |
| 314 | 314 | .font(appDensity.font(.caption)) |
| 315 | .foregroundStyle(Color(.appTextSecondary)) | |
| 315 | .foregroundStyle(ThemeToken.textSecondary) | |
| 316 | 316 | |
| 317 | 317 | if let batchAllowanceSummary = FeatureAccessService.batchAllowanceSummary() { |
| 318 | 318 | Text(batchAllowanceSummary) |
| 319 | 319 | .font(appDensity.font(.caption2)) |
| 320 | .foregroundStyle(Color(.appTextSecondary)) | |
| 320 | .foregroundStyle(ThemeToken.textSecondary) | |
| 321 | 321 | } |
| 322 | 322 | |
| 323 | 323 | TextField( |
| @@ -332,14 +332,14 @@ struct ContentView: View { | ||
| 332 | 332 | .lineLimit(4...10) |
| 333 | 333 | .padding(.horizontal, 12) |
| 334 | 334 | .padding(.vertical, appDensity.metrics.controlVerticalPadding) |
| 335 | .background(Color(.appSurfaceElevated)) | |
| 335 | .background(ThemeToken.surfaceElevated) | |
| 336 | 336 | .clipShape(RoundedRectangle(cornerRadius: appDensity.metrics.cardCornerRadius)) |
| 337 | 337 | .focused($focusedInputField, equals: .bulkDomains) |
| 338 | 338 | |
| 339 | 339 | if let bulkInputError = viewModel.bulkInputError { |
| 340 | 340 | Text(bulkInputError) |
| 341 | 341 | .font(appDensity.font(.caption)) |
| 342 | .foregroundStyle(Color(.statusCritical)) | |
| 342 | .foregroundStyle(ThemeToken.critical) | |
| 343 | 343 | .frame(maxWidth: .infinity, alignment: .leading) |
| 344 | 344 | } |
| 345 | 345 | |
| @@ -353,7 +353,7 @@ struct ContentView: View { | ||
| 353 | 353 | .frame(minHeight: appDensity.metrics.controlMinHeight) |
| 354 | 354 | } |
| 355 | 355 | .buttonStyle(.borderedProminent) |
| 356 | .tint(Color(.accentFill)) | |
| 356 | .tint(ThemeToken.accent) | |
| 357 | 357 | .disabled(viewModel.bulkInput.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty || viewModel.batchLookupRunning) |
| 358 | 358 | } |
| 359 | 359 | } else { |
| @@ -529,7 +529,7 @@ struct ContentView: View { | ||
| 529 | 529 | } label: { |
| 530 | 530 | Image(systemName: "bolt.circle") |
| 531 | 531 | .font(appDensity.font(.body, design: .default)) |
| 532 | .foregroundStyle(Color(.appTextSecondary)) | |
| 532 | .foregroundStyle(ThemeToken.textSecondary) | |
| 533 | 533 | } |
| 534 | 534 | .accessibilityLabel("Actions") |
| 535 | 535 | Menu { |
| @@ -537,7 +537,7 @@ struct ContentView: View { | ||
| 537 | 537 | } label: { |
| 538 | 538 | Image(systemName: "square.and.arrow.up") |
| 539 | 539 | .font(appDensity.font(.body, design: .default)) |
| 540 | .foregroundStyle(Color(.appTextSecondary)) | |
| 540 | .foregroundStyle(ThemeToken.textSecondary) | |
| 541 | 541 | } |
| 542 | 542 | .accessibilityLabel("Export") |
| 543 | 543 | } |
| @@ -582,13 +582,13 @@ struct ContentView: View { | ||
| 582 | 582 | HStack { |
| 583 | 583 | Text("RECENT") |
| 584 | 584 | .font(appDensity.font(.caption2)) |
| 585 | .foregroundStyle(Color(.appTextSecondary)) | |
| 585 | .foregroundStyle(ThemeToken.textSecondary) | |
| 586 | 586 | Spacer() |
| 587 | 587 | Button("Clear") { |
| 588 | 588 | viewModel.clearRecentSearches() |
| 589 | 589 | } |
| 590 | 590 | .font(appDensity.font(.caption2)) |
| 591 | .foregroundStyle(Color(.appTextSecondary)) | |
| 591 | .foregroundStyle(ThemeToken.textSecondary) | |
| 592 | 592 | } |
| 593 | 593 | |
| 594 | 594 | ForEach(viewModel.recentSearches, id: \.self) { domain in |
| @@ -603,7 +603,7 @@ struct ContentView: View { | ||
| 603 | 603 | .frame(maxWidth: .infinity, alignment: .leading) |
| 604 | 604 | .padding(.vertical, 8) |
| 605 | 605 | .padding(.horizontal, 10) |
| 606 | .background(Color(.appSurface)) | |
| 606 | .background(ThemeToken.surface) | |
| 607 | 607 | .clipShape(RoundedRectangle(cornerRadius: appDensity.metrics.cardCornerRadius)) |
| 608 | 608 | } |
| 609 | 609 | } |
| @@ -624,11 +624,11 @@ struct ContentView: View { | ||
| 624 | 624 | .font(appDensity.font(.headline, design: .default, weight: .semibold)) |
| 625 | 625 | Text(message) |
| 626 | 626 | .font(appDensity.font(.callout, design: .default)) |
| 627 | .foregroundStyle(Color(.appTextSecondary)) | |
| 627 | .foregroundStyle(ThemeToken.textSecondary) | |
| 628 | 628 | } |
| 629 | 629 | .frame(maxWidth: .infinity, alignment: .leading) |
| 630 | 630 | .padding(appDensity.metrics.cardPadding) |
| 631 | .background(Color(.appSurfaceElevated)) | |
| 631 | .background(ThemeToken.surfaceElevated) | |
| 632 | 632 | .clipShape(RoundedRectangle(cornerRadius: appDensity.metrics.cardCornerRadius)) |
| 633 | 633 | } |
| 634 | 634 | |
DomainDig/DNSSectionView.swift +7 −7
| @@ -64,7 +64,7 @@ struct DNSSectionView: View { | ||
| 64 | 64 | Text(section.title) |
| 65 | 65 | .font(.system(.subheadline, design: .monospaced)) |
| 66 | 66 | .fontWeight(.semibold) |
| 67 | .foregroundStyle(Color(.statusInfo)) | |
| 67 | .foregroundStyle(ThemeToken.info) | |
| 68 | 68 | |
| 69 | 69 | if let message = section.message { |
| 70 | 70 | MessageRowView(text: message.text, isError: message.isError) |
| @@ -77,7 +77,7 @@ struct DNSSectionView: View { | ||
| 77 | 77 | if let wildcardTitle = section.wildcardTitle { |
| 78 | 78 | Text(wildcardTitle) |
| 79 | 79 | .font(.system(.caption, design: .monospaced)) |
| 80 | .foregroundStyle(Color(.appTextSecondary)) | |
| 80 | .foregroundStyle(ThemeToken.textSecondary) | |
| 81 | 81 | .padding(.top, 4) |
| 82 | 82 | ForEach(section.wildcardRows) { row in |
| 83 | 83 | LabeledValueRow(row: row) |
| @@ -91,7 +91,7 @@ struct DNSSectionView: View { | ||
| 91 | 91 | Text("PTR") |
| 92 | 92 | .font(.system(.subheadline, design: .monospaced)) |
| 93 | 93 | .fontWeight(.semibold) |
| 94 | .foregroundStyle(Color(.statusInfo)) | |
| 94 | .foregroundStyle(ThemeToken.info) | |
| 95 | 95 | SectionTrustMetadataView(provenance: ptrProvenance, confidence: nil) |
| 96 | 96 | MessageRowView(text: ptrMessage.text, isError: ptrMessage.isError) |
| 97 | 97 | } |
| @@ -101,7 +101,7 @@ struct DNSSectionView: View { | ||
| 101 | 101 | HStack { |
| 102 | 102 | Text("History") |
| 103 | 103 | .font(appDensity.font(.subheadline, weight: .semibold)) |
| 104 | .foregroundStyle(Color(.statusInfo)) | |
| 104 | .foregroundStyle(ThemeToken.info) | |
| 105 | 105 | Spacer() |
| 106 | 106 | if let onLoadHistory, history.isEmpty, !historyLoading { |
| 107 | 107 | Button("Load") { |
| @@ -127,18 +127,18 @@ struct DNSSectionView: View { | ||
| 127 | 127 | VStack(alignment: .leading, spacing: 3) { |
| 128 | 128 | Text(event.date.formatted(date: .abbreviated, time: .omitted)) |
| 129 | 129 | .font(appDensity.font(.caption2)) |
| 130 | .foregroundStyle(Color(.appTextSecondary)) | |
| 130 | .foregroundStyle(ThemeToken.textSecondary) | |
| 131 | 131 | Text(event.summary) |
| 132 | 132 | .font(appDensity.font(.caption)) |
| 133 | 133 | if !event.aRecords.isEmpty { |
| 134 | 134 | Text("A: \(event.aRecords.joined(separator: ", "))") |
| 135 | 135 | .font(appDensity.font(.caption2)) |
| 136 | .foregroundStyle(Color(.appTextSecondary)) | |
| 136 | .foregroundStyle(ThemeToken.textSecondary) | |
| 137 | 137 | } |
| 138 | 138 | if !event.nameservers.isEmpty { |
| 139 | 139 | Text("NS: \(event.nameservers.joined(separator: ", "))") |
| 140 | 140 | .font(appDensity.font(.caption2)) |
| 141 | .foregroundStyle(Color(.appTextSecondary)) | |
| 141 | .foregroundStyle(ThemeToken.textSecondary) | |
| 142 | 142 | } |
| 143 | 143 | } |
| 144 | 144 | } |
DomainDig/DashboardView.swift +41 −38
| @@ -2,6 +2,9 @@ import SwiftUI | ||
| 2 | 2 | |
| 3 | 3 | struct DashboardView: View { |
| 4 | 4 | @Environment(\.appDensity) private var appDensity |
| 5 | // Read directly because the selected card's gradient needs `Color` values | |
| 6 | // rather than styles. | |
| 7 | @Environment(\.theme) private var theme | |
| 5 | 8 | @Environment(\.accessibilityDifferentiateWithoutColor) private var differentiateWithoutColor |
| 6 | 9 | @Bindable var viewModel: DomainViewModel |
| 7 | 10 | @State private var collapsedGroups = Set<String>() |
| @@ -31,20 +34,20 @@ struct DashboardView: View { | ||
| 31 | 34 | showsCardBackground: false |
| 32 | 35 | ) |
| 33 | 36 | } |
| 34 | .listRowBackground(Color(.appSurface)) | |
| 37 | .themedListRowBackground(.surface) | |
| 35 | 38 | } else { |
| 36 | 39 | Section { |
| 37 | 40 | LazyVGrid(columns: summaryColumns, spacing: 10) { |
| 38 | summaryCard(title: "Total Domains", value: dashboard.snapshot.totalDomains, filter: .all, tint: Color(.statusInfo)) | |
| 39 | summaryCard(title: "Healthy", value: dashboard.snapshot.healthyCount, filter: .healthy, tint: Color(.statusPositive)) | |
| 40 | summaryCard(title: "Warning", value: dashboard.snapshot.warningCount, filter: .warning, tint: Color(.statusWarning)) | |
| 41 | summaryCard(title: "Critical", value: dashboard.snapshot.criticalCount, filter: .critical, tint: Color(.statusCritical)) | |
| 42 | summaryCard(title: "Changes (24h)", value: dashboard.snapshot.changedLast24h, filter: .changed, tint: Color(.statusWarning)) | |
| 43 | summaryCard(title: "Unreachable", value: dashboard.snapshot.unreachableCount, filter: .unreachable, tint: Color(.statusCritical)) | |
| 41 | summaryCard(title: "Total Domains", value: dashboard.snapshot.totalDomains, filter: .all, tint: .info) | |
| 42 | summaryCard(title: "Healthy", value: dashboard.snapshot.healthyCount, filter: .healthy, tint: .positive) | |
| 43 | summaryCard(title: "Warning", value: dashboard.snapshot.warningCount, filter: .warning, tint: .warning) | |
| 44 | summaryCard(title: "Critical", value: dashboard.snapshot.criticalCount, filter: .critical, tint: .critical) | |
| 45 | summaryCard(title: "Changes (24h)", value: dashboard.snapshot.changedLast24h, filter: .changed, tint: .warning) | |
| 46 | summaryCard(title: "Unreachable", value: dashboard.snapshot.unreachableCount, filter: .unreachable, tint: .critical) | |
| 44 | 47 | } |
| 45 | 48 | .padding(.vertical, 4) |
| 46 | 49 | } |
| 47 | .listRowBackground(Color(.appSurface)) | |
| 50 | .themedListRowBackground(.surface) | |
| 48 | 51 | |
| 49 | 52 | Section("Quick Filters") { |
| 50 | 53 | ScrollView(.horizontal, showsIndicators: false) { |
| @@ -66,10 +69,10 @@ struct DashboardView: View { | ||
| 66 | 69 | Text(filter.title) |
| 67 | 70 | .font(appDensity.font(.caption, weight: .semibold)) |
| 68 | 71 | } |
| 69 | .foregroundStyle(isSelected ? Color(.appOnAccent) : Color.primary) | |
| 72 | .foregroundStyle(isSelected ? AnyShapeStyle(ThemeToken.onAccent) : AnyShapeStyle(.primary)) | |
| 70 | 73 | .padding(.horizontal, 12) |
| 71 | 74 | .padding(.vertical, 8) |
| 72 | .background(isSelected ? Color(.statusInfo) : Color(.appSurfaceElevated)) | |
| 75 | .background(isSelected ? ThemeToken.info : ThemeToken.surfaceElevated) | |
| 73 | 76 | .overlay( |
| 74 | 77 | Capsule().strokeBorder( |
| 75 | 78 | Color.primary, |
| @@ -85,7 +88,7 @@ struct DashboardView: View { | ||
| 85 | 88 | .padding(.vertical, 4) |
| 86 | 89 | } |
| 87 | 90 | } |
| 88 | .listRowBackground(Color(.appSurface)) | |
| 91 | .themedListRowBackground(.surface) | |
| 89 | 92 | |
| 90 | 93 | Section("Recent Activity") { |
| 91 | 94 | if visible.recentActivity.isEmpty { |
| @@ -98,7 +101,7 @@ struct DashboardView: View { | ||
| 98 | 101 | } |
| 99 | 102 | } |
| 100 | 103 | } |
| 101 | .listRowBackground(Color(.appSurface)) | |
| 104 | .themedListRowBackground(.surface) | |
| 102 | 105 | |
| 103 | 106 | Section("Attention Required") { |
| 104 | 107 | if visible.attentionRequired.isEmpty { |
| @@ -111,7 +114,7 @@ struct DashboardView: View { | ||
| 111 | 114 | } |
| 112 | 115 | } |
| 113 | 116 | } |
| 114 | .listRowBackground(Color(.appSurface)) | |
| 117 | .themedListRowBackground(.surface) | |
| 115 | 118 | |
| 116 | 119 | Section("Expiring Soon") { |
| 117 | 120 | if visible.expiringSoon.isEmpty { |
| @@ -127,7 +130,7 @@ struct DashboardView: View { | ||
| 127 | 130 | } |
| 128 | 131 | } |
| 129 | 132 | } |
| 130 | .listRowBackground(Color(.appSurface)) | |
| 133 | .themedListRowBackground(.surface) | |
| 131 | 134 | |
| 132 | 135 | Section("Portfolio List") { |
| 133 | 136 | if visible.groups.isEmpty { |
| @@ -156,7 +159,7 @@ struct DashboardView: View { | ||
| 156 | 159 | .font(appDensity.font(.headline, design: .default, weight: .semibold)) |
| 157 | 160 | Text("\(group.domains.count) domain\(group.domains.count == 1 ? "" : "s")") |
| 158 | 161 | .font(appDensity.font(.caption)) |
| 159 | .foregroundStyle(Color(.appTextSecondary)) | |
| 162 | .foregroundStyle(ThemeToken.textSecondary) | |
| 160 | 163 | } |
| 161 | 164 | Spacer() |
| 162 | 165 | groupBadge(for: group.domains) |
| @@ -167,11 +170,11 @@ struct DashboardView: View { | ||
| 167 | 170 | } |
| 168 | 171 | } |
| 169 | 172 | } |
| 170 | .listRowBackground(Color(.appSurface)) | |
| 173 | .themedListRowBackground(.surface) | |
| 171 | 174 | } |
| 172 | 175 | } |
| 173 | 176 | .scrollContentBackground(.hidden) |
| 174 | .background(Color(.appBackground)) | |
| 177 | .background(ThemeToken.background) | |
| 175 | 178 | .navigationTitle("Dashboard") |
| 176 | 179 | .searchable(text: $viewModel.dashboardSearchText, prompt: "Search portfolio") |
| 177 | 180 | .toolbar { |
| @@ -213,14 +216,14 @@ struct DashboardView: View { | ||
| 213 | 216 | ) |
| 214 | 217 | } |
| 215 | 218 | |
| 216 | private func summaryCard(title: String, value: Int, filter: PortfolioFilterOption, tint: Color) -> some View { | |
| 219 | private func summaryCard(title: String, value: Int, filter: PortfolioFilterOption, tint: ThemeToken) -> some View { | |
| 217 | 220 | Button { |
| 218 | 221 | viewModel.dashboardFilter = filter |
| 219 | 222 | } label: { |
| 220 | 223 | VStack(alignment: .leading, spacing: 8) { |
| 221 | 224 | Text(title) |
| 222 | 225 | .font(appDensity.font(.caption, design: .default, weight: .semibold)) |
| 223 | .foregroundStyle(Color(.appTextSecondary)) | |
| 226 | .foregroundStyle(ThemeToken.textSecondary) | |
| 224 | 227 | Text("\(value)") |
| 225 | 228 | // Was a fixed 28pt, which ignored Dynamic Type entirely. |
| 226 | 229 | .font(.system(.title, design: .rounded, weight: .bold)) |
| @@ -270,13 +273,13 @@ struct DashboardView: View { | ||
| 270 | 273 | // trick into light mode. |
| 271 | 274 | return AnyShapeStyle( |
| 272 | 275 | LinearGradient( |
| 273 | colors: [Color(.statusInfoSurface), Color(.appSurface)], | |
| 276 | colors: [theme[.infoSurface], theme[.surface]], | |
| 274 | 277 | startPoint: .topLeading, |
| 275 | 278 | endPoint: .bottomTrailing |
| 276 | 279 | ) |
| 277 | 280 | ) |
| 278 | 281 | } |
| 279 | return AnyShapeStyle(Color(.appSurfaceElevated)) | |
| 282 | return AnyShapeStyle(ThemeToken.surfaceElevated) | |
| 280 | 283 | } |
| 281 | 284 | |
| 282 | 285 | /// `label`, opening the tracked domain's detail; nothing for a domain no longer tracked. |
| @@ -295,7 +298,7 @@ struct DashboardView: View { | ||
| 295 | 298 | private func dashboardEmptyRow(_ message: String) -> some View { |
| 296 | 299 | Text(message) |
| 297 | 300 | .font(appDensity.font(.caption)) |
| 298 | .foregroundStyle(Color(.appTextSecondary)) | |
| 301 | .foregroundStyle(ThemeToken.textSecondary) | |
| 299 | 302 | .padding(.vertical, 4) |
| 300 | 303 | } |
| 301 | 304 | |
| @@ -324,8 +327,8 @@ struct DashboardView: View { | ||
| 324 | 327 | model: .init( |
| 325 | 328 | title: title, |
| 326 | 329 | systemImage: systemImage, |
| 327 | foregroundColor: tone.foreground, | |
| 328 | backgroundColor: tone.surface | |
| 330 | foreground: tone.foreground, | |
| 331 | background: tone.surface | |
| 329 | 332 | ) |
| 330 | 333 | ) |
| 331 | 334 | } |
| @@ -353,20 +356,20 @@ private struct PortfolioActivityRow: View { | ||
| 353 | 356 | Text(relativeTimestamp(item.timestamp)) |
| 354 | 357 | } |
| 355 | 358 | .font(appDensity.font(.caption2)) |
| 356 | .foregroundStyle(Color(.appTextSecondary)) | |
| 359 | .foregroundStyle(ThemeToken.textSecondary) | |
| 357 | 360 | } |
| 358 | 361 | } |
| 359 | 362 | .padding(.vertical, 4) |
| 360 | 363 | } |
| 361 | 364 | |
| 362 | private var iconColor: Color { | |
| 365 | private var iconColor: AnyShapeStyle { | |
| 363 | 366 | switch item.health { |
| 364 | 367 | case .healthy: |
| 365 | return Color(.statusInfo) | |
| 368 | return AnyShapeStyle(ThemeToken.info) | |
| 366 | 369 | case .warning: |
| 367 | return Color(.statusWarning) | |
| 370 | return AnyShapeStyle(ThemeToken.warning) | |
| 368 | 371 | case .critical: |
| 369 | return Color(.statusCritical) | |
| 372 | return AnyShapeStyle(ThemeToken.critical) | |
| 370 | 373 | } |
| 371 | 374 | } |
| 372 | 375 | } |
| @@ -385,10 +388,10 @@ private struct PortfolioAttentionRow: View { | ||
| 385 | 388 | .foregroundStyle(.primary) |
| 386 | 389 | Text(item.reason) |
| 387 | 390 | .font(appDensity.font(.caption, design: .default)) |
| 388 | .foregroundStyle(Color(.appTextSecondary)) | |
| 391 | .foregroundStyle(ThemeToken.textSecondary) | |
| 389 | 392 | Text(relativeTimestamp(item.timestamp)) |
| 390 | 393 | .font(appDensity.font(.caption2)) |
| 391 | .foregroundStyle(Color(.appTextSecondary)) | |
| 394 | .foregroundStyle(ThemeToken.textSecondary) | |
| 392 | 395 | } |
| 393 | 396 | } |
| 394 | 397 | .padding(.vertical, 4) |
| @@ -397,11 +400,11 @@ private struct PortfolioAttentionRow: View { | ||
| 397 | 400 | private var badgeModel: AppStatusBadgeModel { |
| 398 | 401 | switch item.health { |
| 399 | 402 | case .healthy: |
| 400 | return .init(title: "Healthy", systemImage: "checkmark.circle.fill", foregroundColor: Color(.statusPositive), backgroundColor: Color(.statusPositiveSurface)) | |
| 403 | return .init(title: "Healthy", systemImage: "checkmark.circle.fill", foreground: .positive, background: .positiveSurface) | |
| 401 | 404 | case .warning: |
| 402 | return .init(title: "Warning", systemImage: "exclamationmark.triangle.fill", foregroundColor: Color(.statusWarning), backgroundColor: Color(.statusWarningSurface)) | |
| 405 | return .init(title: "Warning", systemImage: "exclamationmark.triangle.fill", foreground: .warning, background: .warningSurface) | |
| 403 | 406 | case .critical: |
| 404 | return .init(title: "Critical", systemImage: "exclamationmark.octagon.fill", foregroundColor: Color(.statusCritical), backgroundColor: Color(.statusCriticalSurface)) | |
| 407 | return .init(title: "Critical", systemImage: "exclamationmark.octagon.fill", foreground: .critical, background: .criticalSurface) | |
| 405 | 408 | } |
| 406 | 409 | } |
| 407 | 410 | } |
| @@ -434,7 +437,7 @@ private struct PortfolioExpiryRow: View { | ||
| 434 | 437 | .foregroundStyle(.primary) |
| 435 | 438 | Text(expirySubtitle) |
| 436 | 439 | .font(appDensity.font(.caption)) |
| 437 | .foregroundStyle(Color(.appTextSecondary)) | |
| 440 | .foregroundStyle(ThemeToken.textSecondary) | |
| 438 | 441 | } |
| 439 | 442 | } |
| 440 | 443 | |
| @@ -448,11 +451,11 @@ private struct PortfolioExpiryRow: View { | ||
| 448 | 451 | private var badgeModel: AppStatusBadgeModel { |
| 449 | 452 | switch state.certificateExpiryState { |
| 450 | 453 | case .none: |
| 451 | return .init(title: "Healthy", systemImage: "lock.fill", foregroundColor: Color(.statusPositive), backgroundColor: Color(.statusPositiveSurface)) | |
| 454 | return .init(title: "Healthy", systemImage: "lock.fill", foreground: .positive, background: .positiveSurface) | |
| 452 | 455 | case .warning: |
| 453 | return .init(title: "Warning", systemImage: "exclamationmark.triangle.fill", foregroundColor: Color(.statusWarning), backgroundColor: Color(.statusWarningSurface)) | |
| 456 | return .init(title: "Warning", systemImage: "exclamationmark.triangle.fill", foreground: .warning, background: .warningSurface) | |
| 454 | 457 | case .critical: |
| 455 | return .init(title: "Critical", systemImage: "xmark.octagon.fill", foregroundColor: Color(.statusCritical), backgroundColor: Color(.statusCriticalSurface)) | |
| 458 | return .init(title: "Critical", systemImage: "xmark.octagon.fill", foreground: .critical, background: .criticalSurface) | |
| 456 | 459 | } |
| 457 | 460 | } |
| 458 | 461 | } |
DomainDig/DomainCompareView.swift +3 −3
| @@ -38,7 +38,7 @@ struct DomainCompareView: View { | ||
| 38 | 38 | Section { |
| 39 | 39 | Text("Choose two different domains to compare.") |
| 40 | 40 | .font(.callout) |
| 41 | .foregroundStyle(Color(.appTextSecondary)) | |
| 41 | .foregroundStyle(ThemeToken.textSecondary) | |
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | |
| @@ -63,11 +63,11 @@ struct DomainCompareView: View { | ||
| 63 | 63 | showsCardBackground: false |
| 64 | 64 | ) |
| 65 | 65 | } |
| 66 | .listRowBackground(Color(.appSurface)) | |
| 66 | .themedListRowBackground(.surface) | |
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | .scrollContentBackground(.hidden) |
| 70 | .background(Color(.appBackground)) | |
| 70 | .background(ThemeToken.background) | |
| 71 | 71 | .navigationTitle("Compare Domains") |
| 72 | 72 | } |
| 73 | 73 | |
DomainDig/DomainDiffViews.swift +17 −17
| @@ -13,11 +13,11 @@ struct DomainChangeSummaryView: View { | ||
| 13 | 13 | HStack { |
| 14 | 14 | Label(summary.hasChanges ? "Changed" : "Stable", systemImage: summary.hasChanges ? "arrow.triangle.2.circlepath" : "checkmark.circle") |
| 15 | 15 | .font(appDensity.font(.caption)) |
| 16 | .foregroundStyle(summary.hasChanges ? severityTone(summary.severity).foreground : Color(.statusPositive)) | |
| 16 | .foregroundStyle(summary.hasChanges ? severityTone(summary.severity).foreground : ThemeToken.positive) | |
| 17 | 17 | Spacer() |
| 18 | 18 | Text(summary.severity.title.uppercased()) |
| 19 | 19 | .font(appDensity.font(.caption2)) |
| 20 | .foregroundStyle(summary.hasChanges ? severityTone(summary.severity).foreground : Color(.appTextSecondary)) | |
| 20 | .foregroundStyle(summary.hasChanges ? severityTone(summary.severity).foreground : ThemeToken.textSecondary) | |
| 21 | 21 | .padding(.horizontal, 8) |
| 22 | 22 | .padding(.vertical, 4) |
| 23 | 23 | .background((summary.hasChanges ? severityTone(summary.severity) : AppStatusTone.neutral).surface) |
| @@ -31,13 +31,13 @@ struct DomainChangeSummaryView: View { | ||
| 31 | 31 | .clipShape(Capsule()) |
| 32 | 32 | Text(summary.generatedAt, style: .time) |
| 33 | 33 | .font(appDensity.font(.caption2)) |
| 34 | .foregroundStyle(Color(.appTextSecondary)) | |
| 34 | .foregroundStyle(ThemeToken.textSecondary) | |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | VStack(alignment: .leading, spacing: 4) { |
| 38 | 38 | Text("Inference") |
| 39 | 39 | .font(appDensity.font(.caption2)) |
| 40 | .foregroundStyle(Color(.appTextSecondary)) | |
| 40 | .foregroundStyle(ThemeToken.textSecondary) | |
| 41 | 41 | Text(summary.message) |
| 42 | 42 | .font(appDensity.font(.caption)) |
| 43 | 43 | .foregroundStyle(.primary) |
| @@ -51,7 +51,7 @@ struct DomainChangeSummaryView: View { | ||
| 51 | 51 | VStack(alignment: .leading, spacing: 4) { |
| 52 | 52 | Text("Observed") |
| 53 | 53 | .font(appDensity.font(.caption2)) |
| 54 | .foregroundStyle(Color(.appTextSecondary)) | |
| 54 | .foregroundStyle(ThemeToken.textSecondary) | |
| 55 | 55 | ForEach(Array(summary.observedFacts.enumerated()), id: \.offset) { _, fact in |
| 56 | 56 | Text(fact) |
| 57 | 57 | .font(appDensity.font(.caption)) |
| @@ -63,13 +63,13 @@ struct DomainChangeSummaryView: View { | ||
| 63 | 63 | if let riskScoreDelta = summary.riskScoreDelta { |
| 64 | 64 | Text("Risk delta: \(riskScoreDelta >= 0 ? "+" : "")\(riskScoreDelta)") |
| 65 | 65 | .font(appDensity.font(.caption2)) |
| 66 | .foregroundStyle(riskScoreDelta > 0 ? Color(.statusWarning) : .secondary) | |
| 66 | .foregroundStyle(riskScoreDelta > 0 ? AnyShapeStyle(ThemeToken.warning) : AnyShapeStyle(.secondary)) | |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | if let contextNote = summary.contextNote { |
| 70 | 70 | Text(contextNote) |
| 71 | 71 | .font(appDensity.font(.caption2)) |
| 72 | .foregroundStyle(Color(.statusWarning)) | |
| 72 | .foregroundStyle(ThemeToken.warning) | |
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | .padding(.top, 4) |
| @@ -153,7 +153,7 @@ struct DomainDiffView: View { | ||
| 153 | 153 | HStack { |
| 154 | 154 | Text(item.label) |
| 155 | 155 | .font(.system(.caption, design: .monospaced)) |
| 156 | .foregroundStyle(Color(.appTextSecondary)) | |
| 156 | .foregroundStyle(ThemeToken.textSecondary) | |
| 157 | 157 | Spacer() |
| 158 | 158 | Text("\(item.changeType.marker) \(item.severity.title) • \(changeLabel(for: item.changeType))") |
| 159 | 159 | .font(.system(.caption2, design: .monospaced)) |
| @@ -168,10 +168,10 @@ struct DomainDiffView: View { | ||
| 168 | 168 | VStack(alignment: .leading, spacing: 2) { |
| 169 | 169 | Text("Old") |
| 170 | 170 | .font(.system(.caption2, design: .monospaced)) |
| 171 | .foregroundStyle(Color(.appTextSecondary)) | |
| 171 | .foregroundStyle(ThemeToken.textSecondary) | |
| 172 | 172 | Text(oldValue) |
| 173 | 173 | .font(.system(.caption2, design: .monospaced)) |
| 174 | .foregroundStyle(Color(.appTextSecondary)) | |
| 174 | .foregroundStyle(ThemeToken.textSecondary) | |
| 175 | 175 | .textSelection(.enabled) |
| 176 | 176 | } |
| 177 | 177 | } |
| @@ -180,7 +180,7 @@ struct DomainDiffView: View { | ||
| 180 | 180 | VStack(alignment: .leading, spacing: 2) { |
| 181 | 181 | Text("New") |
| 182 | 182 | .font(.system(.caption2, design: .monospaced)) |
| 183 | .foregroundStyle(Color(.appTextSecondary)) | |
| 183 | .foregroundStyle(ThemeToken.textSecondary) | |
| 184 | 184 | Text(newValue) |
| 185 | 185 | .font(.system(.caption, design: .monospaced)) |
| 186 | 186 | .foregroundStyle(item.hasChanges ? .primary : .secondary) |
| @@ -189,7 +189,7 @@ struct DomainDiffView: View { | ||
| 189 | 189 | } |
| 190 | 190 | } |
| 191 | 191 | .padding(10) |
| 192 | .background(item.hasChanges ? changeTone(for: item).surface : Color(.appSurface)) | |
| 192 | .background(item.hasChanges ? changeTone(for: item).surface : ThemeToken.surface) | |
| 193 | 193 | .cornerRadius(8) |
| 194 | 194 | } |
| 195 | 195 | } label: { |
| @@ -209,7 +209,7 @@ struct DomainDiffView: View { | ||
| 209 | 209 | .overlay { |
| 210 | 210 | if highlightedSectionID == section.id { |
| 211 | 211 | RoundedRectangle(cornerRadius: 12) |
| 212 | .stroke(Color(.statusInfo).opacity(0.55), lineWidth: 1) | |
| 212 | .stroke(ThemeToken.info.opacity(0.55), lineWidth: 1) | |
| 213 | 213 | } |
| 214 | 214 | } |
| 215 | 215 | } |
| @@ -248,14 +248,14 @@ struct DomainDiffView: View { | ||
| 248 | 248 | } |
| 249 | 249 | } |
| 250 | 250 | |
| 251 | private func sectionColor(_ section: DomainDiffSection) -> Color { | |
| 251 | private func sectionColor(_ section: DomainDiffSection) -> AnyShapeStyle { | |
| 252 | 252 | switch section.severity { |
| 253 | 253 | case .low: |
| 254 | return .blue | |
| 254 | return AnyShapeStyle(.blue) | |
| 255 | 255 | case .medium: |
| 256 | return Color(.statusWarning) | |
| 256 | return AnyShapeStyle(ThemeToken.warning) | |
| 257 | 257 | case .high: |
| 258 | return Color(.statusCritical) | |
| 258 | return AnyShapeStyle(ThemeToken.critical) | |
| 259 | 259 | } |
| 260 | 260 | } |
| 261 | 261 | |
DomainDig/DomainDigApp.swift +13
| @@ -13,11 +13,20 @@ struct DomainDigApp: App { | ||
| 13 | 13 | @Environment(\.scenePhase) private var scenePhase |
| 14 | 14 | @AppStorage(AppDensity.userDefaultsKey) private var density = AppDensity.compact.rawValue |
| 15 | 15 | @AppStorage(AppAppearance.userDefaultsKey) private var appearance = AppAppearance.system.rawValue |
| 16 | @AppStorage(AccentTheme.userDefaultsKey) private var accent = AccentTheme.default.rawValue | |
| 16 | 17 | @State private var viewModel = DomainViewModel() |
| 17 | 18 | @State private var purchaseService = PurchaseService.shared |
| 18 | 19 | @State private var cloudSyncService = CloudSyncService.shared |
| 19 | 20 | @State private var localAPIService = LocalAPIService.shared |
| 20 | 21 | |
| 22 | /// Falls back to the default when the tier does not include themes, so a | |
| 23 | /// lapsed subscriber sees the stock palette rather than a theme they can no | |
| 24 | /// longer change. | |
| 25 | private var selectedAccent: AccentTheme { | |
| 26 | guard FeatureAccessService.hasAccess(to: .accentTheme) else { return .default } | |
| 27 | return AccentTheme(rawValue: accent) ?? .default | |
| 28 | } | |
| 29 | ||
| 21 | 30 | init() { |
| 22 | 31 | LocalNotificationService.shared.configureForegroundPresentation() |
| 23 | 32 | DomainMonitoringScheduler.shared.registerBackgroundTask() |
| @@ -28,6 +37,10 @@ struct DomainDigApp: App { | ||
| 28 | 37 | WindowGroup { |
| 29 | 38 | RootTabView(viewModel: viewModel) |
| 30 | 39 | .environment(\.appDensity, AppDensity(rawValue: density) ?? .compact) |
| 40 | .environment(\.theme, selectedAccent.theme) | |
| 41 | // So standard controls pick the accent up too, not only the | |
| 42 | // views that name a token. | |
| 43 | .tint(selectedAccent == .default ? nil : selectedAccent.theme.accentFill) | |
| 31 | 44 | // The single place appearance is applied. Keep it that way. |
| 32 | 45 | .preferredColorScheme((AppAppearance(rawValue: appearance) ?? .system).colorScheme) |
| 33 | 46 | .task { |
DomainDig/DomainDigUI.swift +46 −39
| @@ -145,95 +145,102 @@ enum AppStatusTone { | ||
| 145 | 145 | case info |
| 146 | 146 | case neutral |
| 147 | 147 | |
| 148 | var foreground: Color { | |
| 148 | var foreground: ThemeToken { | |
| 149 | 149 | switch self { |
| 150 | 150 | case .positive: |
| 151 | return Color(.statusPositive) | |
| 151 | return .positive | |
| 152 | 152 | case .warning: |
| 153 | return Color(.statusWarning) | |
| 153 | return .warning | |
| 154 | 154 | case .critical: |
| 155 | return Color(.statusCritical) | |
| 155 | return .critical | |
| 156 | 156 | case .info: |
| 157 | return Color(.statusInfo) | |
| 157 | return .info | |
| 158 | 158 | case .neutral: |
| 159 | return Color(.statusNeutral) | |
| 159 | return .neutral | |
| 160 | 160 | } |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | var surface: Color { | |
| 163 | var surface: ThemeToken { | |
| 164 | 164 | switch self { |
| 165 | 165 | case .positive: |
| 166 | return Color(.statusPositiveSurface) | |
| 166 | return .positiveSurface | |
| 167 | 167 | case .warning: |
| 168 | return Color(.statusWarningSurface) | |
| 168 | return .warningSurface | |
| 169 | 169 | case .critical: |
| 170 | return Color(.statusCriticalSurface) | |
| 170 | return .criticalSurface | |
| 171 | 171 | case .info: |
| 172 | return Color(.statusInfoSurface) | |
| 172 | return .infoSurface | |
| 173 | 173 | case .neutral: |
| 174 | return Color(.statusNeutralSurface) | |
| 174 | return .neutralSurface | |
| 175 | 175 | } |
| 176 | 176 | } |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | /// A badge's appearance, named rather than resolved. | |
| 180 | /// | |
| 181 | /// The colours are `ThemeToken`s because every one of these is built outside a | |
| 182 | /// view body — `AppStatusFactory` and the per-row helpers are plain functions — | |
| 183 | /// so they cannot read the environment. `AppStatusBadgeView` resolves them when | |
| 184 | /// it draws. | |
| 179 | 185 | struct AppStatusBadgeModel: Equatable { |
| 180 | 186 | let title: String |
| 181 | 187 | let systemImage: String? |
| 182 | let foregroundColor: Color | |
| 183 | let backgroundColor: Color | |
| 188 | let foreground: ThemeToken | |
| 189 | let background: ThemeToken | |
| 184 | 190 | } |
| 185 | 191 | |
| 186 | 192 | enum AppStatusFactory { |
| 187 | 193 | static func availability(_ status: DomainAvailabilityStatus?) -> AppStatusBadgeModel { |
| 188 | 194 | switch status { |
| 189 | 195 | case .available: |
| 190 | return .init(title: "Available", systemImage: "checkmark.circle.fill", foregroundColor: Color(.statusPositive), backgroundColor: Color(.statusPositiveSurface)) | |
| 196 | return .init(title: "Available", systemImage: "checkmark.circle.fill", foreground: .positive, background: .positiveSurface) | |
| 191 | 197 | case .registered: |
| 192 | return .init(title: "Registered", systemImage: "circle.fill", foregroundColor: Color(.statusWarning), backgroundColor: Color(.statusWarningSurface)) | |
| 198 | return .init(title: "Registered", systemImage: "circle.fill", foreground: .warning, background: .warningSurface) | |
| 193 | 199 | case .unknown, .none: |
| 194 | return .init(title: "Unknown", systemImage: "questionmark.circle", foregroundColor: Color(.appTextSecondary), backgroundColor: Color(.appSurfaceElevated)) | |
| 200 | return .init(title: "Unknown", systemImage: "questionmark.circle", foreground: .textSecondary, background: .surfaceElevated) | |
| 195 | 201 | } |
| 196 | 202 | } |
| 197 | 203 | |
| 198 | 204 | static func tls(sslInfo: SSLCertificateInfo?, error: String?) -> AppStatusBadgeModel { |
| 199 | 205 | if error != nil || sslInfo == nil { |
| 200 | return .init(title: "Invalid", systemImage: "xmark.octagon.fill", foregroundColor: Color(.statusCritical), backgroundColor: Color(.statusCriticalSurface)) | |
| 206 | return .init(title: "Invalid", systemImage: "xmark.octagon.fill", foreground: .critical, background: .criticalSurface) | |
| 201 | 207 | } |
| 202 | 208 | if let sslInfo, sslInfo.daysUntilExpiry <= 14 { |
| 203 | return .init(title: "Expiring", systemImage: "exclamationmark.triangle.fill", foregroundColor: Color(.statusWarning), backgroundColor: Color(.statusWarningSurface)) | |
| 209 | return .init(title: "Expiring", systemImage: "exclamationmark.triangle.fill", foreground: .warning, background: .warningSurface) | |
| 204 | 210 | } |
| 205 | return .init(title: "Valid", systemImage: "lock.fill", foregroundColor: Color(.statusPositive), backgroundColor: Color(.statusPositiveSurface)) | |
| 211 | return .init(title: "Valid", systemImage: "lock.fill", foreground: .positive, background: .positiveSurface) | |
| 206 | 212 | } |
| 207 | 213 | |
| 208 | 214 | static func email(_ result: EmailSecurityResult?, error: String?) -> AppStatusBadgeModel { |
| 209 | 215 | guard error == nil, let result else { |
| 210 | return .init(title: "Missing", systemImage: "minus.circle", foregroundColor: Color(.appTextSecondary), backgroundColor: Color(.appSurfaceElevated)) | |
| 216 | return .init(title: "Missing", systemImage: "minus.circle", foreground: .textSecondary, background: .surfaceElevated) | |
| 211 | 217 | } |
| 212 | 218 | |
| 213 | 219 | let foundCount = [result.spf.found, result.dmarc.found, result.dkim.found].filter { $0 }.count |
| 214 | 220 | switch foundCount { |
| 215 | 221 | case 3: |
| 216 | return .init(title: "Secure", systemImage: "checkmark.shield.fill", foregroundColor: Color(.statusPositive), backgroundColor: Color(.statusPositiveSurface)) | |
| 222 | return .init(title: "Secure", systemImage: "checkmark.shield.fill", foreground: .positive, background: .positiveSurface) | |
| 217 | 223 | case 1, 2: |
| 218 | return .init(title: "Partial", systemImage: "shield.lefthalf.filled", foregroundColor: Color(.statusWarning), backgroundColor: Color(.statusWarningSurface)) | |
| 224 | return .init(title: "Partial", systemImage: "shield.lefthalf.filled", foreground: .warning, background: .warningSurface) | |
| 219 | 225 | default: |
| 220 | return .init(title: "Missing", systemImage: "minus.circle", foregroundColor: Color(.appTextSecondary), backgroundColor: Color(.appSurfaceElevated)) | |
| 226 | return .init(title: "Missing", systemImage: "minus.circle", foreground: .textSecondary, background: .surfaceElevated) | |
| 221 | 227 | } |
| 222 | 228 | } |
| 223 | 229 | |
| 224 | 230 | static func change(_ summary: DomainChangeSummary?) -> AppStatusBadgeModel { |
| 225 | 231 | guard let summary else { |
| 226 | return .init(title: "Unchanged", systemImage: "circle", foregroundColor: Color(.appTextSecondary), backgroundColor: Color(.appSurfaceElevated)) | |
| 232 | return .init(title: "Unchanged", systemImage: "circle", foreground: .textSecondary, background: .surfaceElevated) | |
| 227 | 233 | } |
| 228 | 234 | if summary.hasChanges { |
| 229 | return .init(title: "Changed", systemImage: "arrow.triangle.2.circlepath", foregroundColor: Color(.statusInfo), backgroundColor: Color(.statusInfoSurface)) | |
| 235 | return .init(title: "Changed", systemImage: "arrow.triangle.2.circlepath", foreground: .info, background: .infoSurface) | |
| 230 | 236 | } |
| 231 | return .init(title: "Unchanged", systemImage: "checkmark.circle", foregroundColor: Color(.appTextSecondary), backgroundColor: Color(.appSurfaceElevated)) | |
| 237 | return .init(title: "Unchanged", systemImage: "checkmark.circle", foreground: .textSecondary, background: .surfaceElevated) | |
| 232 | 238 | } |
| 233 | 239 | } |
| 234 | 240 | |
| 235 | 241 | struct AppStatusBadgeView: View { |
| 236 | 242 | @Environment(\.appDensity) private var appDensity |
| 243 | @Environment(\.theme) private var theme | |
| 237 | 244 | |
| 238 | 245 | let model: AppStatusBadgeModel |
| 239 | 246 | |
| @@ -251,10 +258,10 @@ struct AppStatusBadgeView: View { | ||
| 251 | 258 | // ViewThatFits onto its stacked layout, which is the intended fallback. |
| 252 | 259 | .fixedSize() |
| 253 | 260 | .font(appDensity.font(.caption, weight: .semibold)) |
| 254 | .foregroundStyle(model.foregroundColor) | |
| 261 | .foregroundStyle(theme[model.foreground]) | |
| 255 | 262 | .padding(.horizontal, 9) |
| 256 | 263 | .padding(.vertical, 5) |
| 257 | .background(model.backgroundColor) | |
| 264 | .background(theme[model.background]) | |
| 258 | 265 | .clipShape(Capsule()) |
| 259 | 266 | // Read as one word ("Critical"), not "icon, Critical". The symbol |
| 260 | 267 | // duplicates the title for VoiceOver. |
| @@ -294,9 +301,9 @@ struct AppCopyButton: View { | ||
| 294 | 301 | } label: { |
| 295 | 302 | Image(systemName: didCopy ? "checkmark" : "doc.on.doc") |
| 296 | 303 | .font(appDensity.font(.caption)) |
| 297 | .foregroundStyle(didCopy ? Color(.statusPositive) : Color(.appTextSecondary)) | |
| 304 | .foregroundStyle(didCopy ? ThemeToken.positive : ThemeToken.textSecondary) | |
| 298 | 305 | .frame(width: max(size, AppLayout.minimumTapTarget), height: max(size, AppLayout.minimumTapTarget)) |
| 299 | .background(Color(.appSurfaceElevated)) | |
| 306 | .background(ThemeToken.surfaceElevated) | |
| 300 | 307 | .clipShape(RoundedRectangle(cornerRadius: 8)) |
| 301 | 308 | } |
| 302 | 309 | .buttonStyle(.plain) |
| @@ -400,17 +407,17 @@ struct EmptyStateCardView: View { | ||
| 400 | 407 | |
| 401 | 408 | Text(message) |
| 402 | 409 | .font(appDensity.font(.body)) |
| 403 | .foregroundStyle(Color(.appTextSecondary)) | |
| 410 | .foregroundStyle(ThemeToken.textSecondary) | |
| 404 | 411 | .fixedSize(horizontal: false, vertical: true) |
| 405 | 412 | |
| 406 | 413 | Text(suggestion) |
| 407 | 414 | .font(appDensity.font(.caption)) |
| 408 | .foregroundStyle(Color(.statusInfo)) | |
| 415 | .foregroundStyle(ThemeToken.info) | |
| 409 | 416 | .fixedSize(horizontal: false, vertical: true) |
| 410 | 417 | } |
| 411 | 418 | .frame(maxWidth: .infinity, alignment: .leading) |
| 412 | 419 | .padding(appDensity.metrics.cardPadding) |
| 413 | .background(showsCardBackground ? Color(.appSurface) : Color.clear) | |
| 420 | .background(showsCardBackground ? AnyShapeStyle(ThemeToken.surface) : AnyShapeStyle(.clear)) | |
| 414 | 421 | .clipShape(RoundedRectangle(cornerRadius: appDensity.metrics.cardCornerRadius)) |
| 415 | 422 | } |
| 416 | 423 | } |
| @@ -503,7 +510,7 @@ struct CollapsibleSectionView<HeaderTrailing: View, Content: View>: View { | ||
| 503 | 510 | if let subtitle { |
| 504 | 511 | Text(subtitle) |
| 505 | 512 | .font(appDensity.font(.caption)) |
| 506 | .foregroundStyle(Color(.appTextSecondary)) | |
| 513 | .foregroundStyle(ThemeToken.textSecondary) | |
| 507 | 514 | .fixedSize(horizontal: false, vertical: true) |
| 508 | 515 | } |
| 509 | 516 | } |
| @@ -512,7 +519,7 @@ struct CollapsibleSectionView<HeaderTrailing: View, Content: View>: View { | ||
| 512 | 519 | private var chevron: some View { |
| 513 | 520 | Image(systemName: isCollapsed ? "chevron.down" : "chevron.up") |
| 514 | 521 | .font(.caption.weight(.semibold)) |
| 515 | .foregroundStyle(Color(.appTextSecondary)) | |
| 522 | .foregroundStyle(ThemeToken.textSecondary) | |
| 516 | 523 | .accessibilityHidden(true) |
| 517 | 524 | } |
| 518 | 525 | } |
| @@ -530,7 +537,7 @@ struct TagChipRowView: View { | ||
| 530 | 537 | .font(.caption) |
| 531 | 538 | .padding(.horizontal, 10) |
| 532 | 539 | .padding(.vertical, 5) |
| 533 | .background(Color(.appSurfaceElevated), in: Capsule()) | |
| 540 | .background(ThemeToken.surfaceElevated, in: Capsule()) | |
| 534 | 541 | } |
| 535 | 542 | } |
| 536 | 543 | } |
| @@ -564,8 +571,8 @@ struct TagFilterChipRowView: View { | ||
| 564 | 571 | .font(.caption) |
| 565 | 572 | .padding(.horizontal, 10) |
| 566 | 573 | .padding(.vertical, 5) |
| 567 | .background(isSelected ? Color(.statusInfoSurface) : Color(.appSurfaceElevated), in: Capsule()) | |
| 568 | .foregroundStyle(isSelected ? Color(.statusInfo) : Color.primary) | |
| 574 | .background(isSelected ? ThemeToken.infoSurface : ThemeToken.surfaceElevated, in: Capsule()) | |
| 575 | .foregroundStyle(isSelected ? AnyShapeStyle(ThemeToken.info) : AnyShapeStyle(.primary)) | |
| 569 | 576 | } |
| 570 | 577 | .buttonStyle(.plain) |
| 571 | 578 | } |
DomainDig/DomainSectionView.swift +4 −4
| @@ -35,9 +35,9 @@ struct DomainSectionView: View { | ||
| 35 | 35 | // VoiceOver still hears the word via the label. |
| 36 | 36 | Image(systemName: "eye.fill") |
| 37 | 37 | .font(appDensity.font(.caption)) |
| 38 | .foregroundStyle(Color(.statusPositive)) | |
| 38 | .foregroundStyle(ThemeToken.positive) | |
| 39 | 39 | .padding(6) |
| 40 | .background(Color(.statusPositiveSurface), in: Circle()) | |
| 40 | .background(ThemeToken.positiveSurface, in: Circle()) | |
| 41 | 41 | .fixedSize() |
| 42 | 42 | .accessibilityLabel("Tracked") |
| 43 | 43 | Button { |
| @@ -100,7 +100,7 @@ struct DomainSectionView: View { | ||
| 100 | 100 | VStack(alignment: .leading, spacing: 8) { |
| 101 | 101 | Text("Part of workflow") |
| 102 | 102 | .font(appDensity.font(.caption)) |
| 103 | .foregroundStyle(Color(.appTextSecondary)) | |
| 103 | .foregroundStyle(ThemeToken.textSecondary) | |
| 104 | 104 | |
| 105 | 105 | ForEach(workflows) { workflow in |
| 106 | 106 | HStack { |
| @@ -135,7 +135,7 @@ struct DomainSectionView: View { | ||
| 135 | 135 | if showSuggestions { |
| 136 | 136 | Text("Suggestions") |
| 137 | 137 | .font(appDensity.font(.caption)) |
| 138 | .foregroundStyle(Color(.appTextSecondary)) | |
| 138 | .foregroundStyle(ThemeToken.textSecondary) | |
| 139 | 139 | .padding(.top, 4) |
| 140 | 140 | if suggestionsLoading { |
| 141 | 141 | ProgressView("Checking alternatives…") |
DomainDig/EmailSectionView.swift +7 −7
| @@ -29,7 +29,7 @@ struct EmailSectionView: View { | ||
| 29 | 29 | if !assessment.reasons.isEmpty { |
| 30 | 30 | Text(assessment.reasons.joined(separator: " | ")) |
| 31 | 31 | .font(appDensity.font(.caption2)) |
| 32 | .foregroundStyle(Color(.appTextSecondary)) | |
| 32 | .foregroundStyle(ThemeToken.textSecondary) | |
| 33 | 33 | } |
| 34 | 34 | } |
| 35 | 35 | if loading { |
| @@ -45,7 +45,7 @@ struct EmailSectionView: View { | ||
| 45 | 45 | HStack(spacing: 8) { |
| 46 | 46 | Text(row.label) |
| 47 | 47 | .font(appDensity.font(.caption)) |
| 48 | .foregroundStyle(Color(.statusInfo)) | |
| 48 | .foregroundStyle(ThemeToken.info) | |
| 49 | 49 | .frame(width: 76, alignment: .leading) |
| 50 | 50 | AppStatusBadgeView(model: emailRowBadge(row)) |
| 51 | 51 | } |
| @@ -56,7 +56,7 @@ struct EmailSectionView: View { | ||
| 56 | 56 | if let auxiliaryDetail = row.auxiliaryDetail { |
| 57 | 57 | Text(auxiliaryDetail) |
| 58 | 58 | .font(appDensity.font(.caption2)) |
| 59 | .foregroundStyle(Color(.appTextSecondary)) | |
| 59 | .foregroundStyle(ThemeToken.textSecondary) | |
| 60 | 60 | } |
| 61 | 61 | } |
| 62 | 62 | } |
| @@ -68,13 +68,13 @@ struct EmailSectionView: View { | ||
| 68 | 68 | private func emailRowBadge(_ row: EmailRowViewData) -> AppStatusBadgeModel { |
| 69 | 69 | switch row.statusTone { |
| 70 | 70 | case .success: |
| 71 | return .init(title: row.status, systemImage: "checkmark.shield.fill", foregroundColor: Color(.statusPositive), backgroundColor: Color(.statusPositiveSurface)) | |
| 71 | return .init(title: row.status, systemImage: "checkmark.shield.fill", foreground: .positive, background: .positiveSurface) | |
| 72 | 72 | case .warning: |
| 73 | return .init(title: row.status, systemImage: "shield.lefthalf.filled", foregroundColor: Color(.statusWarning), backgroundColor: Color(.statusWarningSurface)) | |
| 73 | return .init(title: row.status, systemImage: "shield.lefthalf.filled", foreground: .warning, background: .warningSurface) | |
| 74 | 74 | case .failure: |
| 75 | return .init(title: row.status, systemImage: "minus.circle", foregroundColor: Color(.appTextSecondary), backgroundColor: Color(.appSurfaceElevated)) | |
| 75 | return .init(title: row.status, systemImage: "minus.circle", foreground: .textSecondary, background: .surfaceElevated) | |
| 76 | 76 | case .primary, .secondary: |
| 77 | return .init(title: row.status, systemImage: "circle", foregroundColor: Color(.appTextSecondary), backgroundColor: Color(.appSurfaceElevated)) | |
| 77 | return .init(title: row.status, systemImage: "circle", foreground: .textSecondary, background: .surfaceElevated) | |
| 78 | 78 | } |
| 79 | 79 | } |
| 80 | 80 | } |
DomainDig/FeatureAccessService.swift +5 −2
| @@ -33,6 +33,7 @@ enum FeatureCapability: String, CaseIterable, Identifiable { | ||
| 33 | 33 | case auditDepth |
| 34 | 34 | case intelligenceDetail |
| 35 | 35 | case bucketExport |
| 36 | case accentTheme | |
| 36 | 37 | |
| 37 | 38 | var id: String { rawValue } |
| 38 | 39 | |
| @@ -64,6 +65,8 @@ enum FeatureCapability: String, CaseIterable, Identifiable { | ||
| 64 | 65 | return "Intelligence detail" |
| 65 | 66 | case .bucketExport: |
| 66 | 67 | return "Export to your own bucket" |
| 68 | case .accentTheme: | |
| 69 | return "Accent themes" | |
| 67 | 70 | } |
| 68 | 71 | } |
| 69 | 72 | } |
| @@ -194,7 +197,7 @@ enum FeatureAccessService { | ||
| 194 | 197 | case .workflows, .batchOperations, .automatedMonitoring, .localAlerts, .advancedExports, |
| 195 | 198 | .extendedSubdomains: |
| 196 | 199 | return "Available in Pro" |
| 197 | case .sharedPortfolios, .auditDepth, .intelligenceDetail, .bucketExport: | |
| 200 | case .sharedPortfolios, .auditDepth, .intelligenceDetail, .bucketExport, .accentTheme: | |
| 198 | 201 | return "Available in Pro+" |
| 199 | 202 | case .limitedTracking: |
| 200 | 203 | return "Tracking is limited on Free" |
| @@ -256,7 +259,7 @@ enum FeatureAccessService { | ||
| 256 | 259 | static func upgradePrompt(for capability: FeatureCapability) -> UpgradePromptContext { |
| 257 | 260 | let title: String |
| 258 | 261 | switch capability { |
| 259 | case .sharedPortfolios, .auditDepth, .intelligenceDetail, .bucketExport: | |
| 262 | case .sharedPortfolios, .auditDepth, .intelligenceDetail, .bucketExport, .accentTheme: | |
| 260 | 263 | title = "Available in Pro+" |
| 261 | 264 | default: |
| 262 | 265 | title = "Available in Pro" |
DomainDig/HistoryView.swift +15 −15
| @@ -25,7 +25,7 @@ struct HistoryView: View { | ||
| 25 | 25 | systemImage: "clock.arrow.trianglehead.counterclockwise.rotate.90", |
| 26 | 26 | showsCardBackground: false |
| 27 | 27 | ) |
| 28 | .listRowBackground(Color(.appSurface)) | |
| 28 | .themedListRowBackground(.surface) | |
| 29 | 29 | } else { |
| 30 | 30 | Section("Domains") { |
| 31 | 31 | ForEach(domainSummaries, id: \.domain) { item in |
| @@ -40,12 +40,12 @@ struct HistoryView: View { | ||
| 40 | 40 | Spacer() |
| 41 | 41 | Text("\(item.count) snapshots") |
| 42 | 42 | .font(appDensity.font(.caption2)) |
| 43 | .foregroundStyle(Color(.appTextSecondary)) | |
| 43 | .foregroundStyle(ThemeToken.textSecondary) | |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | Text(item.latest.changeSummaryMessage ?? "No change summary") |
| 47 | 47 | .font(appDensity.font(.caption)) |
| 48 | .foregroundStyle(Color(.appTextSecondary)) | |
| 48 | .foregroundStyle(ThemeToken.textSecondary) | |
| 49 | 49 | .lineLimit(2) |
| 50 | 50 | |
| 51 | 51 | HStack(spacing: 8) { |
| @@ -55,21 +55,21 @@ struct HistoryView: View { | ||
| 55 | 55 | model: .init( |
| 56 | 56 | title: severity.title, |
| 57 | 57 | systemImage: "arrow.triangle.2.circlepath", |
| 58 | foregroundColor: severity == .high ? Color(.statusCritical) : Color(.statusWarning), | |
| 59 | backgroundColor: (severity == .high ? AppStatusTone.critical : .warning).surface | |
| 58 | foreground: severity == .high ? .critical : .warning, | |
| 59 | background: (severity == .high ? AppStatusTone.critical : .warning).surface | |
| 60 | 60 | ) |
| 61 | 61 | ) |
| 62 | 62 | } |
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | .listRowBackground(Color(.appSurface)) | |
| 66 | .themedListRowBackground(.surface) | |
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | 71 | .scrollContentBackground(.hidden) |
| 72 | .background(Color(.appBackground)) | |
| 72 | .background(ThemeToken.background) | |
| 73 | 73 | .navigationTitle("History") |
| 74 | 74 | .searchable(text: $viewModel.timelineDomainFilter, prompt: "Search domains") |
| 75 | 75 | .toolbar { |
| @@ -296,10 +296,10 @@ struct HistoryDetailView: View { | ||
| 296 | 296 | ) |
| 297 | 297 | } |
| 298 | 298 | } |
| 299 | .listRowBackground(Color(.appSurface)) | |
| 299 | .themedListRowBackground(.surface) | |
| 300 | 300 | .environment(\.cardProvidesSurface, false) |
| 301 | 301 | .scrollContentBackground(.hidden) |
| 302 | .background(Color(.appBackground)) | |
| 302 | .background(ThemeToken.background) | |
| 303 | 303 | .navigationTitle(entry.domain) |
| 304 | 304 | .toolbar { |
| 305 | 305 | ToolbarItemGroup(placement: .topBarTrailing) { |
| @@ -362,28 +362,28 @@ struct HistoryDetailView: View { | ||
| 362 | 362 | Spacer() |
| 363 | 363 | Text("Live re-run available") |
| 364 | 364 | .font(appDensity.font(.caption2)) |
| 365 | .foregroundStyle(Color(.appTextSecondary)) | |
| 365 | .foregroundStyle(ThemeToken.textSecondary) | |
| 366 | 366 | } |
| 367 | 367 | if let mismatchNote = viewModel.resolverMismatchNote(for: entry) { |
| 368 | 368 | Text(mismatchNote) |
| 369 | 369 | .font(appDensity.font(.caption2)) |
| 370 | .foregroundStyle(Color(.statusWarning)) | |
| 370 | .foregroundStyle(ThemeToken.warning) | |
| 371 | 371 | } |
| 372 | 372 | if entry.isPartialSnapshot { |
| 373 | 373 | Text("Partial snapshot: \(entry.validationIssues.joined(separator: " | "))") |
| 374 | 374 | .font(appDensity.font(.caption2)) |
| 375 | .foregroundStyle(Color(.statusWarning)) | |
| 375 | .foregroundStyle(ThemeToken.warning) | |
| 376 | 376 | } |
| 377 | 377 | if let note = entry.note, !note.isEmpty { |
| 378 | 378 | Text(note) |
| 379 | 379 | .font(appDensity.font(.caption2)) |
| 380 | .foregroundStyle(Color(.appTextSecondary)) | |
| 380 | .foregroundStyle(ThemeToken.textSecondary) | |
| 381 | 381 | } |
| 382 | 382 | } |
| 383 | .foregroundStyle(Color(.appTextSecondary)) | |
| 383 | .foregroundStyle(ThemeToken.textSecondary) | |
| 384 | 384 | .padding(8) |
| 385 | 385 | .frame(maxWidth: .infinity, alignment: .leading) |
| 386 | .background(Color(.appSurface)) | |
| 386 | .background(ThemeToken.surface) | |
| 387 | 387 | .clipShape(RoundedRectangle(cornerRadius: appDensity.metrics.cardCornerRadius)) |
| 388 | 388 | .padding(.vertical, 12) |
| 389 | 389 | } |
DomainDig/IntegrationsView.swift +22 −22
| @@ -15,7 +15,7 @@ struct IntegrationsSettingsView: View { | ||
| 15 | 15 | if let statusMessage = integrationService.statusMessage { |
| 16 | 16 | Text(statusMessage) |
| 17 | 17 | .font(.caption) |
| 18 | .foregroundStyle(Color(.appTextSecondary)) | |
| 18 | .foregroundStyle(ThemeToken.textSecondary) | |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | Button("Process Queue Now") { |
| @@ -26,7 +26,7 @@ struct IntegrationsSettingsView: View { | ||
| 26 | 26 | Section("Targets") { |
| 27 | 27 | if integrationService.targets.isEmpty { |
| 28 | 28 | Text("No integrations configured.") |
| 29 | .foregroundStyle(Color(.appTextSecondary)) | |
| 29 | .foregroundStyle(ThemeToken.textSecondary) | |
| 30 | 30 | } else { |
| 31 | 31 | ForEach(integrationService.targets) { target in |
| 32 | 32 | NavigationLink { |
| @@ -42,17 +42,17 @@ struct IntegrationsSettingsView: View { | ||
| 42 | 42 | Text(target.name) |
| 43 | 43 | Spacer() |
| 44 | 44 | Text(target.type.title) |
| 45 | .foregroundStyle(Color(.appTextSecondary)) | |
| 45 | .foregroundStyle(ThemeToken.textSecondary) | |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | Text(summary(for: target)) |
| 49 | 49 | .font(.caption) |
| 50 | .foregroundStyle(Color(.appTextSecondary)) | |
| 50 | .foregroundStyle(ThemeToken.textSecondary) | |
| 51 | 51 | |
| 52 | 52 | if !target.isEnabled { |
| 53 | 53 | Text("Disabled") |
| 54 | 54 | .font(.caption2) |
| 55 | .foregroundStyle(Color(.statusWarning)) | |
| 55 | .foregroundStyle(ThemeToken.warning) | |
| 56 | 56 | } |
| 57 | 57 | } |
| 58 | 58 | } |
| @@ -140,7 +140,7 @@ private struct IntegrationDetailView: View { | ||
| 140 | 140 | Section("Delivery Log") { |
| 141 | 141 | if integrationService.deliveryRecords(for: target.id).isEmpty { |
| 142 | 142 | Text("No deliveries yet.") |
| 143 | .foregroundStyle(Color(.appTextSecondary)) | |
| 143 | .foregroundStyle(ThemeToken.textSecondary) | |
| 144 | 144 | } else { |
| 145 | 145 | ForEach(integrationService.deliveryRecords(for: target.id), id: \.id) { record in |
| 146 | 146 | VStack(alignment: .leading, spacing: 4) { |
| @@ -149,7 +149,7 @@ private struct IntegrationDetailView: View { | ||
| 149 | 149 | Spacer() |
| 150 | 150 | Text(record.timestamp.formatted(date: .abbreviated, time: .shortened)) |
| 151 | 151 | .font(.caption) |
| 152 | .foregroundStyle(Color(.appTextSecondary)) | |
| 152 | .foregroundStyle(ThemeToken.textSecondary) | |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | Text(record.summary) |
| @@ -157,13 +157,13 @@ private struct IntegrationDetailView: View { | ||
| 157 | 157 | |
| 158 | 158 | Text(record.destination) |
| 159 | 159 | .font(.caption) |
| 160 | .foregroundStyle(Color(.appTextSecondary)) | |
| 160 | .foregroundStyle(ThemeToken.textSecondary) | |
| 161 | 161 | |
| 162 | 162 | if let failureReason = record.failureReason { |
| 163 | let failureColor: Color = record.status == .skipped ? .secondary : Color(.statusCritical) | |
| 163 | let failureStyle = record.status == .skipped ? AnyShapeStyle(.secondary) : AnyShapeStyle(ThemeToken.critical) | |
| 164 | 164 | Text(failureReason) |
| 165 | 165 | .font(.caption) |
| 166 | .foregroundStyle(failureColor) | |
| 166 | .foregroundStyle(failureStyle) | |
| 167 | 167 | } |
| 168 | 168 | } |
| 169 | 169 | } |
| @@ -171,7 +171,7 @@ private struct IntegrationDetailView: View { | ||
| 171 | 171 | } |
| 172 | 172 | } else { |
| 173 | 173 | Text("Integration not found.") |
| 174 | .foregroundStyle(Color(.appTextSecondary)) | |
| 174 | .foregroundStyle(ThemeToken.textSecondary) | |
| 175 | 175 | } |
| 176 | 176 | } |
| 177 | 177 | .navigationTitle(target?.name ?? "Integration") |
| @@ -238,7 +238,7 @@ private struct IntegrationEditorView: View { | ||
| 238 | 238 | if !FeatureAccessService.hasAccess(to: .bucketExport) { |
| 239 | 239 | Text("Export to your own bucket is \(FeatureAccessService.upgradeMessage(for: .bucketExport)).") |
| 240 | 240 | .font(.caption) |
| 241 | .foregroundStyle(Color(.appTextSecondary)) | |
| 241 | .foregroundStyle(ThemeToken.textSecondary) | |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | TextField("Name", text: $name) |
| @@ -284,7 +284,7 @@ private struct IntegrationEditorView: View { | ||
| 284 | 284 | if existingTarget != nil { |
| 285 | 285 | Text("Saved webhook URL remains in Keychain unless you replace it.") |
| 286 | 286 | .font(.caption) |
| 287 | .foregroundStyle(Color(.appTextSecondary)) | |
| 287 | .foregroundStyle(ThemeToken.textSecondary) | |
| 288 | 288 | } |
| 289 | 289 | } |
| 290 | 290 | case .slack: |
| @@ -297,7 +297,7 @@ private struct IntegrationEditorView: View { | ||
| 297 | 297 | if existingTarget != nil { |
| 298 | 298 | Text("Saved Slack webhook remains in Keychain unless you replace it.") |
| 299 | 299 | .font(.caption) |
| 300 | .foregroundStyle(Color(.appTextSecondary)) | |
| 300 | .foregroundStyle(ThemeToken.textSecondary) | |
| 301 | 301 | } |
| 302 | 302 | } |
| 303 | 303 | case .email: |
| @@ -311,7 +311,7 @@ private struct IntegrationEditorView: View { | ||
| 311 | 311 | |
| 312 | 312 | Text("Port 465 with Direct TLS is supported. Port 587 (STARTTLS) is not.") |
| 313 | 313 | .font(.caption) |
| 314 | .foregroundStyle(Color(.appTextSecondary)) | |
| 314 | .foregroundStyle(ThemeToken.textSecondary) | |
| 315 | 315 | |
| 316 | 316 | TextField("Username", text: $emailUsername) |
| 317 | 317 | .textInputAutocapitalization(.never) |
| @@ -338,7 +338,7 @@ private struct IntegrationEditorView: View { | ||
| 338 | 338 | if existingTarget != nil { |
| 339 | 339 | Text("Saved SMTP password remains in Keychain unless you replace it.") |
| 340 | 340 | .font(.caption) |
| 341 | .foregroundStyle(Color(.appTextSecondary)) | |
| 341 | .foregroundStyle(ThemeToken.textSecondary) | |
| 342 | 342 | } |
| 343 | 343 | } |
| 344 | 344 | case .s3: |
| @@ -350,7 +350,7 @@ private struct IntegrationEditorView: View { | ||
| 350 | 350 | |
| 351 | 351 | Text("Must be https. Signing puts your access key ID on the wire, and the signature with it.") |
| 352 | 352 | .font(.caption) |
| 353 | .foregroundStyle(Color(.appTextSecondary)) | |
| 353 | .foregroundStyle(ThemeToken.textSecondary) | |
| 354 | 354 | |
| 355 | 355 | TextField("Bucket", text: $s3Bucket) |
| 356 | 356 | .textInputAutocapitalization(.never) |
| @@ -368,7 +368,7 @@ private struct IntegrationEditorView: View { | ||
| 368 | 368 | |
| 369 | 369 | Text("Addresses the bucket as endpoint/bucket/key. MinIO needs this, and so do R2 custom domains.") |
| 370 | 370 | .font(.caption) |
| 371 | .foregroundStyle(Color(.appTextSecondary)) | |
| 371 | .foregroundStyle(ThemeToken.textSecondary) | |
| 372 | 372 | } |
| 373 | 373 | |
| 374 | 374 | Section("Credentials") { |
| @@ -384,7 +384,7 @@ private struct IntegrationEditorView: View { | ||
| 384 | 384 | if existingTarget != nil { |
| 385 | 385 | Text("Saved secret access key remains in Keychain unless you replace it.") |
| 386 | 386 | .font(.caption) |
| 387 | .foregroundStyle(Color(.appTextSecondary)) | |
| 387 | .foregroundStyle(ThemeToken.textSecondary) | |
| 388 | 388 | } |
| 389 | 389 | } |
| 390 | 390 | |
| @@ -407,7 +407,7 @@ private struct IntegrationEditorView: View { | ||
| 407 | 407 | if let detail = trigger.detail { |
| 408 | 408 | Text(detail) |
| 409 | 409 | .font(.caption) |
| 410 | .foregroundStyle(Color(.appTextSecondary)) | |
| 410 | .foregroundStyle(ThemeToken.textSecondary) | |
| 411 | 411 | } |
| 412 | 412 | } |
| 413 | 413 | } |
| @@ -417,7 +417,7 @@ private struct IntegrationEditorView: View { | ||
| 417 | 417 | Section("Formats") { |
| 418 | 418 | Text("JSON always uploads. The others are renderings of it.") |
| 419 | 419 | .font(.caption) |
| 420 | .foregroundStyle(Color(.appTextSecondary)) | |
| 420 | .foregroundStyle(ThemeToken.textSecondary) | |
| 421 | 421 | |
| 422 | 422 | ForEach([DomainExportFormat.pdf, .csv]) { format in |
| 423 | 423 | Toggle( |
| @@ -441,7 +441,7 @@ private struct IntegrationEditorView: View { | ||
| 441 | 441 | Section { |
| 442 | 442 | Text(validationMessage) |
| 443 | 443 | .font(.caption) |
| 444 | .foregroundStyle(Color(.statusCritical)) | |
| 444 | .foregroundStyle(ThemeToken.critical) | |
| 445 | 445 | } |
| 446 | 446 | } |
| 447 | 447 | } |
DomainDig/IntelligenceSectionView.swift +5 −5
| @@ -44,7 +44,7 @@ struct IntelligenceSectionView: View { | ||
| 44 | 44 | .font(appDensity.font(.caption, weight: .semibold)) |
| 45 | 45 | Text(signal.detail) |
| 46 | 46 | .font(appDensity.font(.caption2)) |
| 47 | .foregroundStyle(Color(.appTextSecondary)) | |
| 47 | .foregroundStyle(ThemeToken.textSecondary) | |
| 48 | 48 | } |
| 49 | 49 | } |
| 50 | 50 | } |
| @@ -80,12 +80,12 @@ struct IntelligenceSectionView: View { | ||
| 80 | 80 | if item.isEphemeral { |
| 81 | 81 | Text("Ephemeral") |
| 82 | 82 | .font(appDensity.font(.caption2)) |
| 83 | .foregroundStyle(Color(.statusWarning)) | |
| 83 | .foregroundStyle(ThemeToken.warning) | |
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | Text("First \(item.firstSeen.formatted(date: .abbreviated, time: .omitted)) • Last \(item.lastSeen.formatted(date: .abbreviated, time: .omitted)) • Seen \(item.recurrenceCount)x") |
| 87 | 87 | .font(appDensity.font(.caption2)) |
| 88 | .foregroundStyle(Color(.appTextSecondary)) | |
| 88 | .foregroundStyle(ThemeToken.textSecondary) | |
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | } |
| @@ -109,7 +109,7 @@ struct IntelligenceSectionView: View { | ||
| 109 | 109 | VStack(alignment: .leading, spacing: 8) { |
| 110 | 110 | Text(title) |
| 111 | 111 | .font(appDensity.font(.subheadline, weight: .semibold)) |
| 112 | .foregroundStyle(Color(.statusInfo)) | |
| 112 | .foregroundStyle(ThemeToken.info) | |
| 113 | 113 | content() |
| 114 | 114 | } |
| 115 | 115 | } |
| @@ -118,7 +118,7 @@ struct IntelligenceSectionView: View { | ||
| 118 | 118 | VStack(alignment: .leading, spacing: 3) { |
| 119 | 119 | Text(date.formatted(date: .abbreviated, time: .omitted)) |
| 120 | 120 | .font(appDensity.font(.caption2)) |
| 121 | .foregroundStyle(Color(.appTextSecondary)) | |
| 121 | .foregroundStyle(ThemeToken.textSecondary) | |
| 122 | 122 | Text(title) |
| 123 | 123 | .font(appDensity.font(.caption)) |
| 124 | 124 | } |
DomainDig/LookupSummaryViews.swift +21 −21
| @@ -15,7 +15,7 @@ struct SummaryView: View { | ||
| 15 | 15 | VStack(alignment: .leading, spacing: appDensity.metrics.rowSpacing) { |
| 16 | 16 | Text(field.label) |
| 17 | 17 | .font(appDensity.font(.caption2)) |
| 18 | .foregroundStyle(Color(.appTextSecondary)) | |
| 18 | .foregroundStyle(ThemeToken.textSecondary) | |
| 19 | 19 | Text(field.value) |
| 20 | 20 | .font(appDensity.font(.caption)) |
| 21 | 21 | .foregroundStyle(ResultColors.color(for: field.tone)) |
| @@ -25,7 +25,7 @@ struct SummaryView: View { | ||
| 25 | 25 | .frame(minHeight: appDensity.metrics.rowMinHeight + 12, alignment: .topLeading) |
| 26 | 26 | .frame(maxWidth: .infinity, alignment: .leading) |
| 27 | 27 | .padding(appDensity.metrics.cardPadding) |
| 28 | .background(Color(.appSurface)) | |
| 28 | .background(ThemeToken.surface) | |
| 29 | 29 | .clipShape(RoundedRectangle(cornerRadius: appDensity.metrics.cardCornerRadius)) |
| 30 | 30 | } |
| 31 | 31 | } |
| @@ -57,13 +57,13 @@ struct RiskSummaryCardView: View { | ||
| 57 | 57 | Spacer() |
| 58 | 58 | Text("Deterministic") |
| 59 | 59 | .font(appDensity.font(.caption2)) |
| 60 | .foregroundStyle(Color(.appTextSecondary)) | |
| 60 | .foregroundStyle(ThemeToken.textSecondary) | |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | if topFactors.isEmpty { |
| 64 | 64 | Text("No major risk factors identified") |
| 65 | 65 | .font(appDensity.font(.caption)) |
| 66 | .foregroundStyle(Color(.appTextSecondary)) | |
| 66 | .foregroundStyle(ThemeToken.textSecondary) | |
| 67 | 67 | } else { |
| 68 | 68 | ForEach(Array(topFactors.enumerated()), id: \.offset) { _, factor in |
| 69 | 69 | HStack(alignment: .top, spacing: 8) { |
| @@ -81,25 +81,25 @@ struct RiskSummaryCardView: View { | ||
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | private var levelColor: Color { | |
| 84 | private var levelColor: AnyShapeStyle { | |
| 85 | 85 | switch report.riskAssessment.level { |
| 86 | 86 | case .low: |
| 87 | return Color(.statusPositive) | |
| 87 | return AnyShapeStyle(ThemeToken.positive) | |
| 88 | 88 | case .medium: |
| 89 | return Color(.statusWarning) | |
| 89 | return AnyShapeStyle(ThemeToken.warning) | |
| 90 | 90 | case .high: |
| 91 | return Color(.statusCritical) | |
| 91 | return AnyShapeStyle(ThemeToken.critical) | |
| 92 | 92 | } |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | private func factorColor(_ impact: RiskImpact) -> Color { | |
| 95 | private func factorColor(_ impact: RiskImpact) -> AnyShapeStyle { | |
| 96 | 96 | switch impact { |
| 97 | 97 | case .positive: |
| 98 | return Color(.statusPositive) | |
| 98 | return AnyShapeStyle(ThemeToken.positive) | |
| 99 | 99 | case .neutral: |
| 100 | return .secondary | |
| 100 | return AnyShapeStyle(.secondary) | |
| 101 | 101 | case .negative: |
| 102 | return Color(.statusCritical) | |
| 102 | return AnyShapeStyle(ThemeToken.critical) | |
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | } |
| @@ -115,13 +115,13 @@ struct InsightsSummaryCardView: View { | ||
| 115 | 115 | if insights.isEmpty { |
| 116 | 116 | Text("No deterministic insights triggered") |
| 117 | 117 | .font(appDensity.font(.caption)) |
| 118 | .foregroundStyle(Color(.appTextSecondary)) | |
| 118 | .foregroundStyle(ThemeToken.textSecondary) | |
| 119 | 119 | } else { |
| 120 | 120 | ForEach(Array(insights.enumerated()), id: \.offset) { _, insight in |
| 121 | 121 | HStack(alignment: .top, spacing: 8) { |
| 122 | 122 | Image(systemName: "chart.line.uptrend.xyaxis") |
| 123 | 123 | .font(appDensity.font(.caption2)) |
| 124 | .foregroundStyle(Color(.statusInfo)) | |
| 124 | .foregroundStyle(ThemeToken.info) | |
| 125 | 125 | .padding(.top, 2) |
| 126 | 126 | Text(insight) |
| 127 | 127 | .font(appDensity.font(.caption)) |
| @@ -171,7 +171,7 @@ struct StickyLookupSummaryView: View { | ||
| 171 | 171 | HStack(spacing: 8) { |
| 172 | 172 | Label(primaryIP, systemImage: "network") |
| 173 | 173 | .font(appDensity.font(.caption)) |
| 174 | .foregroundStyle(Color(.appTextSecondary)) | |
| 174 | .foregroundStyle(ThemeToken.textSecondary) | |
| 175 | 175 | Spacer(minLength: 6) |
| 176 | 176 | AppCopyButton(value: primaryIP, label: "Copy IP") |
| 177 | 177 | } |
| @@ -197,7 +197,7 @@ struct LookupProgressOverviewView: View { | ||
| 197 | 197 | .foregroundStyle(.primary) |
| 198 | 198 | Text(steps.isEmpty ? "Preparing requests" : steps.joined(separator: " • ")) |
| 199 | 199 | .font(appDensity.font(.caption2)) |
| 200 | .foregroundStyle(Color(.appTextSecondary)) | |
| 200 | .foregroundStyle(ThemeToken.textSecondary) | |
| 201 | 201 | } |
| 202 | 202 | Spacer() |
| 203 | 203 | } |
| @@ -225,16 +225,16 @@ struct LookupStatusBannerView: View { | ||
| 225 | 225 | .clipShape(RoundedRectangle(cornerRadius: appDensity.metrics.cardCornerRadius)) |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | private var color: Color { | |
| 228 | private var color: AnyShapeStyle { | |
| 229 | 229 | switch resultSource { |
| 230 | 230 | case .live: |
| 231 | return Color(.statusPositive) | |
| 231 | return AnyShapeStyle(ThemeToken.positive) | |
| 232 | 232 | case .cached: |
| 233 | return .secondary | |
| 233 | return AnyShapeStyle(.secondary) | |
| 234 | 234 | case .mixed: |
| 235 | return Color(.statusWarning) | |
| 235 | return AnyShapeStyle(ThemeToken.warning) | |
| 236 | 236 | case .snapshot: |
| 237 | return Color(.statusWarning) | |
| 237 | return AnyShapeStyle(ThemeToken.warning) | |
| 238 | 238 | } |
| 239 | 239 | } |
| 240 | 240 | |
DomainDig/MonitoringView.swift +19 −19
| @@ -31,7 +31,7 @@ struct MonitoringView: View { | ||
| 31 | 31 | !monitoringStatusMessage.isEmpty { |
| 32 | 32 | Text(monitoringStatusMessage) |
| 33 | 33 | .font(appDensity.font(.caption)) |
| 34 | .foregroundStyle(Color(.appTextSecondary)) | |
| 34 | .foregroundStyle(ThemeToken.textSecondary) | |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | Button(viewModel.monitoringRunInProgress ? "Monitoring…" : "Run Now") { |
| @@ -41,7 +41,7 @@ struct MonitoringView: View { | ||
| 41 | 41 | } |
| 42 | 42 | .padding(.vertical, 4) |
| 43 | 43 | } |
| 44 | .listRowBackground(Color(.appSurface)) | |
| 44 | .themedListRowBackground(.surface) | |
| 45 | 45 | |
| 46 | 46 | if viewModel.monitoringLogs.isEmpty { |
| 47 | 47 | Section { |
| @@ -53,7 +53,7 @@ struct MonitoringView: View { | ||
| 53 | 53 | showsCardBackground: false |
| 54 | 54 | ) |
| 55 | 55 | } |
| 56 | .listRowBackground(Color(.appSurface)) | |
| 56 | .themedListRowBackground(.surface) | |
| 57 | 57 | } else { |
| 58 | 58 | Section("Recent Runs") { |
| 59 | 59 | ForEach(viewModel.monitoringLogs) { log in |
| @@ -68,12 +68,12 @@ struct MonitoringView: View { | ||
| 68 | 68 | Spacer() |
| 69 | 69 | Text(log.timestamp.formatted(date: .abbreviated, time: .shortened)) |
| 70 | 70 | .font(appDensity.font(.caption2)) |
| 71 | .foregroundStyle(Color(.appTextSecondary)) | |
| 71 | .foregroundStyle(ThemeToken.textSecondary) | |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | Text(log.summary) |
| 75 | 75 | .font(appDensity.font(.caption)) |
| 76 | .foregroundStyle(Color(.appTextSecondary)) | |
| 76 | .foregroundStyle(ThemeToken.textSecondary) | |
| 77 | 77 | |
| 78 | 78 | HStack(spacing: 8) { |
| 79 | 79 | metricBadge(title: "\(log.domainsChecked) checked") |
| @@ -89,11 +89,11 @@ struct MonitoringView: View { | ||
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | .listRowBackground(Color(.appSurface)) | |
| 92 | .themedListRowBackground(.surface) | |
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | .scrollContentBackground(.hidden) |
| 96 | .background(Color(.appBackground)) | |
| 96 | .background(ThemeToken.background) | |
| 97 | 97 | .navigationTitle("Monitoring") |
| 98 | 98 | .onAppear { |
| 99 | 99 | viewModel.refreshMonitoringState() |
| @@ -132,7 +132,7 @@ struct MonitoringLogDetailView: View { | ||
| 132 | 132 | LabeledContent("Alerts", value: "\(log.alertsTriggered)") |
| 133 | 133 | LabeledContent("Timestamp", value: log.timestamp.formatted(date: .abbreviated, time: .shortened)) |
| 134 | 134 | } |
| 135 | .listRowBackground(Color(.appSurface)) | |
| 135 | .themedListRowBackground(.surface) | |
| 136 | 136 | |
| 137 | 137 | Section("Domains") { |
| 138 | 138 | ForEach(log.checkedDomains) { result in |
| @@ -151,7 +151,7 @@ struct MonitoringLogDetailView: View { | ||
| 151 | 151 | |
| 152 | 152 | Text(result.summaryMessage) |
| 153 | 153 | .font(appDensity.font(.caption)) |
| 154 | .foregroundStyle(Color(.appTextSecondary)) | |
| 154 | .foregroundStyle(ThemeToken.textSecondary) | |
| 155 | 155 | |
| 156 | 156 | HStack(spacing: 10) { |
| 157 | 157 | Text(result.resultSource.label) |
| @@ -161,12 +161,12 @@ struct MonitoringLogDetailView: View { | ||
| 161 | 161 | } |
| 162 | 162 | } |
| 163 | 163 | .font(appDensity.font(.caption2)) |
| 164 | .foregroundStyle(Color(.appTextSecondary)) | |
| 164 | .foregroundStyle(ThemeToken.textSecondary) | |
| 165 | 165 | |
| 166 | 166 | if let errorMessage = result.errorMessage { |
| 167 | 167 | Text(errorMessage) |
| 168 | 168 | .font(appDensity.font(.caption2)) |
| 169 | .foregroundStyle(Color(.statusWarning)) | |
| 169 | .foregroundStyle(ThemeToken.warning) | |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | if let historyEntryID = result.historyEntryID, |
| @@ -180,32 +180,32 @@ struct MonitoringLogDetailView: View { | ||
| 180 | 180 | .padding(.vertical, 4) |
| 181 | 181 | } |
| 182 | 182 | } |
| 183 | .listRowBackground(Color(.appSurface)) | |
| 183 | .themedListRowBackground(.surface) | |
| 184 | 184 | |
| 185 | 185 | if !log.errors.isEmpty { |
| 186 | 186 | Section("Errors") { |
| 187 | 187 | ForEach(log.errors, id: \.self) { error in |
| 188 | 188 | Text(error) |
| 189 | 189 | .font(appDensity.font(.caption)) |
| 190 | .foregroundStyle(Color(.appTextSecondary)) | |
| 190 | .foregroundStyle(ThemeToken.textSecondary) | |
| 191 | 191 | } |
| 192 | 192 | } |
| 193 | .listRowBackground(Color(.appSurface)) | |
| 193 | .themedListRowBackground(.surface) | |
| 194 | 194 | } |
| 195 | 195 | } |
| 196 | 196 | .scrollContentBackground(.hidden) |
| 197 | .background(Color(.appBackground)) | |
| 197 | .background(ThemeToken.background) | |
| 198 | 198 | .navigationTitle("Run Details") |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | private func color(for severity: MonitoringAlertSeverity) -> Color { | |
| 201 | private func color(for severity: MonitoringAlertSeverity) -> AnyShapeStyle { | |
| 202 | 202 | switch severity { |
| 203 | 203 | case .info: |
| 204 | return .secondary | |
| 204 | return AnyShapeStyle(.secondary) | |
| 205 | 205 | case .warning: |
| 206 | return Color(.statusWarning) | |
| 206 | return AnyShapeStyle(ThemeToken.warning) | |
| 207 | 207 | case .critical: |
| 208 | return Color(.statusCritical) | |
| 208 | return AnyShapeStyle(ThemeToken.critical) | |
| 209 | 209 | } |
| 210 | 210 | } |
| 211 | 211 | } |
DomainDig/NetworkSectionView.swift +18 −18
| @@ -68,7 +68,7 @@ struct NetworkSectionView: View { | ||
| 68 | 68 | CardView { |
| 69 | 69 | Text("Reachability") |
| 70 | 70 | .font(appDensity.font(.subheadline, weight: .semibold)) |
| 71 | .foregroundStyle(Color(.statusInfo)) | |
| 71 | .foregroundStyle(ThemeToken.info) | |
| 72 | 72 | SectionTrustMetadataView(provenance: reachabilityProvenance, confidence: nil) |
| 73 | 73 | if reachabilityLoading { |
| 74 | 74 | ProgressView("Checking ports…") |
| @@ -83,7 +83,7 @@ struct NetworkSectionView: View { | ||
| 83 | 83 | Spacer() |
| 84 | 84 | Text(row.latencyLabel) |
| 85 | 85 | .font(appDensity.font(.caption2)) |
| 86 | .foregroundStyle(Color(.appTextSecondary)) | |
| 86 | .foregroundStyle(ThemeToken.textSecondary) | |
| 87 | 87 | AppStatusBadgeView(model: reachabilityBadge(row)) |
| 88 | 88 | } |
| 89 | 89 | } |
| @@ -93,7 +93,7 @@ struct NetworkSectionView: View { | ||
| 93 | 93 | CardView(allowsHorizontalScroll: false) { |
| 94 | 94 | Text("Location") |
| 95 | 95 | .font(appDensity.font(.subheadline, weight: .semibold)) |
| 96 | .foregroundStyle(Color(.statusInfo)) | |
| 96 | .foregroundStyle(ThemeToken.info) | |
| 97 | 97 | SectionTrustMetadataView(provenance: geolocationProvenance, confidence: geolocationConfidence) |
| 98 | 98 | if geolocationLoading { |
| 99 | 99 | ProgressView("Looking up location…") |
| @@ -125,13 +125,13 @@ struct NetworkSectionView: View { | ||
| 125 | 125 | CardView(allowsHorizontalScroll: false) { |
| 126 | 126 | Text("Port Scan") |
| 127 | 127 | .font(appDensity.font(.subheadline, weight: .semibold)) |
| 128 | .foregroundStyle(Color(.statusInfo)) | |
| 128 | .foregroundStyle(ThemeToken.info) | |
| 129 | 129 | SectionTrustMetadataView(provenance: portScanProvenance, confidence: nil) |
| 130 | 130 | |
| 131 | 131 | if isCloudflareProxied { |
| 132 | 132 | Text("Domain is behind Cloudflare's proxy. Results reflect the edge, not the origin.") |
| 133 | 133 | .font(appDensity.font(.caption2)) |
| 134 | .foregroundStyle(Color(.statusWarning)) | |
| 134 | .foregroundStyle(ThemeToken.warning) | |
| 135 | 135 | .fixedSize(horizontal: false, vertical: true) |
| 136 | 136 | } |
| 137 | 137 | |
| @@ -143,7 +143,7 @@ struct NetworkSectionView: View { | ||
| 143 | 143 | } else { |
| 144 | 144 | Text("Standard Ports") |
| 145 | 145 | .font(.system(.caption, design: .monospaced)) |
| 146 | .foregroundStyle(Color(.appTextSecondary)) | |
| 146 | .foregroundStyle(ThemeToken.textSecondary) | |
| 147 | 147 | PortRowsView(rows: standardPortRows) |
| 148 | 148 | } |
| 149 | 149 | |
| @@ -155,7 +155,7 @@ struct NetworkSectionView: View { | ||
| 155 | 155 | .autocorrectionDisabled() |
| 156 | 156 | .keyboardType(.numberPad) |
| 157 | 157 | .padding(10) |
| 158 | .background(Color(.appSurface)) | |
| 158 | .background(ThemeToken.surface) | |
| 159 | 159 | .clipShape(RoundedRectangle(cornerRadius: appDensity.metrics.cardCornerRadius)) |
| 160 | 160 | |
| 161 | 161 | Button("Scan") { |
| @@ -163,7 +163,7 @@ struct NetworkSectionView: View { | ||
| 163 | 163 | onScanCustomPorts() |
| 164 | 164 | } |
| 165 | 165 | .buttonStyle(.borderedProminent) |
| 166 | .tint(Color(.accentFill)) | |
| 166 | .tint(ThemeToken.accent) | |
| 167 | 167 | .disabled(customPortScanLoading) |
| 168 | 168 | |
| 169 | 169 | if customPortScanLoading { |
| @@ -186,13 +186,13 @@ struct NetworkSectionView: View { | ||
| 186 | 186 | private func reachabilityBadge(_ row: ReachabilityRowViewData) -> AppStatusBadgeModel { |
| 187 | 187 | switch row.statusTone { |
| 188 | 188 | case .success: |
| 189 | return .init(title: row.statusLabel, systemImage: "checkmark.circle.fill", foregroundColor: Color(.statusPositive), backgroundColor: Color(.statusPositiveSurface)) | |
| 189 | return .init(title: row.statusLabel, systemImage: "checkmark.circle.fill", foreground: .positive, background: .positiveSurface) | |
| 190 | 190 | case .warning: |
| 191 | return .init(title: row.statusLabel, systemImage: "exclamationmark.triangle.fill", foregroundColor: Color(.statusWarning), backgroundColor: Color(.statusWarningSurface)) | |
| 191 | return .init(title: row.statusLabel, systemImage: "exclamationmark.triangle.fill", foreground: .warning, background: .warningSurface) | |
| 192 | 192 | case .failure: |
| 193 | return .init(title: row.statusLabel, systemImage: "xmark.circle.fill", foregroundColor: Color(.statusCritical), backgroundColor: Color(.statusCriticalSurface)) | |
| 193 | return .init(title: row.statusLabel, systemImage: "xmark.circle.fill", foreground: .critical, background: .criticalSurface) | |
| 194 | 194 | case .primary, .secondary: |
| 195 | return .init(title: row.statusLabel, systemImage: "circle", foregroundColor: Color(.appTextSecondary), backgroundColor: Color(.appSurfaceElevated)) | |
| 195 | return .init(title: row.statusLabel, systemImage: "circle", foreground: .textSecondary, background: .surfaceElevated) | |
| 196 | 196 | } |
| 197 | 197 | } |
| 198 | 198 | } |
| @@ -218,14 +218,14 @@ struct PortRowsView: View { | ||
| 218 | 218 | if let durationLabel = row.durationLabel { |
| 219 | 219 | Text(durationLabel) |
| 220 | 220 | .font(appDensity.font(.caption2)) |
| 221 | .foregroundStyle(Color(.appTextSecondary)) | |
| 221 | .foregroundStyle(ThemeToken.textSecondary) | |
| 222 | 222 | } |
| 223 | 223 | AppStatusBadgeView(model: portBadge(row)) |
| 224 | 224 | } |
| 225 | 225 | if let banner = row.banner { |
| 226 | 226 | Text(banner) |
| 227 | 227 | .font(appDensity.font(.caption2)) |
| 228 | .foregroundStyle(Color(.appTextSecondary)) | |
| 228 | .foregroundStyle(ThemeToken.textSecondary) | |
| 229 | 229 | .padding(.leading, 8) |
| 230 | 230 | } |
| 231 | 231 | } |
| @@ -237,13 +237,13 @@ struct PortRowsView: View { | ||
| 237 | 237 | private func portBadge(_ row: PortScanRowViewData) -> AppStatusBadgeModel { |
| 238 | 238 | switch row.statusTone { |
| 239 | 239 | case .success: |
| 240 | return .init(title: row.statusLabel, systemImage: "checkmark.circle.fill", foregroundColor: Color(.statusPositive), backgroundColor: Color(.statusPositiveSurface)) | |
| 240 | return .init(title: row.statusLabel, systemImage: "checkmark.circle.fill", foreground: .positive, background: .positiveSurface) | |
| 241 | 241 | case .warning: |
| 242 | return .init(title: row.statusLabel, systemImage: "exclamationmark.triangle.fill", foregroundColor: Color(.statusWarning), backgroundColor: Color(.statusWarningSurface)) | |
| 242 | return .init(title: row.statusLabel, systemImage: "exclamationmark.triangle.fill", foreground: .warning, background: .warningSurface) | |
| 243 | 243 | case .failure: |
| 244 | return .init(title: row.statusLabel, systemImage: "xmark.circle.fill", foregroundColor: Color(.statusCritical), backgroundColor: Color(.statusCriticalSurface)) | |
| 244 | return .init(title: row.statusLabel, systemImage: "xmark.circle.fill", foreground: .critical, background: .criticalSurface) | |
| 245 | 245 | case .primary, .secondary: |
| 246 | return .init(title: row.statusLabel, systemImage: "circle", foregroundColor: Color(.appTextSecondary), backgroundColor: Color(.appSurfaceElevated)) | |
| 246 | return .init(title: row.statusLabel, systemImage: "circle", foreground: .textSecondary, background: .surfaceElevated) | |
| 247 | 247 | } |
| 248 | 248 | } |
| 249 | 249 | } |
DomainDig/OwnershipSectionView.swift +3 −3
| @@ -69,7 +69,7 @@ struct OwnershipSectionView: View { | ||
| 69 | 69 | HStack { |
| 70 | 70 | Text("History") |
| 71 | 71 | .font(appDensity.font(.caption)) |
| 72 | .foregroundStyle(Color(.appTextSecondary)) | |
| 72 | .foregroundStyle(ThemeToken.textSecondary) | |
| 73 | 73 | Spacer() |
| 74 | 74 | if let onLoadHistory, history.isEmpty, !historyLoading { |
| 75 | 75 | Button("Load") { |
| @@ -87,12 +87,12 @@ struct OwnershipSectionView: View { | ||
| 87 | 87 | VStack(alignment: .leading, spacing: 3) { |
| 88 | 88 | Text(event.date.formatted(date: .abbreviated, time: .omitted)) |
| 89 | 89 | .font(appDensity.font(.caption2)) |
| 90 | .foregroundStyle(Color(.appTextSecondary)) | |
| 90 | .foregroundStyle(ThemeToken.textSecondary) | |
| 91 | 91 | Text(event.summary) |
| 92 | 92 | .font(appDensity.font(.caption)) |
| 93 | 93 | Text(event.source) |
| 94 | 94 | .font(appDensity.font(.caption2)) |
| 95 | .foregroundStyle(Color(.appTextSecondary)) | |
| 95 | .foregroundStyle(ThemeToken.textSecondary) | |
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | } else if let historyError { |
DomainDig/PaywallView.swift +5 −5
| @@ -12,7 +12,7 @@ struct PaywallView: View { | ||
| 12 | 12 | Section { |
| 13 | 13 | Text("Pro unlocks scale, background monitoring, alerts, exports, and extended subdomain discovery. Pro+ adds shared portfolios, unlimited audits, and the full intelligence breakdown.") |
| 14 | 14 | .font(appDensity.font(.body, design: .default)) |
| 15 | .foregroundStyle(Color(.appTextSecondary)) | |
| 15 | .foregroundStyle(ThemeToken.textSecondary) | |
| 16 | 16 | .fixedSize(horizontal: false, vertical: true) |
| 17 | 17 | } |
| 18 | 18 | |
| @@ -38,7 +38,7 @@ struct PaywallView: View { | ||
| 38 | 38 | } else if purchaseService.products.isEmpty { |
| 39 | 39 | Text("Pricing is unavailable right now.") |
| 40 | 40 | .font(appDensity.font(.caption, design: .default)) |
| 41 | .foregroundStyle(Color(.appTextSecondary)) | |
| 41 | .foregroundStyle(ThemeToken.textSecondary) | |
| 42 | 42 | |
| 43 | 43 | Button("Retry") { |
| 44 | 44 | Task { |
| @@ -58,7 +58,7 @@ struct PaywallView: View { | ||
| 58 | 58 | .foregroundStyle(.primary) |
| 59 | 59 | Text(product.displayPrice) |
| 60 | 60 | .font(appDensity.font(.callout, design: .default)) |
| 61 | .foregroundStyle(Color(.appTextSecondary)) | |
| 61 | .foregroundStyle(ThemeToken.textSecondary) | |
| 62 | 62 | } |
| 63 | 63 | .frame(maxWidth: .infinity, alignment: .leading) |
| 64 | 64 | } |
| @@ -69,13 +69,13 @@ struct PaywallView: View { | ||
| 69 | 69 | if let statusMessage = purchaseService.statusMessage { |
| 70 | 70 | Text(statusMessage) |
| 71 | 71 | .font(appDensity.font(.caption, design: .default)) |
| 72 | .foregroundStyle(Color(.appTextSecondary)) | |
| 72 | .foregroundStyle(ThemeToken.textSecondary) | |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | if let errorMessage = purchaseService.errorMessage { |
| 76 | 76 | Text(errorMessage) |
| 77 | 77 | .font(appDensity.font(.caption, design: .default)) |
| 78 | .foregroundStyle(Color(.statusCritical)) | |
| 78 | .foregroundStyle(ThemeToken.critical) | |
| 79 | 79 | } |
| 80 | 80 | } |
| 81 | 81 | |
DomainDig/ResultPrimitives.swift +14 −14
| @@ -19,7 +19,7 @@ struct TrackedDomainDetailHeaderView: View { | ||
| 19 | 19 | Text("Last refresh \(trackedDomain.updatedAt.formatted(date: .abbreviated, time: .shortened))") |
| 20 | 20 | } |
| 21 | 21 | .font(.system(.caption2, design: .monospaced)) |
| 22 | .foregroundStyle(Color(.appTextSecondary)) | |
| 22 | .foregroundStyle(ThemeToken.textSecondary) | |
| 23 | 23 | } |
| 24 | 24 | } |
| 25 | 25 | } |
| @@ -93,7 +93,7 @@ struct CardView<Content: View>: View { | ||
| 93 | 93 | } |
| 94 | 94 | .frame(maxWidth: .infinity, alignment: .leading) |
| 95 | 95 | .padding(providesSurface ? appDensity.metrics.cardPadding : 0) |
| 96 | .background(providesSurface ? Color(.appSurface) : Color.clear) | |
| 96 | .background(providesSurface ? AnyShapeStyle(ThemeToken.surface) : AnyShapeStyle(.clear)) | |
| 97 | 97 | .clipShape( |
| 98 | 98 | RoundedRectangle(cornerRadius: providesSurface ? appDensity.metrics.cardCornerRadius : 0) |
| 99 | 99 | ) |
| @@ -139,7 +139,7 @@ struct MessageRowView: View { | ||
| 139 | 139 | var body: some View { |
| 140 | 140 | Label(text, systemImage: isError ? "exclamationmark.triangle.fill" : "info.circle") |
| 141 | 141 | .font(appDensity.font(.caption)) |
| 142 | .foregroundStyle(isError ? Color(.statusCritical) : .secondary) | |
| 142 | .foregroundStyle(isError ? AnyShapeStyle(ThemeToken.critical) : AnyShapeStyle(.secondary)) | |
| 143 | 143 | .lineLimit(nil) |
| 144 | 144 | .fixedSize(horizontal: false, vertical: true) |
| 145 | 145 | } |
| @@ -164,15 +164,15 @@ struct SectionTrustMetadataView: View { | ||
| 164 | 164 | if let confidence { |
| 165 | 165 | Text("Confidence \(confidence.title)") |
| 166 | 166 | .font(appDensity.font(.caption2)) |
| 167 | .foregroundStyle(Color(.appTextSecondary)) | |
| 167 | .foregroundStyle(ThemeToken.textSecondary) | |
| 168 | 168 | } |
| 169 | 169 | if let provenance { |
| 170 | 170 | Text(provenance.provider ?? provenance.source) |
| 171 | 171 | .font(appDensity.font(.caption2)) |
| 172 | .foregroundStyle(Color(.appTextSecondary)) | |
| 172 | .foregroundStyle(ThemeToken.textSecondary) | |
| 173 | 173 | Text(provenance.resultSource.label) |
| 174 | 174 | .font(appDensity.font(.caption2)) |
| 175 | .foregroundStyle(Color(.appTextSecondary)) | |
| 175 | .foregroundStyle(ThemeToken.textSecondary) | |
| 176 | 176 | } |
| 177 | 177 | } |
| 178 | 178 | DisclosureGroup("Details") { |
| @@ -212,7 +212,7 @@ struct LabeledValueRow: View { | ||
| 212 | 212 | VStack(alignment: .leading, spacing: appDensity.metrics.rowSpacing - 1) { |
| 213 | 213 | Text(row.label) |
| 214 | 214 | .font(appDensity.font(.caption2)) |
| 215 | .foregroundStyle(Color(.appTextSecondary)) | |
| 215 | .foregroundStyle(ThemeToken.textSecondary) | |
| 216 | 216 | HStack(alignment: .firstTextBaseline, spacing: 4) { |
| 217 | 217 | if differentiateWithoutColor, let symbol = toneSymbol { |
| 218 | 218 | Image(systemName: symbol) |
| @@ -274,21 +274,21 @@ struct LabeledValueRow: View { | ||
| 274 | 274 | /// Maps a row's semantic tone onto the app palette. |
| 275 | 275 | /// |
| 276 | 276 | /// See `Docs/ACCESSIBILITY.md` for the measured contrast ratios behind these |
| 277 | /// colours. Never reach for a literal (`Color(.statusCritical)`, `Color(.statusWarning)`, …) — the system | |
| 277 | /// colours. Never reach for a system literal (`Color.red`, `Color.yellow`, …) — the system | |
| 278 | 278 | /// palette fails WCAG AA badly in light mode (systemYellow is 1.28:1 on white). |
| 279 | 279 | enum ResultColors { |
| 280 | static func color(for tone: ResultTone) -> Color { | |
| 280 | static func color(for tone: ResultTone) -> AnyShapeStyle { | |
| 281 | 281 | switch tone { |
| 282 | 282 | case .primary: |
| 283 | return .primary | |
| 283 | return AnyShapeStyle(.primary) | |
| 284 | 284 | case .secondary: |
| 285 | return .secondary | |
| 285 | return AnyShapeStyle(.secondary) | |
| 286 | 286 | case .success: |
| 287 | return Color(.statusPositive) | |
| 287 | return AnyShapeStyle(ThemeToken.positive) | |
| 288 | 288 | case .warning: |
| 289 | return Color(.statusWarning) | |
| 289 | return AnyShapeStyle(ThemeToken.warning) | |
| 290 | 290 | case .failure: |
| 291 | return Color(.statusCritical) | |
| 291 | return AnyShapeStyle(ThemeToken.critical) | |
| 292 | 292 | } |
| 293 | 293 | } |
| 294 | 294 | } |
DomainDig/ScheduledReportsView.swift +7 −7
| @@ -13,7 +13,7 @@ struct ScheduledReportsView: View { | ||
| 13 | 13 | if !FeatureAccessService.hasAccess(to: .automatedMonitoring) { |
| 14 | 14 | Text("Scheduled reports require Pro.") |
| 15 | 15 | .font(appDensity.font(.caption)) |
| 16 | .foregroundStyle(Color(.appTextSecondary)) | |
| 16 | .foregroundStyle(ThemeToken.textSecondary) | |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | Toggle("Scheduled Reports", isOn: Binding( |
| @@ -59,7 +59,7 @@ struct ScheduledReportsView: View { | ||
| 59 | 59 | if let statusMessage { |
| 60 | 60 | Text(statusMessage) |
| 61 | 61 | .font(appDensity.font(.caption)) |
| 62 | .foregroundStyle(Color(.appTextSecondary)) | |
| 62 | .foregroundStyle(ThemeToken.textSecondary) | |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | Button(isGenerating ? "Generating…" : "Generate Now") { |
| @@ -67,7 +67,7 @@ struct ScheduledReportsView: View { | ||
| 67 | 67 | } |
| 68 | 68 | .disabled(isGenerating || !FeatureAccessService.hasAccess(to: .automatedMonitoring)) |
| 69 | 69 | } |
| 70 | .listRowBackground(Color(.appSurface)) | |
| 70 | .themedListRowBackground(.surface) | |
| 71 | 71 | |
| 72 | 72 | if logs.isEmpty { |
| 73 | 73 | Section { |
| @@ -79,7 +79,7 @@ struct ScheduledReportsView: View { | ||
| 79 | 79 | showsCardBackground: false |
| 80 | 80 | ) |
| 81 | 81 | } |
| 82 | .listRowBackground(Color(.appSurface)) | |
| 82 | .themedListRowBackground(.surface) | |
| 83 | 83 | } else { |
| 84 | 84 | Section("Recent Reports") { |
| 85 | 85 | ForEach(logs) { log in |
| @@ -91,16 +91,16 @@ struct ScheduledReportsView: View { | ||
| 91 | 91 | .foregroundStyle(.primary) |
| 92 | 92 | Text(log.generatedAt.formatted(date: .abbreviated, time: .shortened)) |
| 93 | 93 | .font(.caption) |
| 94 | .foregroundStyle(Color(.appTextSecondary)) | |
| 94 | .foregroundStyle(ThemeToken.textSecondary) | |
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | } |
| 99 | .listRowBackground(Color(.appSurface)) | |
| 99 | .themedListRowBackground(.surface) | |
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | .scrollContentBackground(.hidden) |
| 103 | .background(Color(.appBackground)) | |
| 103 | .background(ThemeToken.background) | |
| 104 | 104 | .navigationTitle("Scheduled Reports") |
| 105 | 105 | } |
| 106 | 106 | |
DomainDig/SettingsViews.swift +41 −24
| @@ -38,13 +38,13 @@ struct SettingsView: View { | ||
| 38 | 38 | if let statusMessage = purchaseService.statusMessage { |
| 39 | 39 | Text(statusMessage) |
| 40 | 40 | .font(appDensity.font(.caption, design: .default)) |
| 41 | .foregroundStyle(Color(.appTextSecondary)) | |
| 41 | .foregroundStyle(ThemeToken.textSecondary) | |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | if let errorMessage = purchaseService.errorMessage { |
| 45 | 45 | Text(errorMessage) |
| 46 | 46 | .font(appDensity.font(.caption, design: .default)) |
| 47 | .foregroundStyle(Color(.statusCritical)) | |
| 47 | .foregroundStyle(ThemeToken.critical) | |
| 48 | 48 | } |
| 49 | 49 | } |
| 50 | 50 | |
| @@ -105,8 +105,10 @@ struct SettingsView: View { | ||
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | private struct DisplaySettingsView: View { |
| 108 | @Environment(\.appDensity) private var appDensity | |
| 108 | 109 | @AppStorage(AppDensity.userDefaultsKey) private var storedDensity = AppDensity.compact.rawValue |
| 109 | 110 | @AppStorage(AppAppearance.userDefaultsKey) private var storedAppearance = AppAppearance.system.rawValue |
| 111 | @AppStorage(AccentTheme.userDefaultsKey) private var storedAccent = AccentTheme.default.rawValue | |
| 110 | 112 | |
| 111 | 113 | var body: some View { |
| 112 | 114 | Form { |
| @@ -117,6 +119,21 @@ private struct DisplaySettingsView: View { | ||
| 117 | 119 | } |
| 118 | 120 | } |
| 119 | 121 | |
| 122 | Picker("Accent", selection: $storedAccent) { | |
| 123 | ForEach(AccentTheme.allCases) { accent in | |
| 124 | Text(accent.title).tag(accent.rawValue) | |
| 125 | } | |
| 126 | } | |
| 127 | .disabled(!FeatureAccessService.hasAccess(to: .accentTheme)) | |
| 128 | ||
| 129 | Text( | |
| 130 | FeatureAccessService.hasAccess(to: .accentTheme) | |
| 131 | ? "Changes the accent only. Status colours keep their meaning." | |
| 132 | : "Accent themes are \(FeatureAccessService.upgradeMessage(for: .accentTheme))." | |
| 133 | ) | |
| 134 | .font(appDensity.font(.caption, design: .default)) | |
| 135 | .foregroundStyle(ThemeToken.textSecondary) | |
| 136 | ||
| 120 | 137 | Picker("Density", selection: $storedDensity) { |
| 121 | 138 | ForEach(AppDensity.allCases) { density in |
| 122 | 139 | Text(density.title).tag(density.rawValue) |
| @@ -172,7 +189,7 @@ private struct HistoryNetworkSettingsView: View { | ||
| 172 | 189 | |
| 173 | 190 | Text(viewModel.historyRetentionCaption) |
| 174 | 191 | .font(appDensity.font(.caption, design: .default)) |
| 175 | .foregroundStyle(Color(.appTextSecondary)) | |
| 192 | .foregroundStyle(ThemeToken.textSecondary) | |
| 176 | 193 | } |
| 177 | 194 | |
| 178 | 195 | Section("Network") { |
| @@ -191,7 +208,7 @@ private struct HistoryNetworkSettingsView: View { | ||
| 191 | 208 | if let customResolverError { |
| 192 | 209 | Text(customResolverError) |
| 193 | 210 | .font(appDensity.font(.caption, design: .default)) |
| 194 | .foregroundStyle(Color(.statusCritical)) | |
| 211 | .foregroundStyle(ThemeToken.critical) | |
| 195 | 212 | } |
| 196 | 213 | } |
| 197 | 214 | |
| @@ -203,13 +220,13 @@ private struct HistoryNetworkSettingsView: View { | ||
| 203 | 220 | |
| 204 | 221 | Text(selectedProfile.detail) |
| 205 | 222 | .font(appDensity.font(.caption, design: .default)) |
| 206 | .foregroundStyle(Color(.appTextSecondary)) | |
| 223 | .foregroundStyle(ThemeToken.textSecondary) | |
| 207 | 224 | |
| 208 | 225 | Toggle("Allow third-party enrichment", isOn: $allowsThirdPartyEnrichment) |
| 209 | 226 | |
| 210 | 227 | Text(Self.enrichmentCaption) |
| 211 | 228 | .font(appDensity.font(.caption, design: .default)) |
| 212 | .foregroundStyle(Color(.appTextSecondary)) | |
| 229 | .foregroundStyle(ThemeToken.textSecondary) | |
| 213 | 230 | } |
| 214 | 231 | } |
| 215 | 232 | .navigationTitle("History & Network") |
| @@ -280,16 +297,16 @@ private struct CloudSyncSettingsView: View { | ||
| 280 | 297 | |
| 281 | 298 | Text("iCloud Sync stores DomainDig data in your private iCloud account. DomainDig does not operate a sync server. Disabling sync keeps local data on this device.") |
| 282 | 299 | .font(appDensity.font(.caption, design: .default)) |
| 283 | .foregroundStyle(Color(.appTextSecondary)) | |
| 300 | .foregroundStyle(ThemeToken.textSecondary) | |
| 284 | 301 | |
| 285 | 302 | Text(cloudSyncService.detailMessage) |
| 286 | 303 | .font(appDensity.font(.caption, design: .default)) |
| 287 | .foregroundStyle(Color(.appTextSecondary)) | |
| 304 | .foregroundStyle(ThemeToken.textSecondary) | |
| 288 | 305 | |
| 289 | 306 | if let lastErrorMessage = cloudSyncService.lastErrorMessage { |
| 290 | 307 | Text(lastErrorMessage) |
| 291 | 308 | .font(appDensity.font(.caption, design: .default)) |
| 292 | .foregroundStyle(Color(.statusCritical)) | |
| 309 | .foregroundStyle(ThemeToken.critical) | |
| 293 | 310 | } |
| 294 | 311 | } |
| 295 | 312 | } |
| @@ -342,7 +359,7 @@ private struct LocalAPISettingsView: View { | ||
| 342 | 359 | if let statusMessage = localAPIService.statusMessage { |
| 343 | 360 | Text(statusMessage) |
| 344 | 361 | .font(appDensity.font(.caption, design: .default)) |
| 345 | .foregroundStyle(Color(.appTextSecondary)) | |
| 362 | .foregroundStyle(ThemeToken.textSecondary) | |
| 346 | 363 | } |
| 347 | 364 | } |
| 348 | 365 | |
| @@ -361,7 +378,7 @@ private struct LocalAPISettingsView: View { | ||
| 361 | 378 | |
| 362 | 379 | Text("Every request requires either `Authorization: Bearer <token>` or `X-API-Token`. DomainDig stores the token in Keychain and only binds the server to localhost.") |
| 363 | 380 | .font(appDensity.font(.caption, design: .default)) |
| 364 | .foregroundStyle(Color(.appTextSecondary)) | |
| 381 | .foregroundStyle(ThemeToken.textSecondary) | |
| 365 | 382 | } |
| 366 | 383 | |
| 367 | 384 | Section("Request Logging") { |
| @@ -376,7 +393,7 @@ private struct LocalAPISettingsView: View { | ||
| 376 | 393 | if localAPIService.requestLogs.isEmpty { |
| 377 | 394 | Text("No local API requests logged yet.") |
| 378 | 395 | .font(appDensity.font(.caption, design: .default)) |
| 379 | .foregroundStyle(Color(.appTextSecondary)) | |
| 396 | .foregroundStyle(ThemeToken.textSecondary) | |
| 380 | 397 | } else { |
| 381 | 398 | ForEach(localAPIService.requestLogs.prefix(25)) { log in |
| 382 | 399 | VStack(alignment: .leading, spacing: 4) { |
| @@ -386,16 +403,16 @@ private struct LocalAPISettingsView: View { | ||
| 386 | 403 | Spacer() |
| 387 | 404 | Text("\(log.statusCode)") |
| 388 | 405 | .font(appDensity.font(.caption, design: .default)) |
| 389 | .foregroundStyle(log.statusCode >= 400 ? Color(.statusCritical) : .secondary) | |
| 406 | .foregroundStyle(log.statusCode >= 400 ? AnyShapeStyle(ThemeToken.critical) : AnyShapeStyle(.secondary)) | |
| 390 | 407 | } |
| 391 | 408 | |
| 392 | 409 | Text(log.timestamp.formatted(date: .abbreviated, time: .standard)) |
| 393 | 410 | .font(appDensity.font(.caption2, design: .default)) |
| 394 | .foregroundStyle(Color(.appTextSecondary)) | |
| 411 | .foregroundStyle(ThemeToken.textSecondary) | |
| 395 | 412 | |
| 396 | 413 | Text("\(Int(log.duration * 1000)) ms") |
| 397 | 414 | .font(appDensity.font(.caption2, design: .default)) |
| 398 | .foregroundStyle(Color(.appTextSecondary)) | |
| 415 | .foregroundStyle(ThemeToken.textSecondary) | |
| 399 | 416 | } |
| 400 | 417 | } |
| 401 | 418 | } |
| @@ -571,13 +588,13 @@ private struct MonitoringSettingsView: View { | ||
| 571 | 588 | if let monitoringStatusMessage = viewModel.monitoringStatusMessage { |
| 572 | 589 | Text(monitoringStatusMessage) |
| 573 | 590 | .font(appDensity.font(.caption, design: .default)) |
| 574 | .foregroundStyle(Color(.appTextSecondary)) | |
| 591 | .foregroundStyle(ThemeToken.textSecondary) | |
| 575 | 592 | } |
| 576 | 593 | |
| 577 | 594 | if !FeatureAccessService.hasAccess(to: .automatedMonitoring) { |
| 578 | 595 | Text("Background monitoring and alerts are available in Pro.") |
| 579 | 596 | .font(appDensity.font(.caption, design: .default)) |
| 580 | .foregroundStyle(Color(.appTextSecondary)) | |
| 597 | .foregroundStyle(ThemeToken.textSecondary) | |
| 581 | 598 | } |
| 582 | 599 | } |
| 583 | 600 | } |
| @@ -655,7 +672,7 @@ private struct DataPortabilitySettingsView: View { | ||
| 655 | 672 | |
| 656 | 673 | Text(importMode.explanation) |
| 657 | 674 | .font(appDensity.font(.caption, design: .default)) |
| 658 | .foregroundStyle(Color(.appTextSecondary)) | |
| 675 | .foregroundStyle(ThemeToken.textSecondary) | |
| 659 | 676 | |
| 660 | 677 | Button("Export Full Backup") { |
| 661 | 678 | exportFullBackup() |
| @@ -712,12 +729,12 @@ private struct DataPortabilitySettingsView: View { | ||
| 712 | 729 | |
| 713 | 730 | Text("Data stays on this device unless you export it. Backup files can include domain history, monitoring settings, and notes. Imported files are processed on-device.") |
| 714 | 731 | .font(appDensity.font(.caption, design: .default)) |
| 715 | .foregroundStyle(Color(.appTextSecondary)) | |
| 732 | .foregroundStyle(ThemeToken.textSecondary) | |
| 716 | 733 | |
| 717 | 734 | if let portabilityStatusMessage = viewModel.portabilityStatusMessage { |
| 718 | 735 | Text(portabilityStatusMessage) |
| 719 | 736 | .font(appDensity.font(.caption, design: .default)) |
| 720 | .foregroundStyle(Color(.appTextSecondary)) | |
| 737 | .foregroundStyle(ThemeToken.textSecondary) | |
| 721 | 738 | } |
| 722 | 739 | } |
| 723 | 740 | |
| @@ -726,7 +743,7 @@ private struct DataPortabilitySettingsView: View { | ||
| 726 | 743 | Section("Import Debug") { |
| 727 | 744 | Text(importDebugStatus) |
| 728 | 745 | .font(appDensity.font(.caption, design: .default)) |
| 729 | .foregroundStyle(Color(.appTextSecondary)) | |
| 746 | .foregroundStyle(ThemeToken.textSecondary) | |
| 730 | 747 | .textSelection(.enabled) |
| 731 | 748 | } |
| 732 | 749 | } |
| @@ -1032,14 +1049,14 @@ private struct DataManagementSettingsView: View { | ||
| 1032 | 1049 | if let deleteAllSuccessMessage { |
| 1033 | 1050 | Text(deleteAllSuccessMessage) |
| 1034 | 1051 | .font(.footnote.weight(.medium)) |
| 1035 | .foregroundStyle(Color(.appTextSecondary)) | |
| 1052 | .foregroundStyle(ThemeToken.textSecondary) | |
| 1036 | 1053 | .padding(.horizontal, 14) |
| 1037 | 1054 | .padding(.vertical, 10) |
| 1038 | 1055 | // Reduce Transparency swaps the blur for an opaque surface. |
| 1039 | 1056 | // On iOS 26+ the system also composites its own translucency |
| 1040 | 1057 | // that the app cannot declare — verify there too (Phase 6). |
| 1041 | 1058 | .background( |
| 1042 | Capsule().fill(reduceTransparency ? AnyShapeStyle(Color(.appSurfaceElevated)) : AnyShapeStyle(.thinMaterial)) | |
| 1059 | Capsule().fill(reduceTransparency ? AnyShapeStyle(ThemeToken.surfaceElevated) : AnyShapeStyle(.thinMaterial)) | |
| 1043 | 1060 | ) |
| 1044 | 1061 | .padding(.bottom, 8) |
| 1045 | 1062 | .transition(.move(edge: .bottom).combined(with: .opacity)) |
| @@ -1101,7 +1118,7 @@ private struct DataImportPreviewSheet: View { | ||
| 1101 | 1118 | Section("Warnings") { |
| 1102 | 1119 | ForEach(preview.warnings, id: \.self) { warning in |
| 1103 | 1120 | Text(warning) |
| 1104 | .foregroundStyle(Color(.appTextSecondary)) | |
| 1121 | .foregroundStyle(ThemeToken.textSecondary) | |
| 1105 | 1122 | } |
| 1106 | 1123 | } |
| 1107 | 1124 | } |
DomainDig/SubdomainsSectionView.swift +5 −5
| @@ -100,16 +100,16 @@ struct SubdomainsSectionView: View { | ||
| 100 | 100 | if !groups.isEmpty { |
| 101 | 101 | Text("Groups") |
| 102 | 102 | .font(appDensity.font(.caption2)) |
| 103 | .foregroundStyle(Color(.appTextSecondary)) | |
| 103 | .foregroundStyle(ThemeToken.textSecondary) | |
| 104 | 104 | ForEach(groups) { group in |
| 105 | 105 | HStack { |
| 106 | 106 | Text("\(group.label).*") |
| 107 | 107 | .font(appDensity.font(.caption)) |
| 108 | .foregroundStyle(Color(.statusInfo)) | |
| 108 | .foregroundStyle(ThemeToken.info) | |
| 109 | 109 | Spacer() |
| 110 | 110 | Text("\(group.subdomains.count)") |
| 111 | 111 | .font(appDensity.font(.caption2)) |
| 112 | .foregroundStyle(Color(.appTextSecondary)) | |
| 112 | .foregroundStyle(ThemeToken.textSecondary) | |
| 113 | 113 | } |
| 114 | 114 | } |
| 115 | 115 | } |
| @@ -127,10 +127,10 @@ struct SubdomainsSectionView: View { | ||
| 127 | 127 | if row.isInteresting { |
| 128 | 128 | Text("Interesting") |
| 129 | 129 | .font(.system(.caption2, design: .monospaced)) |
| 130 | .foregroundStyle(Color(.statusWarning)) | |
| 130 | .foregroundStyle(ThemeToken.warning) | |
| 131 | 131 | .padding(.horizontal, 8) |
| 132 | 132 | .padding(.vertical, 4) |
| 133 | .background(Color(.statusWarningSurface)) | |
| 133 | .background(ThemeToken.warningSurface) | |
| 134 | 134 | .clipShape(Capsule()) |
| 135 | 135 | } |
| 136 | 136 | } |
DomainDig/Theme.swift added +167
| @@ -0,0 +1,167 @@ | ||
| 1 | import SwiftUI | |
| 2 | ||
| 3 | /// One of the app's semantic colours, named rather than resolved. | |
| 4 | /// | |
| 5 | /// A token instead of a `Color` so a colour chosen outside a view body — a | |
| 6 | /// status badge's model, for one — can say which colour it means and leave the | |
| 7 | /// resolving to the view that draws it. That is what lets the whole palette sit | |
| 8 | /// in the environment rather than only the parts used inside `body`. | |
| 9 | /// | |
| 10 | /// The case names drop the `app`/`status` prefixes that the colorsets carry so | |
| 11 | /// they do not collide with the style accessors below, which keep the prefixed | |
| 12 | /// spelling the call sites already used. The raw value is the colorset's name. | |
| 13 | nonisolated enum ThemeToken: String, CaseIterable, Sendable { | |
| 14 | case background = "AppBackground" | |
| 15 | case surface = "AppSurface" | |
| 16 | case surfaceElevated = "AppSurfaceElevated" | |
| 17 | case textSecondary = "AppTextSecondary" | |
| 18 | case separator = "AppSeparator" | |
| 19 | case onAccent = "AppOnAccent" | |
| 20 | case accent = "AccentFill" | |
| 21 | case positive = "StatusPositive" | |
| 22 | case positiveSurface = "StatusPositiveSurface" | |
| 23 | case warning = "StatusWarning" | |
| 24 | case warningSurface = "StatusWarningSurface" | |
| 25 | case critical = "StatusCritical" | |
| 26 | case criticalSurface = "StatusCriticalSurface" | |
| 27 | case info = "StatusInfo" | |
| 28 | case infoSurface = "StatusInfoSurface" | |
| 29 | case neutral = "StatusNeutral" | |
| 30 | case neutralSurface = "StatusNeutralSurface" | |
| 31 | ||
| 32 | /// The palette in `Shared/Colors.xcassets`, which stays the single | |
| 33 | /// definition of every default colour. | |
| 34 | /// | |
| 35 | /// `Docs/ACCESSIBILITY.txt` names that palette as the guard against | |
| 36 | /// contrast regressions, and reading the defaults from it here is what | |
| 37 | /// keeps the guard: a theme overrides individual tokens, it does not | |
| 38 | /// replace the set. | |
| 39 | /// | |
| 40 | /// Looked up by name rather than through the generated `ColorResource` | |
| 41 | /// symbols, which are MainActor-isolated and so cannot be read from | |
| 42 | /// `ShapeStyle.resolve(in:)`. `ThemeTests` asserts that every token still | |
| 43 | /// has a colorset and that no colorset is left without a token. | |
| 44 | var assetColor: Color { | |
| 45 | Color(rawValue, bundle: .main) | |
| 46 | } | |
| 47 | } | |
| 48 | ||
| 49 | /// A token is itself a style, so it can be handed straight to `foregroundStyle`, | |
| 50 | /// `background`, `tint` or `fill` and resolve against the environment's theme | |
| 51 | /// when the view draws. | |
| 52 | /// | |
| 53 | /// This is what keeps the refactor from adding an `@Environment(\.theme)` | |
| 54 | /// property to every view in the app: in a style position the token needs no | |
| 55 | /// one to resolve it. Only a colour used as a plain value — a list row's | |
| 56 | /// background, which takes a view rather than a style — needs the environment | |
| 57 | /// read explicitly. | |
| 58 | nonisolated extension ThemeToken: ShapeStyle { | |
| 59 | func resolve(in environment: EnvironmentValues) -> some ShapeStyle { | |
| 60 | environment.theme[self] | |
| 61 | } | |
| 62 | } | |
| 63 | ||
| 64 | /// The colours a screen draws with. | |
| 65 | /// | |
| 66 | /// Carried in the environment so an accent choice reaches every view without | |
| 67 | /// threading a parameter. The default resolves every token from the asset | |
| 68 | /// catalog, so an app with no theme chosen renders exactly as it did before | |
| 69 | /// this existed. | |
| 70 | nonisolated struct Theme: Equatable, Sendable { | |
| 71 | /// What this theme changes about the palette. Empty for the default. | |
| 72 | private let overrides: [ThemeToken: Color] | |
| 73 | ||
| 74 | init(overrides: [ThemeToken: Color] = [:]) { | |
| 75 | self.overrides = overrides | |
| 76 | } | |
| 77 | ||
| 78 | static let `default` = Theme() | |
| 79 | ||
| 80 | subscript(token: ThemeToken) -> Color { | |
| 81 | overrides[token] ?? token.assetColor | |
| 82 | } | |
| 83 | ||
| 84 | /// For the few places that need a `Color` rather than a style, such as a | |
| 85 | /// list row's background. | |
| 86 | var appBackground: Color { self[.background] } | |
| 87 | var appSurface: Color { self[.surface] } | |
| 88 | var appSurfaceElevated: Color { self[.surfaceElevated] } | |
| 89 | var appTextSecondary: Color { self[.textSecondary] } | |
| 90 | var accentFill: Color { self[.accent] } | |
| 91 | } | |
| 92 | ||
| 93 | /// An accent a user can pick. | |
| 94 | /// | |
| 95 | /// Only the accent tokens are overridden. The status colours keep their palette | |
| 96 | /// values deliberately: "critical" means one thing, and letting an accent | |
| 97 | /// recolour it would undo the contrast work phases 1–5 of #21 did and leave the | |
| 98 | /// palette no longer answerable for its own contrast. | |
| 99 | nonisolated enum AccentTheme: String, Codable, CaseIterable, Identifiable, Sendable { | |
| 100 | case `default` | |
| 101 | case graphite | |
| 102 | case forest | |
| 103 | case plum | |
| 104 | ||
| 105 | static let userDefaultsKey = "appAccentTheme" | |
| 106 | ||
| 107 | var id: String { rawValue } | |
| 108 | ||
| 109 | var title: String { | |
| 110 | switch self { | |
| 111 | case .default: return "Default" | |
| 112 | case .graphite: return "Graphite" | |
| 113 | case .forest: return "Forest" | |
| 114 | case .plum: return "Plum" | |
| 115 | } | |
| 116 | } | |
| 117 | ||
| 118 | var theme: Theme { | |
| 119 | guard let fill = accentFill else { return .default } | |
| 120 | return Theme(overrides: [.accent: fill, .onAccent: .white]) | |
| 121 | } | |
| 122 | ||
| 123 | private var accentFill: Color? { | |
| 124 | switch self { | |
| 125 | case .default: | |
| 126 | return nil | |
| 127 | case .graphite: | |
| 128 | return Color(red: 0.26, green: 0.28, blue: 0.31) | |
| 129 | case .forest: | |
| 130 | return Color(red: 0.13, green: 0.40, blue: 0.27) | |
| 131 | case .plum: | |
| 132 | return Color(red: 0.42, green: 0.20, blue: 0.44) | |
| 133 | } | |
| 134 | } | |
| 135 | } | |
| 136 | ||
| 137 | nonisolated private struct ThemeKey: EnvironmentKey { | |
| 138 | static let defaultValue = Theme.default | |
| 139 | } | |
| 140 | ||
| 141 | extension EnvironmentValues { | |
| 142 | /// Nonisolated so `ShapeStyle.resolve(in:)`, which is itself nonisolated, | |
| 143 | /// can read it. | |
| 144 | nonisolated var theme: Theme { | |
| 145 | get { self[ThemeKey.self] } | |
| 146 | set { self[ThemeKey.self] = newValue } | |
| 147 | } | |
| 148 | } | |
| 149 | ||
| 150 | /// `listRowBackground` takes a view rather than a style, so a token cannot be | |
| 151 | /// handed to it directly — it has to be resolved first, which needs the | |
| 152 | /// environment. This is the one place in the app that reads the theme to get a | |
| 153 | /// `Color` rather than passing a token as a style. | |
| 154 | private struct ThemedListRowBackground: ViewModifier { | |
| 155 | @Environment(\.theme) private var theme | |
| 156 | let token: ThemeToken | |
| 157 | ||
| 158 | func body(content: Content) -> some View { | |
| 159 | content.listRowBackground(theme[token]) | |
| 160 | } | |
| 161 | } | |
| 162 | ||
| 163 | extension View { | |
| 164 | func themedListRowBackground(_ token: ThemeToken) -> some View { | |
| 165 | modifier(ThemedListRowBackground(token: token)) | |
| 166 | } | |
| 167 | } | |
DomainDig/TimelineView.swift +9 −9
| @@ -45,12 +45,12 @@ struct TimelineView: View { | ||
| 45 | 45 | } |
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | .listRowBackground(Color(.appSurface)) | |
| 48 | .themedListRowBackground(.surface) | |
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | 52 | .scrollContentBackground(.hidden) |
| 53 | .background(Color(.appBackground)) | |
| 53 | .background(ThemeToken.background) | |
| 54 | 54 | .navigationTitle(domain) |
| 55 | 55 | .toolbar { |
| 56 | 56 | ToolbarItemGroup(placement: .topBarTrailing) { |
| @@ -117,8 +117,8 @@ private struct TimelineRow: View { | ||
| 117 | 117 | model: .init( |
| 118 | 118 | title: severity.title, |
| 119 | 119 | systemImage: "arrow.triangle.2.circlepath", |
| 120 | foregroundColor: severity == .high ? Color(.statusCritical) : Color(.statusWarning), | |
| 121 | backgroundColor: (severity == .high ? AppStatusTone.critical : .warning).surface | |
| 120 | foreground: severity == .high ? .critical : .warning, | |
| 121 | background: (severity == .high ? AppStatusTone.critical : .warning).surface | |
| 122 | 122 | ) |
| 123 | 123 | ) |
| 124 | 124 | } |
| @@ -126,7 +126,7 @@ private struct TimelineRow: View { | ||
| 126 | 126 | |
| 127 | 127 | Text(summary.changeSummaryMessage ?? "No change summary") |
| 128 | 128 | .font(appDensity.font(.caption)) |
| 129 | .foregroundStyle(Color(.appTextSecondary)) | |
| 129 | .foregroundStyle(ThemeToken.textSecondary) | |
| 130 | 130 | .lineLimit(2) |
| 131 | 131 | |
| 132 | 132 | HStack(spacing: 8) { |
| @@ -138,14 +138,14 @@ private struct TimelineRow: View { | ||
| 138 | 138 | } |
| 139 | 139 | } |
| 140 | 140 | .font(appDensity.font(.caption2)) |
| 141 | .foregroundStyle(Color(.appTextSecondary)) | |
| 141 | .foregroundStyle(ThemeToken.textSecondary) | |
| 142 | 142 | |
| 143 | 143 | if !entry.intelligenceTimeline.isEmpty { |
| 144 | 144 | VStack(alignment: .leading, spacing: 4) { |
| 145 | 145 | ForEach(Array(entry.intelligenceTimeline.prefix(2))) { event in |
| 146 | 146 | Text("\(event.title): \(event.detail)") |
| 147 | 147 | .font(appDensity.font(.caption2)) |
| 148 | .foregroundStyle(Color(.appTextSecondary)) | |
| 148 | .foregroundStyle(ThemeToken.textSecondary) | |
| 149 | 149 | .lineLimit(1) |
| 150 | 150 | } |
| 151 | 151 | } |
| @@ -162,7 +162,7 @@ private struct TimelineRow: View { | ||
| 162 | 162 | .lineLimit(1) |
| 163 | 163 | } |
| 164 | 164 | .font(appDensity.font(.caption2)) |
| 165 | .foregroundStyle(Color(.appTextSecondary)) | |
| 165 | .foregroundStyle(ThemeToken.textSecondary) | |
| 166 | 166 | } |
| 167 | 167 | } |
| 168 | 168 | } |
| @@ -205,7 +205,7 @@ struct TimelineDiffView: View { | ||
| 205 | 205 | } |
| 206 | 206 | .padding() |
| 207 | 207 | } |
| 208 | .background(Color(.appBackground)) | |
| 208 | .background(ThemeToken.background) | |
| 209 | 209 | .navigationTitle("Compare Snapshots") |
| 210 | 210 | .navigationBarTitleDisplayMode(.inline) |
| 211 | 211 | .onAppear { |
DomainDig/WatchlistView.swift +34 −34
| @@ -37,11 +37,11 @@ struct WatchlistView: View { | ||
| 37 | 37 | Section("Refresh Progress") { |
| 38 | 38 | VStack(alignment: .leading, spacing: 8) { |
| 39 | 39 | ProgressView(value: Double(viewModel.batchCompletedCount), total: Double(max(viewModel.batchTotalCount, 1))) |
| 40 | .tint(Color(.statusInfo)) | |
| 40 | .tint(ThemeToken.info) | |
| 41 | 41 | HStack { |
| 42 | 42 | Text(viewModel.batchProgressLabel) |
| 43 | 43 | .font(appDensity.font(.caption)) |
| 44 | .foregroundStyle(Color(.appTextSecondary)) | |
| 44 | .foregroundStyle(ThemeToken.textSecondary) | |
| 45 | 45 | Spacer() |
| 46 | 46 | if viewModel.batchLookupRunning { |
| 47 | 47 | Button("Cancel") { |
| @@ -58,7 +58,7 @@ struct WatchlistView: View { | ||
| 58 | 58 | } |
| 59 | 59 | .padding(.vertical, 4) |
| 60 | 60 | } |
| 61 | .listRowBackground(Color(.appSurface)) | |
| 61 | .themedListRowBackground(.surface) | |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | if viewModel.filteredTrackedDomains.isEmpty { |
| @@ -71,15 +71,15 @@ struct WatchlistView: View { | ||
| 71 | 71 | showsCardBackground: false |
| 72 | 72 | ) |
| 73 | 73 | } |
| 74 | .listRowBackground(Color(.appSurface)) | |
| 74 | .themedListRowBackground(.surface) | |
| 75 | 75 | } else { |
| 76 | 76 | if let limitMessage = FeatureAccessService.trackedDomainLimitMessage(currentCount: viewModel.trackedDomains.count) { |
| 77 | 77 | Section { |
| 78 | 78 | Text(limitMessage) |
| 79 | 79 | .font(appDensity.font(.caption)) |
| 80 | .foregroundStyle(Color(.appTextSecondary)) | |
| 80 | .foregroundStyle(ThemeToken.textSecondary) | |
| 81 | 81 | } |
| 82 | .listRowBackground(Color(.appSurface)) | |
| 82 | .themedListRowBackground(.surface) | |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | if !pinnedDomains.isEmpty { |
| @@ -93,7 +93,7 @@ struct WatchlistView: View { | ||
| 93 | 93 | } |
| 94 | 94 | .animation(reduceMotion ? nil : .easeInOut(duration: 0.2), value: viewModel.filteredTrackedDomains.map(\.id)) |
| 95 | 95 | .scrollContentBackground(.hidden) |
| 96 | .background(Color(.appBackground)) | |
| 96 | .background(ThemeToken.background) | |
| 97 | 97 | .navigationTitle("Watchlist") |
| 98 | 98 | .searchable(text: $viewModel.watchlistSearchText, prompt: "Search tracked domains") |
| 99 | 99 | .toolbar { |
| @@ -180,14 +180,14 @@ struct WatchlistView: View { | ||
| 180 | 180 | Section { |
| 181 | 181 | Text("Adds the domain directly to your watchlist so monitoring can run without a prior inspection.") |
| 182 | 182 | .font(appDensity.font(.caption)) |
| 183 | .foregroundStyle(Color(.appTextSecondary)) | |
| 183 | .foregroundStyle(ThemeToken.textSecondary) | |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | if let addDomainError { |
| 187 | 187 | Section { |
| 188 | 188 | Text(addDomainError) |
| 189 | 189 | .font(appDensity.font(.caption)) |
| 190 | .foregroundStyle(Color(.statusCritical)) | |
| 190 | .foregroundStyle(ThemeToken.critical) | |
| 191 | 191 | } |
| 192 | 192 | } |
| 193 | 193 | } |
| @@ -239,7 +239,7 @@ struct WatchlistView: View { | ||
| 239 | 239 | .foregroundStyle(.primary) |
| 240 | 240 | Text([view.tag, view.filter.title, view.sort.title].compactMap { $0 }.joined(separator: " • ")) |
| 241 | 241 | .font(.caption) |
| 242 | .foregroundStyle(Color(.appTextSecondary)) | |
| 242 | .foregroundStyle(ThemeToken.textSecondary) | |
| 243 | 243 | } |
| 244 | 244 | } |
| 245 | 245 | } |
| @@ -283,19 +283,19 @@ struct WatchlistView: View { | ||
| 283 | 283 | .buttonStyle(.plain) |
| 284 | 284 | .swipeActions(edge: .leading, allowsFullSwipe: false) { |
| 285 | 285 | refreshButton(trackedDomain) |
| 286 | .tint(Color(.statusInfo)) | |
| 286 | .tint(ThemeToken.info) | |
| 287 | 287 | pinButton(trackedDomain) |
| 288 | .tint(Color(.statusWarning)) | |
| 288 | .tint(ThemeToken.warning) | |
| 289 | 289 | } |
| 290 | 290 | .swipeActions(edge: .trailing, allowsFullSwipe: false) { |
| 291 | 291 | refreshButton(trackedDomain) |
| 292 | .tint(Color(.statusInfo)) | |
| 292 | .tint(ThemeToken.info) | |
| 293 | 293 | deleteButton(trackedDomain) |
| 294 | 294 | } |
| 295 | 295 | .contextMenu { |
| 296 | 296 | rowMenu(trackedDomain) |
| 297 | 297 | } |
| 298 | .listRowBackground(Color(.appSurface)) | |
| 298 | .themedListRowBackground(.surface) | |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | 301 | @ViewBuilder |
| @@ -418,12 +418,12 @@ struct WatchlistRowView: View { | ||
| 418 | 418 | |
| 419 | 419 | Text("Updated \(trackedDomain.updatedAt.formatted(date: .abbreviated, time: .shortened))") |
| 420 | 420 | .font(appDensity.font(.caption2)) |
| 421 | .foregroundStyle(Color(.appTextSecondary)) | |
| 421 | .foregroundStyle(ThemeToken.textSecondary) | |
| 422 | 422 | |
| 423 | 423 | if let collaboration = trackedDomain.collaboration, collaboration.isShared { |
| 424 | 424 | Text("\(collaboration.ownership.title) • \(collaboration.permission.title)") |
| 425 | 425 | .font(appDensity.font(.caption2)) |
| 426 | .foregroundStyle(Color(.appTextSecondary)) | |
| 426 | .foregroundStyle(ThemeToken.textSecondary) | |
| 427 | 427 | } |
| 428 | 428 | |
| 429 | 429 | ViewThatFits(in: .horizontal) { |
| @@ -431,19 +431,19 @@ struct WatchlistRowView: View { | ||
| 431 | 431 | VStack(alignment: .leading, spacing: 2) { monitoringMetadata } |
| 432 | 432 | } |
| 433 | 433 | .font(appDensity.font(.caption2)) |
| 434 | .foregroundStyle(Color(.appTextSecondary)) | |
| 434 | .foregroundStyle(ThemeToken.textSecondary) | |
| 435 | 435 | |
| 436 | 436 | indicatorRow |
| 437 | 437 | |
| 438 | 438 | if let note = trackedDomain.note?.trimmingCharacters(in: .whitespacesAndNewlines), !note.isEmpty { |
| 439 | 439 | Text(note) |
| 440 | 440 | .font(appDensity.font(.caption)) |
| 441 | .foregroundStyle(Color(.appTextSecondary)) | |
| 441 | .foregroundStyle(ThemeToken.textSecondary) | |
| 442 | 442 | .lineLimit(2) |
| 443 | 443 | } else if let summary = trackedDomain.lastChangeSummary { |
| 444 | 444 | Text(summary.message) |
| 445 | 445 | .font(appDensity.font(.caption)) |
| 446 | .foregroundStyle(Color(.appTextSecondary)) | |
| 446 | .foregroundStyle(ThemeToken.textSecondary) | |
| 447 | 447 | .lineLimit(2) |
| 448 | 448 | } |
| 449 | 449 | } |
| @@ -468,7 +468,7 @@ struct WatchlistRowView: View { | ||
| 468 | 468 | if trackedDomain.isPinned { |
| 469 | 469 | Image(systemName: "pin.fill") |
| 470 | 470 | .font(.caption2) |
| 471 | .foregroundStyle(Color(.statusWarning)) | |
| 471 | .foregroundStyle(ThemeToken.warning) | |
| 472 | 472 | } |
| 473 | 473 | Text(trackedDomain.domain) |
| 474 | 474 | .font(appDensity.font(.callout)) |
| @@ -493,7 +493,7 @@ struct WatchlistRowView: View { | ||
| 493 | 493 | @ViewBuilder |
| 494 | 494 | private var statusBadge: some View { |
| 495 | 495 | if isRefreshing { |
| 496 | AppStatusBadgeView(model: .init(title: "Refreshing", systemImage: "arrow.clockwise", foregroundColor: Color(.appTextSecondary), backgroundColor: Color(.appSurfaceElevated))) | |
| 496 | AppStatusBadgeView(model: .init(title: "Refreshing", systemImage: "arrow.clockwise", foreground: .textSecondary, background: .surfaceElevated)) | |
| 497 | 497 | } else { |
| 498 | 498 | AppStatusBadgeView(model: AppStatusFactory.availability(trackedDomain.lastKnownAvailability)) |
| 499 | 499 | } |
| @@ -507,8 +507,8 @@ struct WatchlistRowView: View { | ||
| 507 | 507 | model: .init( |
| 508 | 508 | title: "Shared", |
| 509 | 509 | systemImage: "person.2.fill", |
| 510 | foregroundColor: Color(.statusInfo), | |
| 511 | backgroundColor: Color(.statusInfoSurface) | |
| 510 | foreground: .info, | |
| 511 | background: .infoSurface | |
| 512 | 512 | ) |
| 513 | 513 | ) |
| 514 | 514 | } |
| @@ -525,11 +525,11 @@ struct WatchlistRowView: View { | ||
| 525 | 525 | let days = trackedDomain.certificateDaysRemaining.map { "\($0)d" } ?? "Soon" |
| 526 | 526 | switch trackedDomain.certificateWarningLevel { |
| 527 | 527 | case .critical: |
| 528 | return .init(title: "Invalid \(days)", systemImage: "xmark.octagon.fill", foregroundColor: Color(.statusCritical), backgroundColor: Color(.statusCriticalSurface)) | |
| 528 | return .init(title: "Invalid \(days)", systemImage: "xmark.octagon.fill", foreground: .critical, background: .criticalSurface) | |
| 529 | 529 | case .warning: |
| 530 | return .init(title: "Expiring \(days)", systemImage: "exclamationmark.triangle.fill", foregroundColor: Color(.statusWarning), backgroundColor: Color(.statusWarningSurface)) | |
| 530 | return .init(title: "Expiring \(days)", systemImage: "exclamationmark.triangle.fill", foreground: .warning, background: .warningSurface) | |
| 531 | 531 | case .none: |
| 532 | return .init(title: "Valid", systemImage: "lock.fill", foregroundColor: Color(.statusPositive), backgroundColor: Color(.statusPositiveSurface)) | |
| 532 | return .init(title: "Valid", systemImage: "lock.fill", foreground: .positive, background: .positiveSurface) | |
| 533 | 533 | } |
| 534 | 534 | } |
| 535 | 535 | } |
| @@ -596,7 +596,7 @@ struct TrackedDomainDetailView: View { | ||
| 596 | 596 | isRefreshing: viewModel.refreshingTrackedDomainID == liveTrackedDomain.id |
| 597 | 597 | ) |
| 598 | 598 | } |
| 599 | .listRowBackground(Color(.appSurface)) | |
| 599 | .themedListRowBackground(.surface) | |
| 600 | 600 | |
| 601 | 601 | Section { |
| 602 | 602 | Button { |
| @@ -678,13 +678,13 @@ struct TrackedDomainDetailView: View { | ||
| 678 | 678 | Label(liveTrackedDomain.collaboration?.isShared == true ? "Manage Share" : "Share Domain", systemImage: "person.2") |
| 679 | 679 | } |
| 680 | 680 | } |
| 681 | .listRowBackground(Color(.appSurface)) | |
| 681 | .themedListRowBackground(.surface) | |
| 682 | 682 | |
| 683 | 683 | if !liveTrackedDomain.tags.isEmpty { |
| 684 | 684 | Section("Tags") { |
| 685 | 685 | TagChipRowView(tags: liveTrackedDomain.tags) |
| 686 | 686 | } |
| 687 | .listRowBackground(Color(.appSurface)) | |
| 687 | .themedListRowBackground(.surface) | |
| 688 | 688 | } |
| 689 | 689 | |
| 690 | 690 | Section("Monitoring Status") { |
| @@ -698,7 +698,7 @@ struct TrackedDomainDetailView: View { | ||
| 698 | 698 | LabeledContent("Queued Alerts", value: "\(liveTrackedDomain.pendingMonitoringAlerts.count)") |
| 699 | 699 | } |
| 700 | 700 | } |
| 701 | .listRowBackground(Color(.appSurface)) | |
| 701 | .themedListRowBackground(.surface) | |
| 702 | 702 | |
| 703 | 703 | if let summary = viewModel.latestChangeSummary(for: liveTrackedDomain) { |
| 704 | 704 | Section("Latest Change Summary") { |
| @@ -726,7 +726,7 @@ struct TrackedDomainDetailView: View { | ||
| 726 | 726 | if latestSnapshots.isEmpty { |
| 727 | 727 | Text("No snapshots yet") |
| 728 | 728 | .font(.system(.caption, design: .monospaced)) |
| 729 | .foregroundStyle(Color(.appTextSecondary)) | |
| 729 | .foregroundStyle(ThemeToken.textSecondary) | |
| 730 | 730 | } else { |
| 731 | 731 | ForEach(latestSnapshots) { entry in |
| 732 | 732 | NavigationLink { |
| @@ -738,16 +738,16 @@ struct TrackedDomainDetailView: View { | ||
| 738 | 738 | .foregroundStyle(.primary) |
| 739 | 739 | Text(entry.changeSummary?.hasChanges == true ? "Changed" : "Snapshot") |
| 740 | 740 | .font(.system(.caption2, design: .monospaced)) |
| 741 | .foregroundStyle(Color(.appTextSecondary)) | |
| 741 | .foregroundStyle(ThemeToken.textSecondary) | |
| 742 | 742 | } |
| 743 | 743 | } |
| 744 | 744 | } |
| 745 | 745 | } |
| 746 | 746 | } |
| 747 | .listRowBackground(Color(.appSurface)) | |
| 747 | .themedListRowBackground(.surface) | |
| 748 | 748 | } |
| 749 | 749 | .scrollContentBackground(.hidden) |
| 750 | .background(Color(.appBackground)) | |
| 750 | .background(ThemeToken.background) | |
| 751 | 751 | .navigationTitle(liveTrackedDomain.domain) |
| 752 | 752 | .onChange(of: viewModel.rerunNavigationToken) { _, _ in |
| 753 | 753 | dismiss() |
DomainDig/WebSectionView.swift +8 −8
| @@ -52,7 +52,7 @@ struct WebSectionView: View { | ||
| 52 | 52 | HStack { |
| 53 | 53 | Text("TLS") |
| 54 | 54 | .font(appDensity.font(.subheadline, weight: .semibold)) |
| 55 | .foregroundStyle(Color(.statusInfo)) | |
| 55 | .foregroundStyle(ThemeToken.info) | |
| 56 | 56 | Spacer() |
| 57 | 57 | if !sslLoading { |
| 58 | 58 | AppStatusBadgeView(model: AppStatusFactory.tls(sslInfo: sslInfo, error: sslError)) |
| @@ -77,7 +77,7 @@ struct WebSectionView: View { | ||
| 77 | 77 | if let sslInfo, !sslInfo.subjectAltNames.isEmpty { |
| 78 | 78 | Text("SANs") |
| 79 | 79 | .font(appDensity.font(.caption2)) |
| 80 | .foregroundStyle(Color(.appTextSecondary)) | |
| 80 | .foregroundStyle(ThemeToken.textSecondary) | |
| 81 | 81 | ForEach(sslInfo.subjectAltNames, id: \.self) { san in |
| 82 | 82 | HStack(alignment: .top, spacing: 8) { |
| 83 | 83 | Text(san) |
| @@ -96,7 +96,7 @@ struct WebSectionView: View { | ||
| 96 | 96 | CardView { |
| 97 | 97 | Text("Headers") |
| 98 | 98 | .font(appDensity.font(.subheadline, weight: .semibold)) |
| 99 | .foregroundStyle(Color(.statusInfo)) | |
| 99 | .foregroundStyle(ThemeToken.info) | |
| 100 | 100 | SectionTrustMetadataView(provenance: httpProvenance, confidence: nil) |
| 101 | 101 | if headersLoading { |
| 102 | 102 | ProgressView("Fetching headers…") |
| @@ -114,7 +114,7 @@ struct WebSectionView: View { | ||
| 114 | 114 | HStack(alignment: .top, spacing: 4) { |
| 115 | 115 | Text(header.name + ":") |
| 116 | 116 | .font(appDensity.font(.caption)) |
| 117 | .foregroundStyle(header.isSecurityHeader ? Color(.statusWarning) : Color(.statusInfo)) | |
| 117 | .foregroundStyle(header.isSecurityHeader ? ThemeToken.warning : ThemeToken.info) | |
| 118 | 118 | Text(header.value) |
| 119 | 119 | .font(appDensity.font(.caption)) |
| 120 | 120 | .foregroundStyle(.primary) |
| @@ -129,7 +129,7 @@ struct WebSectionView: View { | ||
| 129 | 129 | HStack { |
| 130 | 130 | Text("Redirects") |
| 131 | 131 | .font(appDensity.font(.subheadline, weight: .semibold)) |
| 132 | .foregroundStyle(Color(.statusInfo)) | |
| 132 | .foregroundStyle(ThemeToken.info) | |
| 133 | 133 | Spacer() |
| 134 | 134 | if let finalURL { |
| 135 | 135 | AppCopyButton(value: finalURL, label: "Copy redirect URL") |
| @@ -151,11 +151,11 @@ struct WebSectionView: View { | ||
| 151 | 151 | HStack(alignment: .top, spacing: 6) { |
| 152 | 152 | Text(redirect.stepLabel) |
| 153 | 153 | .font(appDensity.font(.caption)) |
| 154 | .foregroundStyle(Color(.appTextSecondary)) | |
| 154 | .foregroundStyle(ThemeToken.textSecondary) | |
| 155 | 155 | .frame(width: 16, alignment: .trailing) |
| 156 | 156 | Text(redirect.statusCode) |
| 157 | 157 | .font(appDensity.font(.caption)) |
| 158 | .foregroundStyle(Color(.statusInfo)) | |
| 158 | .foregroundStyle(ThemeToken.info) | |
| 159 | 159 | .frame(width: 36, alignment: .leading) |
| 160 | 160 | Text(redirect.url) |
| 161 | 161 | .font(appDensity.font(.caption)) |
| @@ -163,7 +163,7 @@ struct WebSectionView: View { | ||
| 163 | 163 | if redirect.isFinal { |
| 164 | 164 | Text("(final)") |
| 165 | 165 | .font(appDensity.font(.caption2)) |
| 166 | .foregroundStyle(Color(.appTextSecondary)) | |
| 166 | .foregroundStyle(ThemeToken.textSecondary) | |
| 167 | 167 | } |
| 168 | 168 | Spacer(minLength: 8) |
| 169 | 169 | AppCopyButton(value: redirect.url, label: "Copy redirect URL") |
DomainDig/WorkflowsView.swift +24 −24
| @@ -20,15 +20,15 @@ struct WorkflowsView: View { | ||
| 20 | 20 | Section { |
| 21 | 21 | Text(limitMessage) |
| 22 | 22 | .font(appDensity.font(.caption)) |
| 23 | .foregroundStyle(Color(.appTextSecondary)) | |
| 23 | .foregroundStyle(ThemeToken.textSecondary) | |
| 24 | 24 | } |
| 25 | .listRowBackground(Color(.appSurface)) | |
| 25 | .themedListRowBackground(.surface) | |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | workflowContent |
| 29 | 29 | } |
| 30 | 30 | .scrollContentBackground(.hidden) |
| 31 | .background(Color(.appBackground)) | |
| 31 | .background(ThemeToken.background) | |
| 32 | 32 | .refreshable { |
| 33 | 33 | await viewModel.refreshWorkflowList() |
| 34 | 34 | } |
| @@ -71,12 +71,12 @@ struct WorkflowsView: View { | ||
| 71 | 71 | value: Double(viewModel.batchCompletedCount), |
| 72 | 72 | total: Double(max(viewModel.batchTotalCount, 1)) |
| 73 | 73 | ) |
| 74 | .tint(Color(.statusInfo)) | |
| 74 | .tint(ThemeToken.info) | |
| 75 | 75 | |
| 76 | 76 | HStack { |
| 77 | 77 | Text(viewModel.batchProgressLabel) |
| 78 | 78 | .font(appDensity.font(.caption)) |
| 79 | .foregroundStyle(Color(.appTextSecondary)) | |
| 79 | .foregroundStyle(ThemeToken.textSecondary) | |
| 80 | 80 | Spacer() |
| 81 | 81 | if viewModel.batchLookupRunning { |
| 82 | 82 | Button("Cancel") { |
| @@ -89,7 +89,7 @@ struct WorkflowsView: View { | ||
| 89 | 89 | } |
| 90 | 90 | .padding(.vertical, 4) |
| 91 | 91 | } |
| 92 | .listRowBackground(Color(.appSurface)) | |
| 92 | .themedListRowBackground(.surface) | |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | if viewModel.workflows.isEmpty { |
| @@ -102,7 +102,7 @@ struct WorkflowsView: View { | ||
| 102 | 102 | showsCardBackground: false |
| 103 | 103 | ) |
| 104 | 104 | } |
| 105 | .listRowBackground(Color(.appSurface)) | |
| 105 | .themedListRowBackground(.surface) | |
| 106 | 106 | } else { |
| 107 | 107 | ForEach(viewModel.workflows) { workflow in |
| 108 | 108 | NavigationLink { |
| @@ -110,7 +110,7 @@ struct WorkflowsView: View { | ||
| 110 | 110 | } label: { |
| 111 | 111 | WorkflowRowView(workflow: workflow) |
| 112 | 112 | } |
| 113 | .listRowBackground(Color(.appSurface)) | |
| 113 | .themedListRowBackground(.surface) | |
| 114 | 114 | } |
| 115 | 115 | .onDelete { offsets in |
| 116 | 116 | let workflows = offsets.map { viewModel.workflows[$0] } |
| @@ -131,7 +131,7 @@ private struct WorkflowRowView: View { | ||
| 131 | 131 | if workflow.collaboration?.isShared == true { |
| 132 | 132 | Image(systemName: "person.2.fill") |
| 133 | 133 | .font(.caption2) |
| 134 | .foregroundStyle(Color(.statusInfo)) | |
| 134 | .foregroundStyle(ThemeToken.info) | |
| 135 | 135 | .accessibilityLabel("Shared") |
| 136 | 136 | } |
| 137 | 137 | Text(workflow.name) |
| @@ -141,23 +141,23 @@ private struct WorkflowRowView: View { | ||
| 141 | 141 | Spacer(minLength: 8) |
| 142 | 142 | Text("\(workflow.domains.count) domains") |
| 143 | 143 | .font(appDensity.font(.caption2)) |
| 144 | .foregroundStyle(Color(.appTextSecondary)) | |
| 144 | .foregroundStyle(ThemeToken.textSecondary) | |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | Text("Updated \(workflow.updatedAt.formatted(date: .abbreviated, time: .shortened))") |
| 148 | 148 | .font(appDensity.font(.caption2)) |
| 149 | .foregroundStyle(Color(.appTextSecondary)) | |
| 149 | .foregroundStyle(ThemeToken.textSecondary) | |
| 150 | 150 | |
| 151 | 151 | if let collaboration = workflow.collaboration, collaboration.isShared { |
| 152 | 152 | Text("\(collaboration.ownership.title) • \(collaboration.permission.title)") |
| 153 | 153 | .font(appDensity.font(.caption2)) |
| 154 | .foregroundStyle(Color(.appTextSecondary)) | |
| 154 | .foregroundStyle(ThemeToken.textSecondary) | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if let notes = workflow.notes, !notes.isEmpty { |
| 158 | 158 | Text(notes) |
| 159 | 159 | .font(appDensity.font(.caption)) |
| 160 | .foregroundStyle(Color(.appTextSecondary)) | |
| 160 | .foregroundStyle(ThemeToken.textSecondary) | |
| 161 | 161 | .lineLimit(2) |
| 162 | 162 | } |
| 163 | 163 | } |
| @@ -196,12 +196,12 @@ struct WorkflowDetailView: View { | ||
| 196 | 196 | if let notes = workflow.notes, !notes.isEmpty { |
| 197 | 197 | Text(notes) |
| 198 | 198 | .font(appDensity.font(.caption)) |
| 199 | .foregroundStyle(Color(.appTextSecondary)) | |
| 199 | .foregroundStyle(ThemeToken.textSecondary) | |
| 200 | 200 | } |
| 201 | 201 | if let collaboration = workflow.collaboration, collaboration.isShared { |
| 202 | 202 | Text("\(collaboration.ownership.title) • \(collaboration.permission.title)") |
| 203 | 203 | .font(appDensity.font(.caption)) |
| 204 | .foregroundStyle(Color(.appTextSecondary)) | |
| 204 | .foregroundStyle(ThemeToken.textSecondary) | |
| 205 | 205 | } |
| 206 | 206 | } |
| 207 | 207 | |
| @@ -256,7 +256,7 @@ struct WorkflowDetailView: View { | ||
| 256 | 256 | if !latestSummary.workflowInsights.isEmpty { |
| 257 | 257 | Text(latestSummary.workflowInsights[0].description) |
| 258 | 258 | .font(appDensity.font(.caption)) |
| 259 | .foregroundStyle(Color(.appTextSecondary)) | |
| 259 | .foregroundStyle(ThemeToken.textSecondary) | |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | Button { |
| @@ -285,7 +285,7 @@ struct WorkflowDetailView: View { | ||
| 285 | 285 | if workflow.domains.isEmpty { |
| 286 | 286 | Text("No domains in this workflow") |
| 287 | 287 | .font(appDensity.font(.caption)) |
| 288 | .foregroundStyle(Color(.appTextSecondary)) | |
| 288 | .foregroundStyle(ThemeToken.textSecondary) | |
| 289 | 289 | } else { |
| 290 | 290 | ForEach(workflow.domains, id: \.self) { domain in |
| 291 | 291 | Button { |
| @@ -297,7 +297,7 @@ struct WorkflowDetailView: View { | ||
| 297 | 297 | .foregroundStyle(.primary) |
| 298 | 298 | Spacer() |
| 299 | 299 | Image(systemName: "arrow.up.right.circle") |
| 300 | .foregroundStyle(Color(.appTextSecondary)) | |
| 300 | .foregroundStyle(ThemeToken.textSecondary) | |
| 301 | 301 | } |
| 302 | 302 | } |
| 303 | 303 | .buttonStyle(.plain) |
| @@ -314,7 +314,7 @@ struct WorkflowDetailView: View { | ||
| 314 | 314 | } |
| 315 | 315 | } |
| 316 | 316 | .scrollContentBackground(.hidden) |
| 317 | .background(Color(.appBackground)) | |
| 317 | .background(ThemeToken.background) | |
| 318 | 318 | .navigationTitle(workflow.name) |
| 319 | 319 | .toolbar { |
| 320 | 320 | if !workflow.domains.isEmpty { |
| @@ -334,7 +334,7 @@ struct WorkflowDetailView: View { | ||
| 334 | 334 | } else { |
| 335 | 335 | Text("Workflow not found") |
| 336 | 336 | .font(appDensity.font(.callout)) |
| 337 | .foregroundStyle(Color(.appTextSecondary)) | |
| 337 | .foregroundStyle(ThemeToken.textSecondary) | |
| 338 | 338 | } |
| 339 | 339 | } |
| 340 | 340 | } |
| @@ -343,7 +343,7 @@ struct WorkflowDetailView: View { | ||
| 343 | 343 | HStack { |
| 344 | 344 | Text(label) |
| 345 | 345 | .font(appDensity.font(.caption)) |
| 346 | .foregroundStyle(Color(.appTextSecondary)) | |
| 346 | .foregroundStyle(ThemeToken.textSecondary) | |
| 347 | 347 | Spacer() |
| 348 | 348 | Text(value) |
| 349 | 349 | .font(appDensity.font(.callout)) |
| @@ -484,7 +484,7 @@ struct WorkflowRunSummaryView: View { | ||
| 484 | 484 | .foregroundStyle(.primary) |
| 485 | 485 | Text(insight.domainsInvolved.joined(separator: ", ")) |
| 486 | 486 | .font(.system(.caption, design: .monospaced)) |
| 487 | .foregroundStyle(Color(.appTextSecondary)) | |
| 487 | .foregroundStyle(ThemeToken.textSecondary) | |
| 488 | 488 | } |
| 489 | 489 | } |
| 490 | 490 | } |
| @@ -525,7 +525,7 @@ struct WorkflowRunSummaryView: View { | ||
| 525 | 525 | HStack { |
| 526 | 526 | Text(label) |
| 527 | 527 | .font(.system(.caption, design: .monospaced)) |
| 528 | .foregroundStyle(Color(.appTextSecondary)) | |
| 528 | .foregroundStyle(ThemeToken.textSecondary) | |
| 529 | 529 | Spacer() |
| 530 | 530 | Text(value) |
| 531 | 531 | .font(.system(.callout, design: .monospaced)) |
| @@ -580,7 +580,7 @@ struct WorkflowBulkAddSheet: View { | ||
| 580 | 580 | .foregroundStyle(.primary) |
| 581 | 581 | Spacer() |
| 582 | 582 | Image(systemName: selectedDomains.contains(domain) ? "checkmark.circle.fill" : "circle") |
| 583 | .foregroundStyle(selectedDomains.contains(domain) ? Color(.statusInfo) : .secondary) | |
| 583 | .foregroundStyle(selectedDomains.contains(domain) ? AnyShapeStyle(ThemeToken.info) : AnyShapeStyle(.secondary)) | |
| 584 | 584 | } |
| 585 | 585 | } |
| 586 | 586 | .buttonStyle(.plain) |
DomainDigTests/ThemeTests.swift added +130
| @@ -0,0 +1,130 @@ | ||
| 1 | import SwiftUI | |
| 2 | import XCTest | |
| 3 | @testable import DomainDig | |
| 4 | ||
| 5 | /// The palette moved from 483 asset-catalog call sites into a `Theme` carried | |
| 6 | /// in the environment (I1's sibling, W13). | |
| 7 | /// | |
| 8 | /// The one safety the move gave up is compile-time checking of the colour | |
| 9 | /// names: `ThemeToken.assetColor` looks them up by string, because the | |
| 10 | /// generated `ColorResource` symbols are MainActor-isolated and | |
| 11 | /// `ShapeStyle.resolve(in:)` is not. `testEveryTokenHasAColorset` and | |
| 12 | /// `testNoColorsetIsMissingAToken` are what replace it. | |
| 13 | final class ThemeTests: XCTestCase { | |
| 14 | ||
| 15 | /// The colorsets on disk, which are the palette's definition. | |
| 16 | private func colorsetNames() throws -> Set<String> { | |
| 17 | // The bundle under test is the app's, and the catalog is compiled into | |
| 18 | // it, so the names are read from the source tree instead. | |
| 19 | let root = URL(fileURLWithPath: #filePath) | |
| 20 | .deletingLastPathComponent() | |
| 21 | .deletingLastPathComponent() | |
| 22 | .appendingPathComponent("Shared/Colors.xcassets") | |
| 23 | let entries = try FileManager.default.contentsOfDirectory(atPath: root.path) | |
| 24 | return Set( | |
| 25 | entries | |
| 26 | .filter { $0.hasSuffix(".colorset") } | |
| 27 | .map { String($0.dropLast(".colorset".count)) } | |
| 28 | ) | |
| 29 | } | |
| 30 | ||
| 31 | func testEveryTokenHasAColorset() throws { | |
| 32 | let names = try colorsetNames() | |
| 33 | ||
| 34 | for token in ThemeToken.allCases { | |
| 35 | XCTAssertTrue( | |
| 36 | names.contains(token.rawValue), | |
| 37 | "\(token) names '\(token.rawValue)', which is not a colorset — it would render as a placeholder" | |
| 38 | ) | |
| 39 | } | |
| 40 | } | |
| 41 | ||
| 42 | /// The other direction: a colour added to the catalog without a token is | |
| 43 | /// unreachable through the theme, so it cannot be themed and nothing says | |
| 44 | /// so. | |
| 45 | func testNoColorsetIsMissingAToken() throws { | |
| 46 | let names = try colorsetNames() | |
| 47 | let tokens = Set(ThemeToken.allCases.map(\.rawValue)) | |
| 48 | ||
| 49 | XCTAssertEqual( | |
| 50 | names.subtracting(tokens), | |
| 51 | [], | |
| 52 | "these colorsets have no ThemeToken, so the theme cannot reach them" | |
| 53 | ) | |
| 54 | } | |
| 55 | ||
| 56 | // MARK: Defaults | |
| 57 | ||
| 58 | /// The default theme has to render exactly as the asset catalog did, or the | |
| 59 | /// refactor changed the app's appearance rather than only its plumbing. | |
| 60 | func testTheDefaultThemeResolvesEveryTokenFromTheCatalog() { | |
| 61 | let theme = Theme.default | |
| 62 | ||
| 63 | for token in ThemeToken.allCases { | |
| 64 | XCTAssertEqual(theme[token], token.assetColor, "\(token) should come straight from the catalog") | |
| 65 | } | |
| 66 | } | |
| 67 | ||
| 68 | func testAnEmptyOverrideSetIsTheDefault() { | |
| 69 | XCTAssertEqual(Theme(overrides: [:]), Theme.default) | |
| 70 | } | |
| 71 | ||
| 72 | // MARK: Accents | |
| 73 | ||
| 74 | func testTheDefaultAccentOverridesNothing() { | |
| 75 | XCTAssertEqual(AccentTheme.default.theme, Theme.default) | |
| 76 | } | |
| 77 | ||
| 78 | /// An accent changes the accent and nothing else. Letting it reach the | |
| 79 | /// status colours would undo the contrast work phases 1–5 of #21 did. | |
| 80 | func testAnAccentOverridesOnlyTheAccentTokens() { | |
| 81 | for accent in AccentTheme.allCases where accent != .default { | |
| 82 | let theme = accent.theme | |
| 83 | ||
| 84 | XCTAssertNotEqual(theme[.accent], ThemeToken.accent.assetColor, "\(accent) should change the accent") | |
| 85 | ||
| 86 | for token in ThemeToken.allCases where token != .accent && token != .onAccent { | |
| 87 | XCTAssertEqual( | |
| 88 | theme[token], | |
| 89 | token.assetColor, | |
| 90 | "\(accent) must leave \(token) alone" | |
| 91 | ) | |
| 92 | } | |
| 93 | } | |
| 94 | } | |
| 95 | ||
| 96 | func testEveryAccentHasATitle() { | |
| 97 | for accent in AccentTheme.allCases { | |
| 98 | XCTAssertFalse(accent.title.isEmpty) | |
| 99 | XCTAssertEqual(AccentTheme(rawValue: accent.rawValue), accent, "the stored value round-trips") | |
| 100 | } | |
| 101 | } | |
| 102 | ||
| 103 | /// Accent themes are Pro+ per D1. Pro+ takes `allCases`, so the check that | |
| 104 | /// matters is that the capability did not land in free or pro. | |
| 105 | func testAccentThemesArePrOPlusOnly() { | |
| 106 | XCTAssertFalse(FeatureAccessService.entitlements(for: .free).capabilities.contains(.accentTheme)) | |
| 107 | XCTAssertFalse(FeatureAccessService.entitlements(for: .pro).capabilities.contains(.accentTheme)) | |
| 108 | XCTAssertTrue(FeatureAccessService.entitlements(for: .proPlus).capabilities.contains(.accentTheme)) | |
| 109 | XCTAssertEqual(FeatureAccessService.upgradeMessage(for: .accentTheme), "Available in Pro+") | |
| 110 | } | |
| 111 | ||
| 112 | // MARK: Badge models carry tokens | |
| 113 | ||
| 114 | /// The badges are built outside a view body, which is why their colours are | |
| 115 | /// tokens rather than resolved values. | |
| 116 | func testStatusBadgesNameTokensRatherThanColors() { | |
| 117 | let registered = AppStatusFactory.availability(.registered) | |
| 118 | XCTAssertFalse(registered.title.isEmpty) | |
| 119 | ||
| 120 | // A token, so the theme resolves it at draw time. | |
| 121 | XCTAssertEqual(Theme.default[registered.foreground], registered.foreground.assetColor) | |
| 122 | XCTAssertEqual(Theme.default[registered.background], registered.background.assetColor) | |
| 123 | } | |
| 124 | ||
| 125 | func testEveryToneMapsToATokenPair() { | |
| 126 | for tone in [AppStatusTone.positive, .warning, .critical, .info, .neutral] { | |
| 127 | XCTAssertNotEqual(tone.foreground, tone.surface, "\(tone) should not use one colour for both") | |
| 128 | } | |
| 129 | } | |
| 130 | } | |