This commit is contained in:
Chris Li 2016-09-26 11:56:06 -04:00
parent bd17336c8f
commit f0f4f42442
4 changed files with 14 additions and 8 deletions

View File

@ -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<Void>) {
@ -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)

View File

@ -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) {

View File

@ -49,7 +49,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.8.1089</string>
<string>1.8.1094</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.1093</string>
<string>1.8.1098</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionMainStoryboard</key>