diff --git a/Shared/AccountType+Helpers.swift b/Shared/AccountType+Helpers.swift index 3fd1b2daf..898397241 100644 --- a/Shared/AccountType+Helpers.swift +++ b/Shared/AccountType+Helpers.swift @@ -68,6 +68,29 @@ extension AccountType { return .systemPink } } + #else + var logColor: Color { + switch self { + case .onMyMac: + return .secondary + case .cloudKit: + return .purple + case .feedly: + return .green + case .feedbin: + return .blue + case .newsBlur: + return .orange + case .freshRSS: + return .teal + case .inoreader: + return .brown + case .bazQux: + return .indigo + case .theOldReader: + return .pink + } + } #endif // MARK: - SwiftUI Images diff --git a/iOS/Settings/ErrorLogView.swift b/iOS/Settings/ErrorLogView.swift index a8b787f89..09e7a197a 100644 --- a/iOS/Settings/ErrorLogView.swift +++ b/iOS/Settings/ErrorLogView.swift @@ -97,7 +97,7 @@ private extension ErrorLogView { sourceString = "\(entry.sourceName) — \(entry.operation): " } var source = AttributedString(sourceString) - source.foregroundColor = color(for: entry.sourceID) + source.foregroundColor = AccountType(rawValue: entry.sourceID)?.logColor ?? .secondary source.font = .system(.body, design: .monospaced).weight(.medium) var message = AttributedString(entry.errorMessage) @@ -135,33 +135,6 @@ private extension ErrorLogView { return result } - func color(for sourceID: Int) -> Color { - guard let type = AccountType(rawValue: sourceID) else { - return .secondary - } - - switch type { - case .onMyMac: - return .secondary - case .cloudKit: - return .purple - case .feedly: - return .green - case .feedbin: - return .blue - case .newsBlur: - return .orange - case .freshRSS: - return .teal - case .inoreader: - return .brown - case .bazQux: - return .indigo - case .theOldReader: - return .pink - } - } - func errorLogEntry(from notification: Notification) -> ErrorLogEntry? { guard let errorMessage = notification.userInfo?[ErrorLogUserInfoKey.errorMessage] as? String, let sourceName = notification.userInfo?[ErrorLogUserInfoKey.sourceName] as? String,