mirror of
https://github.com/kiwix/kiwix-apple.git
synced 2025-09-28 14:35:03 -04:00
TabBarBadgeCount
This commit is contained in:
parent
4ff054f0e5
commit
8714e2cf7d
@ -22,6 +22,7 @@ class DownloadTasksController: UITableViewController, NSFetchedResultsController
|
|||||||
tabBarItem.title = LocalizedStrings.LibraryTabTitle.download
|
tabBarItem.title = LocalizedStrings.LibraryTabTitle.download
|
||||||
tabBarItem.image = UIImage(named: "Download")
|
tabBarItem.image = UIImage(named: "Download")
|
||||||
tabBarItem.selectedImage = UIImage(named: "DownloadFilled")
|
tabBarItem.selectedImage = UIImage(named: "DownloadFilled")
|
||||||
|
refreshTabBarBadgeCount()
|
||||||
}
|
}
|
||||||
|
|
||||||
override func viewDidLoad() {
|
override func viewDidLoad() {
|
||||||
@ -77,6 +78,11 @@ class DownloadTasksController: UITableViewController, NSFetchedResultsController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func refreshTabBarBadgeCount() {
|
||||||
|
guard let count = fetchedResultController.fetchedObjects?.count else {return}
|
||||||
|
tabBarItem.badgeValue = count > 0 ? "\(count)" : nil
|
||||||
|
}
|
||||||
|
|
||||||
// MARK: - TableView Data Source
|
// MARK: - TableView Data Source
|
||||||
|
|
||||||
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
|
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
|
||||||
@ -214,6 +220,7 @@ class DownloadTasksController: UITableViewController, NSFetchedResultsController
|
|||||||
|
|
||||||
func controllerDidChangeContent(controller: NSFetchedResultsController) {
|
func controllerDidChangeContent(controller: NSFetchedResultsController) {
|
||||||
tableView.endUpdates()
|
tableView.endUpdates()
|
||||||
|
refreshTabBarBadgeCount()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@
|
|||||||
</dict>
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>1.7.1481</string>
|
<string>1.7.1486</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.1833</string>
|
<string>1.7.1839</string>
|
||||||
<key>NSExtension</key>
|
<key>NSExtension</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>NSExtensionMainStoryboard</key>
|
<key>NSExtensionMainStoryboard</key>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user