mirror of
https://github.com/kiwix/kiwix-apple.git
synced 2025-09-27 05:49:25 -04:00
Pull Down refresh ago string
This commit is contained in:
parent
8714e2cf7d
commit
7b10fdfea9
@ -262,7 +262,7 @@ class CloudBooksController: UITableViewController, NSFetchedResultsControllerDel
|
|||||||
class RefreshLibControl: UIRefreshControl {
|
class RefreshLibControl: UIRefreshControl {
|
||||||
|
|
||||||
static let pullDownToRefresh = NSLocalizedString("Pull Down To Refresh", comment: "Refresh Library Control")
|
static let pullDownToRefresh = NSLocalizedString("Pull Down To Refresh", comment: "Refresh Library Control")
|
||||||
static let lastRefresh = NSLocalizedString("Last Refresh", comment: "Refresh Library Control")
|
static let lastRefresh = NSLocalizedString("Last Refresh: %@ ago", comment: "Refresh Library Control")
|
||||||
|
|
||||||
override var hidden: Bool {
|
override var hidden: Bool {
|
||||||
didSet {
|
didSet {
|
||||||
@ -274,9 +274,12 @@ class RefreshLibControl: UIRefreshControl {
|
|||||||
private func updateTitle() {
|
private func updateTitle() {
|
||||||
let string: String = {
|
let string: String = {
|
||||||
guard let lastRefreshTime = Preference.libraryLastRefreshTime else {return RefreshLibControl.pullDownToRefresh}
|
guard let lastRefreshTime = Preference.libraryLastRefreshTime else {return RefreshLibControl.pullDownToRefresh}
|
||||||
let formatter = NSDateFormatter()
|
let interval = lastRefreshTime.timeIntervalSinceNow * -1
|
||||||
formatter.dateFormat = "MMM d, h:mm a"
|
let formatter = NSDateComponentsFormatter()
|
||||||
return "Last Refresh" + ": " + formatter.stringFromDate(lastRefreshTime)
|
formatter.unitsStyle = .Abbreviated
|
||||||
|
formatter.allowedUnits = [.Day, .Hour, .Minute]
|
||||||
|
let string = formatter.stringFromTimeInterval(interval) ?? ""
|
||||||
|
return String(format: RefreshLibControl.lastRefresh, string)
|
||||||
}()
|
}()
|
||||||
let attributes = [NSForegroundColorAttributeName: UIColor.blackColor()]
|
let attributes = [NSForegroundColorAttributeName: UIColor.blackColor()]
|
||||||
attributedTitle = NSAttributedString(string: string, attributes: attributes)
|
attributedTitle = NSAttributedString(string: string, attributes: attributes)
|
||||||
|
@ -49,7 +49,7 @@
|
|||||||
</dict>
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>1.7.1486</string>
|
<string>1.7.1499</string>
|
||||||
<key>ITSAppUsesNonExemptEncryption</key>
|
<key>ITSAppUsesNonExemptEncryption</key>
|
||||||
<false/>
|
<false/>
|
||||||
<key>LSRequiresIPhoneOS</key>
|
<key>LSRequiresIPhoneOS</key>
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
<key>CFBundleSignature</key>
|
<key>CFBundleSignature</key>
|
||||||
<string>????</string>
|
<string>????</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>1.7.1839</string>
|
<string>1.7.1856</string>
|
||||||
<key>NSExtension</key>
|
<key>NSExtension</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>NSExtensionMainStoryboard</key>
|
<key>NSExtensionMainStoryboard</key>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user