2017-12-17 10:48:55 -08:00
|
|
|
//
|
|
|
|
// SmallIconProvider.swift
|
2018-08-28 22:18:24 -07:00
|
|
|
// NetNewsWire
|
2017-12-17 10:48:55 -08:00
|
|
|
//
|
|
|
|
// Created by Brent Simmons on 12/16/17.
|
|
|
|
// Copyright © 2017 Ranchero Software. All rights reserved.
|
|
|
|
//
|
|
|
|
|
2019-04-15 15:03:05 -05:00
|
|
|
import Foundation
|
2018-07-23 18:29:08 -07:00
|
|
|
import Articles
|
2018-02-17 21:08:36 -08:00
|
|
|
import Account
|
2019-04-15 15:03:05 -05:00
|
|
|
import RSCore
|
2017-12-17 10:48:55 -08:00
|
|
|
|
|
|
|
protocol SmallIconProvider {
|
|
|
|
|
2019-11-05 18:05:57 -06:00
|
|
|
var smallIcon: IconImage? { get }
|
2017-12-17 10:48:55 -08:00
|
|
|
}
|
2018-02-17 21:08:36 -08:00
|
|
|
|
2019-11-16 12:02:58 -06:00
|
|
|
extension Account: SmallIconProvider {
|
|
|
|
var smallIcon: IconImage? {
|
|
|
|
if let image = AppAssets.image(for: type) {
|
|
|
|
return IconImage(image)
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-14 20:11:41 -06:00
|
|
|
extension WebFeed: SmallIconProvider {
|
2018-02-17 21:08:36 -08:00
|
|
|
|
2019-11-05 18:05:57 -06:00
|
|
|
var smallIcon: IconImage? {
|
|
|
|
if let iconImage = appDelegate.faviconDownloader.favicon(for: self) {
|
|
|
|
return iconImage
|
2018-02-17 21:08:36 -08:00
|
|
|
}
|
2019-04-29 07:07:57 -05:00
|
|
|
return FaviconGenerator.favicon(self)
|
2018-02-17 21:08:36 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
extension Folder: SmallIconProvider {
|
2019-11-05 18:05:57 -06:00
|
|
|
var smallIcon: IconImage? {
|
|
|
|
AppAssets.masterFolderImage
|
2018-02-17 21:08:36 -08:00
|
|
|
}
|
|
|
|
}
|