From f0f4f42442d1d301093d2769fc282eb91983df15 Mon Sep 17 00:00:00 2001 From: Chris Li Date: Mon, 26 Sep 2016 11:56:06 -0400 Subject: [PATCH] commit --- .../Controller/Library/BookDetailController.swift | 13 +++++++++---- .../Controller/Library/LocalBooksController.swift | 5 +++-- Kiwix-iOS/Info.plist | 2 +- Kiwix-iOSWidgets/Bookmarks/Info.plist | 2 +- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/Kiwix-iOS/Controller/Library/BookDetailController.swift b/Kiwix-iOS/Controller/Library/BookDetailController.swift index f6383bae..d39a8c04 100644 --- a/Kiwix-iOS/Controller/Library/BookDetailController.swift +++ b/Kiwix-iOS/Controller/Library/BookDetailController.swift @@ -44,12 +44,12 @@ class BookDetailController: UITableViewController, DZNEmptyDataSetSource, DZNEmp override func viewWillAppear(animated: Bool) { super.viewWillAppear(animated) configureViews() - book?.addObserver(self, forKeyPath: "isLocal", options: .New, context: context) + book?.addObserver(self, forKeyPath: "stateRaw", options: .New, context: context) } override func viewWillDisappear(animated: Bool) { super.viewWillDisappear(animated) - book?.removeObserver(self, forKeyPath: "isLocal", context: context) + book?.removeObserver(self, forKeyPath: "stateRaw", context: context) } override func observeValueForKeyPath(keyPath: String?, ofObject object: AnyObject?, change: [String : AnyObject]?, context: UnsafeMutablePointer) { @@ -95,8 +95,12 @@ class BookDetailController: UITableViewController, DZNEmptyDataSetSource, DZNEmp } switch book.state { - case .Cloud: - cellTitles[1] = book.spaceState == .NotEnough ? [LocalizedStrings.spaceNotEnough] : [LocalizedStrings.download] + case .Cloud, .Retained: + if let _ = book.meta4URL { + cellTitles[1] = book.spaceState == .NotEnough ? [LocalizedStrings.spaceNotEnough] : [LocalizedStrings.download] + } else { + cellTitles[1] = [LocalizedStrings.addUsingiTunesFileSharing] + } case .Downloading: cellTitles[1] = [LocalizedStrings.downloading] case .Local: @@ -257,6 +261,7 @@ class BookDetailController: UITableViewController, DZNEmptyDataSetSource, DZNEmp static let downloading = NSLocalizedString("Downloading", comment: comment) static let spaceNotEnough = NSLocalizedString("Space Not Enough", comment: comment) static let remove = NSLocalizedString("Remove", comment: comment) + static let addUsingiTunesFileSharing = NSLocalizedString("Add using iTunes File Sharing", comment: comment) // static let pause = NSLocalizedString("Pause", comment: comment) // static let resume = NSLocalizedString("Resume", comment: comment) // static let cancel = NSLocalizedString("Cancel", comment: comment) diff --git a/Kiwix-iOS/Controller/Library/LocalBooksController.swift b/Kiwix-iOS/Controller/Library/LocalBooksController.swift index 69d44b54..000481be 100644 --- a/Kiwix-iOS/Controller/Library/LocalBooksController.swift +++ b/Kiwix-iOS/Controller/Library/LocalBooksController.swift @@ -71,7 +71,7 @@ class LocalBooksController: UITableViewController, NSFetchedResultsControllerDel override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) - self.configureCell(cell, atIndexPath: indexPath) + configureCell(cell, atIndexPath: indexPath) return cell } @@ -105,7 +105,8 @@ class LocalBooksController: UITableViewController, NSFetchedResultsControllerDel // MARK: - Table View Delegate override func tableView(tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { - return 20.0 + guard let stateRaw = fetchedResultController.sections?[section].name else {return 0.0} + return (section == 0 && stateRaw == "2") ? 0.0 : 20.0 } override func tableView(tableView: UITableView, willDisplayHeaderView view: UIView, forSection section: Int) { diff --git a/Kiwix-iOS/Info.plist b/Kiwix-iOS/Info.plist index 6c7d8c31..c3678e90 100644 --- a/Kiwix-iOS/Info.plist +++ b/Kiwix-iOS/Info.plist @@ -49,7 +49,7 @@ CFBundleVersion - 1.8.1089 + 1.8.1094 ITSAppUsesNonExemptEncryption LSRequiresIPhoneOS diff --git a/Kiwix-iOSWidgets/Bookmarks/Info.plist b/Kiwix-iOSWidgets/Bookmarks/Info.plist index 85f38a4e..74ac6be0 100644 --- a/Kiwix-iOSWidgets/Bookmarks/Info.plist +++ b/Kiwix-iOSWidgets/Bookmarks/Info.plist @@ -21,7 +21,7 @@ CFBundleSignature ???? CFBundleVersion - 1.8.1093 + 1.8.1098 NSExtension NSExtensionMainStoryboard