This commit is contained in:
Vadim Bulavin 2017-11-08 17:04:07 +02:00
Родитель aac2ef09d1
Коммит 793a162867
3 изменённых файлов: 11 добавлений и 22 удалений

Просмотреть файл

@ -27,7 +27,7 @@ protocol FeedModuleInteractorOutput: class {
func didFetchMore(feed: Feed)
func didFail(error: Error)
func didStartFetching()
func didFinishFetching()
func didFinishFetching(with error: Error?)
func didPostAction(post: PostHandle, action: PostSocialAction, error: Error?)
}
@ -42,7 +42,7 @@ class FeedModuleInteractor: FeedModuleInteractorInput {
func handleFetch(result: FeedFetchResult, request: FeedFetchRequest) {
defer {
output.didFinishFetching()
output.didFinishFetching(with: result.error)
}
let isLoadingMore = request.cursor != nil

Просмотреть файл

@ -42,7 +42,6 @@ extension FeedModuleOutput {
func didScrollFeed(_ feedView: UIScrollView) { }
func didStartRefreshingData() { }
func didFinishRefreshingData(_ error: Error?) { }
func didUpdateFeed() { }
func commentsPressed() { }
func postRemoved() { }
@ -149,6 +148,7 @@ enum FeedModuleLayoutType: Int {
class FeedModulePresenter: FeedModuleInput, FeedModuleViewOutput, FeedModuleInteractorOutput, PostViewModelActionsProtocol {
weak var view: FeedModuleViewInput!
var interactor: FeedModuleInteractorInput!
var router: FeedModuleRouterInput!
@ -238,6 +238,11 @@ class FeedModulePresenter: FeedModuleInput, FeedModuleViewOutput, FeedModuleInte
private func onFeedTypeChange() {
Logger.log(self.feedType)
if let feedType = feedType, case .search = feedType {
updateUI(with: [])
}
if isViewReady {
view.resetFocus()
fetchAllItems()
@ -547,17 +552,13 @@ class FeedModulePresenter: FeedModuleInput, FeedModuleViewOutput, FeedModuleInte
func didStartFetching() {
Logger.log()
view.setRefreshing(state: true)
if let delegate = moduleOutput {
delegate.didStartRefreshingData()
}
moduleOutput?.didStartRefreshingData()
}
func didFinishFetching() {
func didFinishFetching(with error: Error?) {
Logger.log()
view.setRefreshing(state: false)
if let delegate = moduleOutput {
delegate.didFinishRefreshingData(nil)
}
moduleOutput?.didFinishRefreshingData(error)
}
func registerHeader<T: UICollectionReusableView>(withType type: T.Type,

Просмотреть файл

@ -192,18 +192,6 @@ extension PostDetailPresenter: CommentCellModuleOutout {
}
extension PostDetailPresenter: FeedModuleOutput {
func didFinishRefreshingData() {
view.refreshPostCell()
feedModuleInput?.lockScrolling()
}
func didScrollFeed(_ feedView: UIScrollView) {
print("feed did scroll in PostDetailPresenter")
}
func didStartRefreshingData() {
print("didStartRefreshingData in PostDetailPresenter")
}
func didFinishRefreshingData(_ error: Error?) {
view.refreshPostCell()