Skip to content

Commit

Permalink
Extract didLoadNewsInWebViewWithNewsId in RealmNewsViewController,
Browse files Browse the repository at this point in the history
  • Loading branch information
NicholasTD07 authored and NicholasTD07 committed Jul 14, 2015
1 parent 490689c commit 2b8353d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions SwiftDaily-ZhiHu/Controllers/RealmNewsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,18 @@ extension RealmNewsViewController {

if let news = store.newsWithId(newsId) {
loadNews(news)
loadedNewsId = newsId
preferences.lastReadNewsId = newsId
didLoadNewsInWebViewWithNewsId(newsId)
} else {
activityIndicator.startAnimating()
store.news(newsId)
}
}

private func didLoadNewsInWebViewWithNewsId(newsId: Int) {
loadedNewsId = newsId
preferences.lastReadNewsId = newsId
}

// TODO: Use protocol
private func loadNews(news: NewsObject) {
let css = news.cssURLStrings.map { "<link rel='stylesheet' type='text/css' href='\($0.value)'>" }
Expand Down

0 comments on commit 2b8353d

Please sign in to comment.