From 72e22c1ff2fcc02a6dfc168de53262b98b71703c Mon Sep 17 00:00:00 2001 From: Chris Li Date: Sat, 26 Nov 2016 18:43:18 -0500 Subject: [PATCH] commit --- .../Others/CoreDataTableBaseController.swift | 1 + .../Search/SearchBaseController.swift | 4 +- .../Search/SearchBooksController.swift | 43 +------------------ Kiwix-iOS/Info.plist | 2 +- Kiwix-iOSWidgets/Bookmarks/Info.plist | 2 +- 5 files changed, 7 insertions(+), 45 deletions(-) diff --git a/Kiwix-iOS/Controller/Others/CoreDataTableBaseController.swift b/Kiwix-iOS/Controller/Others/CoreDataTableBaseController.swift index 4ec1294d..cf36fb70 100644 --- a/Kiwix-iOS/Controller/Others/CoreDataTableBaseController.swift +++ b/Kiwix-iOS/Controller/Others/CoreDataTableBaseController.swift @@ -14,6 +14,7 @@ import CoreData Yes, I know it'd be better to make this into a protocol. But unfortunately, UIKit cannot seems to be able to recognize default protocol implementation in Swift. (iOS 10.1) + More spedifically, protocol extension is a swift only feature and is not visible to objc_msgSend() */ class CoreDataTableBaseController: UIViewController, NSFetchedResultsControllerDelegate { diff --git a/Kiwix-iOS/Controller/Search/SearchBaseController.swift b/Kiwix-iOS/Controller/Search/SearchBaseController.swift index 1c204a17..9e77dd72 100644 --- a/Kiwix-iOS/Controller/Search/SearchBaseController.swift +++ b/Kiwix-iOS/Controller/Search/SearchBaseController.swift @@ -20,8 +20,8 @@ import DZNEmptyDataSet when keyboard shows / hides */ -class SearchBaseTableController: UIViewController, DZNEmptyDataSetSource, DZNEmptyDataSetDelegate { - @IBOutlet weak var tableView: UITableView! +class SearchBaseTableController: CoreDataTableBaseController, DZNEmptyDataSetSource, DZNEmptyDataSetDelegate { +// @IBOutlet weak var tableView: UITableView! override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) diff --git a/Kiwix-iOS/Controller/Search/SearchBooksController.swift b/Kiwix-iOS/Controller/Search/SearchBooksController.swift index ea82d789..d43db2b7 100644 --- a/Kiwix-iOS/Controller/Search/SearchBooksController.swift +++ b/Kiwix-iOS/Controller/Search/SearchBooksController.swift @@ -10,7 +10,7 @@ import UIKit import CoreData import DZNEmptyDataSet -class SearchBooksController: SearchBaseTableController, UITableViewDelegate, UITableViewDataSource, NSFetchedResultsControllerDelegate, TableCellDelegate { +class SearchBooksController: SearchBaseTableController, UITableViewDelegate, UITableViewDataSource, TableCellDelegate { @IBOutlet weak var recentSearchContainer: DropShadowView! @IBOutlet weak var recentSearchBarHeight: NSLayoutConstraint! @@ -61,7 +61,7 @@ class SearchBooksController: SearchBaseTableController, UITableViewDelegate, UIT return cell } - func configureCell(_ cell: UITableViewCell, atIndexPath indexPath: IndexPath) { + override func configureCell(_ cell: UITableViewCell, atIndexPath indexPath: IndexPath) { guard let cell = cell as? CheckMarkBookCell else {return} let book = fetchedResultController.object(at: indexPath) @@ -101,45 +101,6 @@ class SearchBooksController: SearchBaseTableController, UITableViewDelegate, UIT GlobalQueue.shared.add(articleLoadOperation: operation) } - // MARK: - Fetched Result Controller Delegate - - func controllerWillChangeContent(_ controller: NSFetchedResultsController) { - tableView.beginUpdates() - } - - func controller(_ controller: NSFetchedResultsController, didChange sectionInfo: NSFetchedResultsSectionInfo, atSectionIndex sectionIndex: Int, for type: NSFetchedResultsChangeType) { - switch type { - case .insert: - tableView.insertSections(IndexSet(integer: sectionIndex), with: .fade) - case .delete: - tableView.deleteSections(IndexSet(integer: sectionIndex), with: .fade) - default: - return - } - } - - func controller(_ controller: NSFetchedResultsController, didChange anObject: Any, at indexPath: IndexPath?, for type: NSFetchedResultsChangeType, newIndexPath: IndexPath?) { - switch type { - case .insert: - guard let newIndexPath = newIndexPath else {return} - tableView.insertRows(at: [newIndexPath], with: .fade) - case .delete: - guard let indexPath = indexPath else {return} - tableView.deleteRows(at: [indexPath], with: .fade) - case .update: - guard let indexPath = indexPath, let cell = tableView.cellForRow(at: indexPath) else {return} - configureCell(cell, atIndexPath: indexPath) - case .move: - guard let indexPath = indexPath, let newIndexPath = newIndexPath else {return} - tableView.deleteRows(at: [indexPath], with: .fade) - tableView.insertRows(at: [newIndexPath], with: .fade) - } - } - - func controllerDidChangeContent(_ controller: NSFetchedResultsController) { - tableView.endUpdates() - } - // MARK: - DZNEmptyDataSet func titleForEmptyDataSet(_ scrollView: UIScrollView!) -> NSAttributedString! { diff --git a/Kiwix-iOS/Info.plist b/Kiwix-iOS/Info.plist index c03e74f4..fe14efc1 100644 --- a/Kiwix-iOS/Info.plist +++ b/Kiwix-iOS/Info.plist @@ -49,7 +49,7 @@ CFBundleVersion - 1.8.3347 + 1.8.3350 ITSAppUsesNonExemptEncryption LSRequiresIPhoneOS diff --git a/Kiwix-iOSWidgets/Bookmarks/Info.plist b/Kiwix-iOSWidgets/Bookmarks/Info.plist index eca33a52..94996226 100644 --- a/Kiwix-iOSWidgets/Bookmarks/Info.plist +++ b/Kiwix-iOSWidgets/Bookmarks/Info.plist @@ -21,7 +21,7 @@ CFBundleSignature ???? CFBundleVersion - 1.8.3347 + 1.8.3350 NSExtension NSExtensionMainStoryboard