This commit is contained in:
Chris Li 2016-11-25 11:47:47 -05:00
parent 0d4f09ec1d
commit 554cfdd293
6 changed files with 19 additions and 12 deletions

View File

@ -52,10 +52,9 @@ class DownloadTasksController: LibraryBaseController, UITableViewDelegate, UITab
guard let navController = segue.destination as? UINavigationController,
let bookDetailController = navController.topViewController as? BookDetailController,
let cell = sender as? UITableViewCell,
let indexPath = tableView.indexPath(for: cell),
let downloadTask = fetchedResultController.object(at: indexPath) as? DownloadTask,
let book = downloadTask.book else {return}
bookDetailController.book = book
let indexPath = tableView.indexPath(for: cell) else {return}
let downloadTask = fetchedResultController.object(at: indexPath)
bookDetailController.book = downloadTask.book
default:
break
}

View File

@ -43,6 +43,8 @@ class Buttons: LPTBarButtonItemDelegate {
delegate?.didLongPressBackButton()
case forward:
delegate?.didLongPressForwardButton()
case bookmark:
delegate?.didLongPressBookmarkButton()
default:
return
}

View File

@ -54,8 +54,8 @@ class SearchBooksController: SearchBaseTableController, UITableViewDelegate, UIT
// MARK: - Table Cell Delegate
func didTapOnAccessoryViewForCell(_ cell: UITableViewCell) {
guard let indexPath = tableView.indexPath(for: cell),
let book = fetchedResultController.object(at: indexPath) as? Book else {return}
guard let indexPath = tableView.indexPath(for: cell) else {return}
let book = fetchedResultController.object(at: indexPath)
book.includeInSearch = !book.includeInSearch
}
@ -77,8 +77,8 @@ class SearchBooksController: SearchBaseTableController, UITableViewDelegate, UIT
}
func configureCell(_ cell: UITableViewCell, atIndexPath indexPath: IndexPath) {
guard let book = fetchedResultController.object(at: indexPath) as? Book else {return}
guard let cell = cell as? CheckMarkBookCell else {return}
let book = fetchedResultController.object(at: indexPath)
cell.delegate = self
cell.titleLabel.text = book.title
@ -111,9 +111,9 @@ class SearchBooksController: SearchBaseTableController, UITableViewDelegate, UIT
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
guard let book = fetchedResultController.object(at: indexPath) as? Book else {return}
// let operation = ArticleLoadOperation(bookID: book.id)
// GlobalQueue.shared.add(load: operation)
let book = fetchedResultController.object(at: indexPath)
let operation = ArticleLoadOperation(bookID: book.id)
GlobalQueue.shared.add(articleLoadOperation: operation)
}
// MARK: - Fetched Result Controller Delegate

View File

@ -49,7 +49,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.8.3265</string>
<string>1.8.3277</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSRequiresIPhoneOS</key>

View File

@ -21,7 +21,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.8.3265</string>
<string>1.8.3277</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionMainStoryboard</key>

View File

@ -123,3 +123,9 @@ extension UIDevice {
}
}
extension Collection {
public subscript(safe index: Index) -> _Element? {
return index >= startIndex && index < endIndex ? self[index] : nil
}
}