2017-12-17 19:48:55 +01:00
|
|
|
//
|
|
|
|
// SmallIconProvider.swift
|
2018-08-29 07:18:24 +02:00
|
|
|
// NetNewsWire
|
2017-12-17 19:48:55 +01:00
|
|
|
//
|
|
|
|
// Created by Brent Simmons on 12/16/17.
|
|
|
|
// Copyright © 2017 Ranchero Software. All rights reserved.
|
|
|
|
//
|
|
|
|
|
2019-04-15 22:03:05 +02:00
|
|
|
import Foundation
|
2018-07-24 03:29:08 +02:00
|
|
|
import Articles
|
2018-02-18 06:08:36 +01:00
|
|
|
import Account
|
2019-04-15 22:03:05 +02:00
|
|
|
import RSCore
|
2017-12-17 19:48:55 +01:00
|
|
|
|
|
|
|
protocol SmallIconProvider {
|
|
|
|
|
2019-04-15 22:03:05 +02:00
|
|
|
var smallIcon: RSImage? { get }
|
2017-12-17 19:48:55 +01:00
|
|
|
}
|
2018-02-18 06:08:36 +01:00
|
|
|
|
|
|
|
extension Feed: SmallIconProvider {
|
|
|
|
|
2019-04-15 22:03:05 +02:00
|
|
|
var smallIcon: RSImage? {
|
2018-02-18 06:08:36 +01:00
|
|
|
if let image = appDelegate.faviconDownloader.favicon(for: self) {
|
|
|
|
return image
|
|
|
|
}
|
2019-04-15 22:03:05 +02:00
|
|
|
#if os(macOS)
|
2018-02-18 06:08:36 +01:00
|
|
|
return AppImages.genericFeedImage
|
2019-04-15 22:03:05 +02:00
|
|
|
#else
|
|
|
|
return AppAssets.feedImage
|
|
|
|
#endif
|
2018-02-18 06:08:36 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
extension Folder: SmallIconProvider {
|
|
|
|
|
2019-04-15 22:03:05 +02:00
|
|
|
var smallIcon: RSImage? {
|
|
|
|
#if os(macOS)
|
|
|
|
return RSImage(named: NSImage.folderName)
|
|
|
|
#else
|
|
|
|
return AppAssets.masterFolderImage
|
|
|
|
#endif
|
2018-02-18 06:08:36 +01:00
|
|
|
}
|
|
|
|
}
|