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-11-06 01:05:57 +01:00
|
|
|
var smallIcon: IconImage? { get }
|
2017-12-17 19:48:55 +01:00
|
|
|
}
|
2018-02-18 06:08:36 +01:00
|
|
|
|
2019-11-16 19:02:58 +01:00
|
|
|
extension Account: SmallIconProvider {
|
|
|
|
var smallIcon: IconImage? {
|
|
|
|
if let image = AppAssets.image(for: type) {
|
|
|
|
return IconImage(image)
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-15 03:11:41 +01:00
|
|
|
extension WebFeed: SmallIconProvider {
|
2018-02-18 06:08:36 +01:00
|
|
|
|
2019-11-06 01:05:57 +01:00
|
|
|
var smallIcon: IconImage? {
|
|
|
|
if let iconImage = appDelegate.faviconDownloader.favicon(for: self) {
|
|
|
|
return iconImage
|
2018-02-18 06:08:36 +01:00
|
|
|
}
|
2019-04-29 14:07:57 +02:00
|
|
|
return FaviconGenerator.favicon(self)
|
2018-02-18 06:08:36 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
extension Folder: SmallIconProvider {
|
2019-11-06 01:05:57 +01:00
|
|
|
var smallIcon: IconImage? {
|
|
|
|
AppAssets.masterFolderImage
|
2018-02-18 06:08:36 +01:00
|
|
|
}
|
|
|
|
}
|