diff --git a/Kiwix-iOS/Controller/Library/CloudBooksController.swift b/Kiwix-iOS/Controller/Library/CloudBooksController.swift
index 8aa456db..00400bb3 100644
--- a/Kiwix-iOS/Controller/Library/CloudBooksController.swift
+++ b/Kiwix-iOS/Controller/Library/CloudBooksController.swift
@@ -37,6 +37,7 @@ class CloudBooksController: UITableViewController, NSFetchedResultsControllerDel
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
tabBarController?.navigationItem.rightBarButtonItem = UIBarButtonItem(imageNamed: "LanguageFilter", target: self, action: #selector(CloudBooksController.showLanguageFilter))
+ refreshAutomatically()
}
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
@@ -75,6 +76,15 @@ class CloudBooksController: UITableViewController, NSFetchedResultsControllerDel
tableView.deselectRowAtIndexPath(indexPath, animated: true)
}
+ func refreshAutomatically() {
+ guard let date = Preference.libraryLastRefreshTime else {
+ refresh()
+ return
+ }
+ guard date.timeIntervalSinceNow < -86400 else {return}
+ refresh()
+ }
+
func refresh() {
let operation = RefreshLibraryOperation()
operation.addObserver(DidFinishObserver { (operation, errors) in
diff --git a/Kiwix-iOS/Controller/Library/DownloadTasksController.swift b/Kiwix-iOS/Controller/Library/DownloadTasksController.swift
index 7a90ddba..8ec26b2a 100644
--- a/Kiwix-iOS/Controller/Library/DownloadTasksController.swift
+++ b/Kiwix-iOS/Controller/Library/DownloadTasksController.swift
@@ -103,6 +103,7 @@ class DownloadTasksController: UITableViewController, NSFetchedResultsController
cell.favIcon.image = UIImage(data: book.favIcon ?? NSData())
guard let progress = Network.shared.operations[id]?.progress else {return}
+ cell.progressLabel.text = progress.fractionCompletedDescription
cell.progressView.setProgress(Float(progress.fractionCompleted), animated: animated)
cell.detailLabel.text = progress.localizedAdditionalDescription.stringByReplacingOccurrencesOfString(" – ", withString: "\n")
}
diff --git a/Kiwix-iOS/Info.plist b/Kiwix-iOS/Info.plist
index 2a75431c..b70e77b5 100644
--- a/Kiwix-iOS/Info.plist
+++ b/Kiwix-iOS/Info.plist
@@ -49,7 +49,7 @@
CFBundleVersion
- 1.7.1431
+ 1.7.1441
ITSAppUsesNonExemptEncryption
LSRequiresIPhoneOS
diff --git a/Kiwix-iOS/Storyboard/Library.storyboard b/Kiwix-iOS/Storyboard/Library.storyboard
index 8db82d1c..467e1a46 100644
--- a/Kiwix-iOS/Storyboard/Library.storyboard
+++ b/Kiwix-iOS/Storyboard/Library.storyboard
@@ -469,11 +469,11 @@
-
-
+
+
-
+
+
+
-
+
+
+
+
-
-
+
+
diff --git a/Kiwix-iOS/View/TableViewCells.swift b/Kiwix-iOS/View/TableViewCells.swift
index 5555e44e..33061cc1 100644
--- a/Kiwix-iOS/View/TableViewCells.swift
+++ b/Kiwix-iOS/View/TableViewCells.swift
@@ -76,13 +76,10 @@ class CheckMarkBookCell: BasicBookCell {
/* Book Cell With progress bar and 2 line detail label */
class DownloadBookCell: UITableViewCell {
@IBOutlet weak var favIcon: UIImageView!
-
@IBOutlet weak var titleLabel: UILabel!
-
- @IBOutlet weak var progressView: UIProgressView!
-
@IBOutlet weak var detailLabel: UILabel!
-
+ @IBOutlet weak var progressLabel: UILabel!
+ @IBOutlet weak var progressView: UIProgressView!
}
// MARK: - Article Cell
diff --git a/Kiwix-iOSWidgets/Bookmarks/Info.plist b/Kiwix-iOSWidgets/Bookmarks/Info.plist
index 89222eec..3f889d70 100644
--- a/Kiwix-iOSWidgets/Bookmarks/Info.plist
+++ b/Kiwix-iOSWidgets/Bookmarks/Info.plist
@@ -21,7 +21,7 @@
CFBundleSignature
????
CFBundleVersion
- 1.7.1755
+ 1.7.1771
NSExtension
NSExtensionMainStoryboard
diff --git a/Kiwix/Operations/BookOperation.swift b/Kiwix/Operations/BookOperation.swift
index 69917a57..c0566a30 100644
--- a/Kiwix/Operations/BookOperation.swift
+++ b/Kiwix/Operations/BookOperation.swift
@@ -47,6 +47,29 @@ class DownloadBookOperation: URLSessionDownloadTaskOperation {
}
+class DownloadProgress: NSProgress {
+ init(completedUnitCount: Int64, totalUnitCount: Int64) {
+ super.init(parent: nil, userInfo: [NSProgressFileOperationKindKey: NSProgressFileOperationKindDownloading])
+ self.kind = NSProgressKindFile
+ self.totalUnitCount = totalUnitCount
+ self.completedUnitCount = completedUnitCount
+ }
+
+ private lazy var percentFormatter: NSNumberFormatter = {
+ let formatter = NSNumberFormatter()
+ formatter.numberStyle = .PercentStyle
+ formatter.minimumFractionDigits = 1
+ formatter.maximumIntegerDigits = 3
+ formatter.minimumFractionDigits = 2
+ formatter.maximumIntegerDigits = 2
+ return formatter
+ }()
+
+ var fractionCompletedDescription: String? {
+ return percentFormatter.stringFromNumber(NSNumber(double: fractionCompleted))
+ }
+}
+
class CancelBookDownloadOperation: Operation {
let bookID: String
@@ -75,11 +98,15 @@ class CancelBookDownloadOperation: Operation {
}
}
-class DownloadProgress: NSProgress {
- init(completedUnitCount: Int64, totalUnitCount: Int64) {
- super.init(parent: nil, userInfo: [NSProgressFileOperationKindKey: NSProgressFileOperationKindDownloading])
- self.kind = NSProgressKindFile
- self.totalUnitCount = totalUnitCount
- self.completedUnitCount = completedUnitCount
+class DeleteBookOperation: Operation {
+
+ let bookID: String
+
+ init(bookID: String) {
+ self.bookID = bookID
+ super.init()
}
+
+
}
+