mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
• An extenison has been added to `AccountType` for iconColors (which have been added to the asset catalogs) and localised account names. SPM can handle resources so it might make sense to move to there. • Add Account screen now has sections for local, icloud, web, and self-hosted, icons are now tinted and sized a bit smaller, and text is now `body` sized.
122 lines
3.0 KiB
Swift
122 lines
3.0 KiB
Swift
//
|
|
// AccountType+Helpers.swift
|
|
// NetNewsWire
|
|
//
|
|
// Created by Stuart Breckenridge on 27/10/20.
|
|
// Copyright © 2020 Ranchero Software. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
import Account
|
|
#if os(macOS)
|
|
import AppKit
|
|
#else
|
|
import UIKit
|
|
#endif
|
|
|
|
extension AccountType {
|
|
|
|
// TODO: Move this to the Account Package.
|
|
// Colors
|
|
|
|
#if os(macOS)
|
|
func iconColor() -> NSColor {
|
|
switch self {
|
|
case .onMyMac:
|
|
return NSColor(named: "localColor")!
|
|
case .bazQux:
|
|
return NSColor(named: "bazquxColor")!
|
|
case .cloudKit:
|
|
return NSColor(named: "cloudkitColor")!
|
|
case .feedWrangler:
|
|
return NSColor(named: "feedwranglerColor")!
|
|
case .feedbin:
|
|
return NSColor(named: "feedbinColor")!
|
|
case .feedly:
|
|
return NSColor(named: "feedlyColor")!
|
|
case .freshRSS:
|
|
return NSColor(named: "freshRSSColor")!
|
|
case .inoreader:
|
|
return NSColor(named: "inoreaderColor")!
|
|
case .newsBlur:
|
|
return NSColor(named: "newsblurColor")!
|
|
case .theOldReader:
|
|
return NSColor(named: "theoldreaderColor")!
|
|
default:
|
|
return NSColor.blue
|
|
}
|
|
}
|
|
#else
|
|
func iconColor() -> UIColor {
|
|
switch self {
|
|
case .onMyMac:
|
|
return UIColor(named: "localColor")!
|
|
case .bazQux:
|
|
return UIColor(named: "bazquxColor")!
|
|
case .cloudKit:
|
|
return UIColor(named: "cloudkitColor")!
|
|
case .feedWrangler:
|
|
return UIColor(named: "feedwranglerColor")!
|
|
case .feedbin:
|
|
return UIColor(named: "feedbinColor")!
|
|
case .feedly:
|
|
return UIColor(named: "feedlyColor")!
|
|
case .freshRSS:
|
|
return UIColor(named: "freshRSSColor")!
|
|
case .inoreader:
|
|
return UIColor(named: "inoreaderColor")!
|
|
case .newsBlur:
|
|
return UIColor(named: "newsblurColor")!
|
|
case .theOldReader:
|
|
return UIColor(named: "theoldreaderColor")!
|
|
default:
|
|
return UIColor.blue
|
|
}
|
|
}
|
|
#endif
|
|
|
|
func localizedAccountName() -> String {
|
|
|
|
switch self {
|
|
case .onMyMac:
|
|
let defaultName: String
|
|
#if os(macOS)
|
|
defaultName = NSLocalizedString("On My Mac", comment: "Account name")
|
|
#else
|
|
if UIDevice.current.userInterfaceIdiom == .pad {
|
|
defaultName = NSLocalizedString("On My iPad", comment: "Account name")
|
|
} else {
|
|
defaultName = NSLocalizedString("On My iPhone", comment: "Account name")
|
|
}
|
|
#endif
|
|
return defaultName
|
|
case .bazQux:
|
|
return NSLocalizedString("BazQux", comment: "Account name")
|
|
case .cloudKit:
|
|
return NSLocalizedString("iCloud", comment: "Account name")
|
|
case .feedWrangler:
|
|
return NSLocalizedString("FeedWrangler", comment: "Account name")
|
|
case .feedbin:
|
|
return NSLocalizedString("Feedbin", comment: "Account name")
|
|
case .feedly:
|
|
return NSLocalizedString("Feedly", comment: "Account name")
|
|
case .freshRSS:
|
|
return NSLocalizedString("FreshRSS", comment: "Account name")
|
|
case .inoreader:
|
|
return NSLocalizedString("Inoreader", comment: "Account name")
|
|
case .newsBlur:
|
|
return NSLocalizedString("NewsBlur", comment: "Account name")
|
|
case .theOldReader:
|
|
return NSLocalizedString("The Old Reader", comment: "Account name")
|
|
default:
|
|
return ""
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|