diff --git a/Kiwix-iOS/Controller/Library/DownloadTasksController.swift b/Kiwix-iOS/Controller/Library/DownloadTasksController.swift
index edbc9897..2e0e8c7d 100644
--- a/Kiwix-iOS/Controller/Library/DownloadTasksController.swift
+++ b/Kiwix-iOS/Controller/Library/DownloadTasksController.swift
@@ -52,10 +52,9 @@ class DownloadTasksController: LibraryBaseController, UITableViewDelegate, UITab
guard let navController = segue.destination as? UINavigationController,
let bookDetailController = navController.topViewController as? BookDetailController,
let cell = sender as? UITableViewCell,
- let indexPath = tableView.indexPath(for: cell),
- let downloadTask = fetchedResultController.object(at: indexPath) as? DownloadTask,
- let book = downloadTask.book else {return}
- bookDetailController.book = book
+ let indexPath = tableView.indexPath(for: cell) else {return}
+ let downloadTask = fetchedResultController.object(at: indexPath)
+ bookDetailController.book = downloadTask.book
default:
break
}
diff --git a/Kiwix-iOS/Controller/Main/Buttons.swift b/Kiwix-iOS/Controller/Main/Buttons.swift
index dcc4f0e4..0bd8f52f 100644
--- a/Kiwix-iOS/Controller/Main/Buttons.swift
+++ b/Kiwix-iOS/Controller/Main/Buttons.swift
@@ -43,6 +43,8 @@ class Buttons: LPTBarButtonItemDelegate {
delegate?.didLongPressBackButton()
case forward:
delegate?.didLongPressForwardButton()
+ case bookmark:
+ delegate?.didLongPressBookmarkButton()
default:
return
}
diff --git a/Kiwix-iOS/Controller/Search/SearchBooksController.swift b/Kiwix-iOS/Controller/Search/SearchBooksController.swift
index db08142e..2e535075 100644
--- a/Kiwix-iOS/Controller/Search/SearchBooksController.swift
+++ b/Kiwix-iOS/Controller/Search/SearchBooksController.swift
@@ -54,8 +54,8 @@ class SearchBooksController: SearchBaseTableController, UITableViewDelegate, UIT
// MARK: - Table Cell Delegate
func didTapOnAccessoryViewForCell(_ cell: UITableViewCell) {
- guard let indexPath = tableView.indexPath(for: cell),
- let book = fetchedResultController.object(at: indexPath) as? Book else {return}
+ guard let indexPath = tableView.indexPath(for: cell) else {return}
+ let book = fetchedResultController.object(at: indexPath)
book.includeInSearch = !book.includeInSearch
}
@@ -77,8 +77,8 @@ class SearchBooksController: SearchBaseTableController, UITableViewDelegate, UIT
}
func configureCell(_ cell: UITableViewCell, atIndexPath indexPath: IndexPath) {
- guard let book = fetchedResultController.object(at: indexPath) as? Book else {return}
guard let cell = cell as? CheckMarkBookCell else {return}
+ let book = fetchedResultController.object(at: indexPath)
cell.delegate = self
cell.titleLabel.text = book.title
@@ -111,9 +111,9 @@ class SearchBooksController: SearchBaseTableController, UITableViewDelegate, UIT
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
- guard let book = fetchedResultController.object(at: indexPath) as? Book else {return}
-// let operation = ArticleLoadOperation(bookID: book.id)
-// GlobalQueue.shared.add(load: operation)
+ let book = fetchedResultController.object(at: indexPath)
+ let operation = ArticleLoadOperation(bookID: book.id)
+ GlobalQueue.shared.add(articleLoadOperation: operation)
}
// MARK: - Fetched Result Controller Delegate
diff --git a/Kiwix-iOS/Info.plist b/Kiwix-iOS/Info.plist
index 484703f4..22d76dbe 100644
--- a/Kiwix-iOS/Info.plist
+++ b/Kiwix-iOS/Info.plist
@@ -49,7 +49,7 @@
CFBundleVersion
- 1.8.3265
+ 1.8.3277
ITSAppUsesNonExemptEncryption
LSRequiresIPhoneOS
diff --git a/Kiwix-iOSWidgets/Bookmarks/Info.plist b/Kiwix-iOSWidgets/Bookmarks/Info.plist
index 837534b7..0bdcb429 100644
--- a/Kiwix-iOSWidgets/Bookmarks/Info.plist
+++ b/Kiwix-iOSWidgets/Bookmarks/Info.plist
@@ -21,7 +21,7 @@
CFBundleSignature
????
CFBundleVersion
- 1.8.3265
+ 1.8.3277
NSExtension
NSExtensionMainStoryboard
diff --git a/Kiwix/Tools/Extensions.swift b/Kiwix/Tools/Extensions.swift
index 61223846..533928ee 100644
--- a/Kiwix/Tools/Extensions.swift
+++ b/Kiwix/Tools/Extensions.swift
@@ -123,3 +123,9 @@ extension UIDevice {
}
}
+extension Collection {
+ public subscript(safe index: Index) -> _Element? {
+ return index >= startIndex && index < endIndex ? self[index] : nil
+ }
+}
+