diff --git a/Kiwix-iOS/Controller/Library/LibraryBooksController.swift b/Kiwix-iOS/Controller/Library/LibraryBooksController.swift
index 5f4fb95d..a99bef68 100644
--- a/Kiwix-iOS/Controller/Library/LibraryBooksController.swift
+++ b/Kiwix-iOS/Controller/Library/LibraryBooksController.swift
@@ -152,8 +152,13 @@ class LibraryBooksController: CoreDataCollectionBaseController, UICollectionView
func didTapMoreButton(cell: LibraryCollectionCell) {
guard let indexPath = collectionView.indexPath(for: cell) else {return}
+ let book = fetchedResultController.object(at: indexPath)
-
+ let procedure = AlertProcedure.bookMore(context: self, book: book)
+ procedure.alert.modalPresentationStyle = .popover
+ procedure.alert.popoverPresentationController?.sourceView = cell.moreButton
+ procedure.alert.popoverPresentationController?.sourceRect = cell.moreButton.bounds
+ UIQueue.shared.add(operation: procedure)
}
// MARK: - NSFetchedResultsController
@@ -192,6 +197,8 @@ class LibraryBooksController: CoreDataCollectionBaseController, UICollectionView
extension Localized {
class Library {
- static let title = NSLocalizedString("Library", comment: "Library, Language Filter")
+ static let title = NSLocalizedString("Library", comment: "Library")
+ static let download = NSLocalizedString("Download", comment: "Library, more action sheet")
+ static let copyURL = NSLocalizedString("Copy URL", comment: "Library, more action sheet")
}
}
diff --git a/Kiwix-iOS/Storyboard/Library.storyboard b/Kiwix-iOS/Storyboard/Library.storyboard
index 8d5a4bd0..9dcffbc1 100644
--- a/Kiwix-iOS/Storyboard/Library.storyboard
+++ b/Kiwix-iOS/Storyboard/Library.storyboard
@@ -128,6 +128,7 @@
+
diff --git a/Kiwix-iOS/View/Cells.swift b/Kiwix-iOS/View/Cells.swift
index 4ecbcf13..ce19a02a 100644
--- a/Kiwix-iOS/View/Cells.swift
+++ b/Kiwix-iOS/View/Cells.swift
@@ -161,6 +161,7 @@ class LibraryCollectionCell: UICollectionViewCell {
@IBOutlet weak var subtitleLabel: UILabel!
@IBOutlet weak var descriptionLabel: UILabel!
@IBOutlet weak var hasPicLabel: UILabel!
+ @IBOutlet weak var moreButton: UIButton!
}
protocol LibraryCollectionCellDelegate: class {
diff --git a/Kiwix/Operations/UIProcedure.swift b/Kiwix/Operations/UIProcedure.swift
index 2596525d..0740cd31 100644
--- a/Kiwix/Operations/UIProcedure.swift
+++ b/Kiwix/Operations/UIProcedure.swift
@@ -86,5 +86,18 @@ extension AlertProcedure {
alert.add(actionWithTitle: Localized.Alert.cancel, style: .cancel)
return alert
}
+
+ static func bookMore(context: UIViewController, book: Book) -> AlertProcedure {
+ let alert = AlertProcedure(presentAlertFrom: context, withPreferredStyle: .actionSheet, waitForDismissal: false)
+ alert.title = book.title
+ alert.add(actionWithTitle: Localized.Library.download, style: .default) { _ in
+
+ }
+ alert.add(actionWithTitle: Localized.Library.copyURL, style: .default) { _ in
+ guard let url = book.url else {return}
+ UIPasteboard.general.string = url.absoluteString
+ }
+ return alert
+ }
}