2020-07-02 22:30:50 +02:00
|
|
|
//
|
|
|
|
// ArticleModel.swift
|
|
|
|
// NetNewsWire
|
|
|
|
//
|
|
|
|
// Created by Maurice Parker on 7/2/20.
|
|
|
|
// Copyright © 2020 Ranchero Software. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import Foundation
|
|
|
|
|
|
|
|
import Foundation
|
|
|
|
import RSCore
|
|
|
|
import Account
|
|
|
|
import Articles
|
|
|
|
|
|
|
|
protocol ArticleModelDelegate: class {
|
2020-07-07 04:14:05 +02:00
|
|
|
#if os(iOS)
|
|
|
|
var webViewProvider: WebViewProvider? { get }
|
|
|
|
#endif
|
|
|
|
func findPrevArticle(_: ArticleModel, article: Article) -> Article?
|
|
|
|
func findNextArticle(_: ArticleModel, article: Article) -> Article?
|
|
|
|
func selectArticle(_: ArticleModel, article: Article)
|
2020-07-02 22:30:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
class ArticleModel: ObservableObject {
|
|
|
|
|
|
|
|
weak var delegate: ArticleModelDelegate?
|
|
|
|
|
2020-07-07 04:14:05 +02:00
|
|
|
#if os(iOS)
|
|
|
|
var webViewProvider: WebViewProvider? {
|
|
|
|
return delegate?.webViewProvider
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// MARK: API
|
|
|
|
|
|
|
|
func findPrevArticle(_ article: Article) -> Article? {
|
|
|
|
return delegate?.findPrevArticle(self, article: article)
|
|
|
|
}
|
|
|
|
|
|
|
|
func findNextArticle(_ article: Article) -> Article? {
|
|
|
|
return delegate?.findNextArticle(self, article: article)
|
|
|
|
}
|
|
|
|
|
|
|
|
func selectArticle(_ article: Article) {
|
|
|
|
delegate?.selectArticle(self, article: article)
|
|
|
|
}
|
|
|
|
|
2020-07-02 22:30:50 +02:00
|
|
|
}
|
|
|
|
|