diff --git a/Kiwix-iOS/Assets.xcassets/Setting2.imageset/multimedia.png b/Kiwix-iOS/Assets.xcassets/Setting2.imageset/multimedia.png
deleted file mode 100644
index 978a0578..00000000
Binary files a/Kiwix-iOS/Assets.xcassets/Setting2.imageset/multimedia.png and /dev/null differ
diff --git a/Kiwix-iOS/Assets.xcassets/Setting2.imageset/Contents.json b/Kiwix-iOS/Assets.xcassets/StarRemoved.imageset/Contents.json
similarity index 87%
rename from Kiwix-iOS/Assets.xcassets/Setting2.imageset/Contents.json
rename to Kiwix-iOS/Assets.xcassets/StarRemoved.imageset/Contents.json
index 0bc1f4c5..02f45af2 100644
--- a/Kiwix-iOS/Assets.xcassets/Setting2.imageset/Contents.json
+++ b/Kiwix-iOS/Assets.xcassets/StarRemoved.imageset/Contents.json
@@ -10,7 +10,7 @@
},
{
"idiom" : "universal",
- "filename" : "multimedia.png",
+ "filename" : "star.png",
"scale" : "3x"
}
],
diff --git a/Kiwix-iOS/Assets.xcassets/StarRemoved.imageset/star.png b/Kiwix-iOS/Assets.xcassets/StarRemoved.imageset/star.png
new file mode 100644
index 00000000..358c8e36
Binary files /dev/null and b/Kiwix-iOS/Assets.xcassets/StarRemoved.imageset/star.png differ
diff --git a/Kiwix-iOS/Controller/BookmarkTBVC.swift b/Kiwix-iOS/Controller/BookmarkTBVC.swift
index 8b4bae36..366ce06e 100644
--- a/Kiwix-iOS/Controller/BookmarkTBVC.swift
+++ b/Kiwix-iOS/Controller/BookmarkTBVC.swift
@@ -18,6 +18,7 @@ class BookmarkTBVC: UITableViewController, NSFetchedResultsControllerDelegate, D
title = LocalizedStrings.bookmarks
tableView.estimatedRowHeight = 66.0
tableView.rowHeight = UITableViewAutomaticDimension
+ tableView.allowsMultipleSelectionDuringEditing = true
tableView.emptyDataSetSource = self
tableView.emptyDataSetDelegate = self
@@ -29,6 +30,13 @@ class BookmarkTBVC: UITableViewController, NSFetchedResultsControllerDelegate, D
override func viewWillDisappear(animated: Bool) {
super.viewWillDisappear(animated)
+ setEditing(false, animated: false)
+ }
+
+ override func setEditing(editing: Bool, animated: Bool) {
+ super.setEditing(editing, animated: animated)
+ tableView.setEditing(editing, animated: animated)
+ navigationController?.setToolbarHidden(!editing, animated: animated)
}
// MARK: - Empty table datasource & delegate
@@ -111,6 +119,7 @@ class BookmarkTBVC: UITableViewController, NSFetchedResultsControllerDelegate, D
// MARK: - Table view delegate
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
+ guard !tableView.editing else {return}
defer {dismissViewControllerAnimated(true, completion: nil)}
guard let navigationController = navigationController?.presentingViewController as? UINavigationController else {return}
guard let mainVC = navigationController.topViewController as? MainController else {return}
@@ -118,6 +127,23 @@ class BookmarkTBVC: UITableViewController, NSFetchedResultsControllerDelegate, D
mainVC.load(article.url)
}
+ override func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool {
+ return true
+ }
+
+ override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {}
+
+ override func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [UITableViewRowAction]? {
+ let remove = UITableViewRowAction(style: .Destructive, title: LocalizedStrings.remove) { (action, indexPath) -> Void in
+ guard let article = self.fetchedResultController.objectAtIndexPath(indexPath) as? Article else {return}
+ let context = NSManagedObjectContext.mainQueueContext
+ context.performBlockAndWait({ () -> Void in
+ context.deleteObject(article)
+ })
+ }
+ return [remove]
+ }
+
// MARK: - Fetched Result Controller Delegate
let managedObjectContext = UIApplication.appDelegate.managedObjectContext
@@ -175,6 +201,23 @@ class BookmarkTBVC: UITableViewController, NSFetchedResultsControllerDelegate, D
// MARK: - Action
+ @IBAction func editingButtonTapped(sender: UIBarButtonItem) {
+ setEditing(!editing, animated: true)
+ }
+
+ @IBAction func removeBookmarkButtonTapped(sender: UIBarButtonItem) {
+ guard editing else {return}
+ guard let selectedIndexPathes = tableView.indexPathsForSelectedRows else {return}
+ let artiicles = selectedIndexPathes.flatMap() {fetchedResultController.objectAtIndexPath($0) as? Article}
+ let context = NSManagedObjectContext.mainQueueContext
+ context.performBlock {
+ artiicles.forEach() {
+ $0.isBookmarked = false
+ $0.bookmarkDate = nil
+ }
+ }
+ }
+
@IBAction func dismissButtonTapped(sender: UIBarButtonItem) {
dismissViewControllerAnimated(true, completion: nil)
}
diff --git a/Kiwix-iOS/Info.plist b/Kiwix-iOS/Info.plist
index 7ff50d5c..683a44f4 100644
--- a/Kiwix-iOS/Info.plist
+++ b/Kiwix-iOS/Info.plist
@@ -36,7 +36,7 @@
CFBundleSignature
????
CFBundleVersion
- 1.7.284
+ 1.7.300
ITSAppUsesNonExemptEncryption
LSRequiresIPhoneOS
diff --git a/Kiwix-iOS/Storyboard/Main.storyboard b/Kiwix-iOS/Storyboard/Main.storyboard
index 824bf545..38b26582 100644
--- a/Kiwix-iOS/Storyboard/Main.storyboard
+++ b/Kiwix-iOS/Storyboard/Main.storyboard
@@ -30,13 +30,13 @@
-
+
@@ -78,7 +78,7 @@
-
+
@@ -100,7 +100,7 @@
@@ -138,12 +138,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -487,13 +500,17 @@
-
+
+
+
+
+
@@ -623,5 +640,6 @@
+