diff --git a/Kiwix-iOS/Controller/Main/Buttons.swift b/Kiwix-iOS/Controller/Main/Buttons.swift
index eb8c8dad..264d8be3 100644
--- a/Kiwix-iOS/Controller/Main/Buttons.swift
+++ b/Kiwix-iOS/Controller/Main/Buttons.swift
@@ -60,6 +60,8 @@ class Buttons {
print("left tapped")
case right:
print("right tapped")
+ case bookmark:
+ delegate?.didTapBookmarkButton()
case library:
delegate?.didTapLibraryButton()
case cancel:
@@ -76,6 +78,8 @@ class Buttons {
print("left long tapped")
case 1:
print("right long tapped")
+ case 3:
+ delegate?.didLongPressBookmarkButton()
default:
return
}
@@ -83,9 +87,11 @@ class Buttons {
}
protocol ButtonDelegates {
-
+ func didTapBookmarkButton()
func didTapLibraryButton()
func didTapCancelButton()
+
+ func didLongPressBookmarkButton()
}
class GrayBarButtonItem: UIBarButtonItem {
diff --git a/Kiwix-iOS/Controller/Main/Controllers.swift b/Kiwix-iOS/Controller/Main/Controllers.swift
index 10da0bbb..caabf597 100644
--- a/Kiwix-iOS/Controller/Main/Controllers.swift
+++ b/Kiwix-iOS/Controller/Main/Controllers.swift
@@ -43,6 +43,8 @@ class Controllers {
// return controller
// }
+ private(set) lazy var bookmarkHUD = UIStoryboard(name: "Bookmark", bundle: nil).instantiateViewController(withIdentifier: "BookmarkHUD") as! BookmarkHUD
+
// MARK: - Library
private var _library: UIViewController?
diff --git a/Kiwix-iOS/Controller/Main/MainDelegates.swift b/Kiwix-iOS/Controller/Main/MainDelegates.swift
index fad118c7..887c6193 100644
--- a/Kiwix-iOS/Controller/Main/MainDelegates.swift
+++ b/Kiwix-iOS/Controller/Main/MainDelegates.swift
@@ -123,6 +123,10 @@ extension MainController {
// MARK: - Button Delegates
extension MainController: ButtonDelegates, SearchContainerDelegate {
+ func didTapBookmarkButton() {
+ showBookmarkController()
+ }
+
func didTapLibraryButton() {
present(controllers.library, animated: true, completion: nil)
}
@@ -130,6 +134,10 @@ extension MainController: ButtonDelegates, SearchContainerDelegate {
func didTapCancelButton() {
_ = searchBar.resignFirstResponder()
}
+
+ func didLongPressBookmarkButton() {
+ showBookmarkHUD()
+ }
}
// MARK: - SearchContainerDelegate
@@ -160,3 +168,29 @@ extension MainController {
controller.view.removeFromSuperview()
}
}
+
+// MARK: - Bookmark
+
+extension MainController: UIViewControllerTransitioningDelegate {
+ func showBookmarkController() {
+// let controller = Controllers.bookmark
+// controller.modalPresentationStyle = .formSheet
+// present(controller, animated: true, completion: nil)
+ }
+
+ func showBookmarkHUD() {
+ let controller = controllers.bookmarkHUD
+ controller.bookmarkAdded = !controller.bookmarkAdded
+ controller.transitioningDelegate = self
+ controller.modalPresentationStyle = .overFullScreen
+ present(controller, animated: true, completion: nil)
+ }
+
+ func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
+ return BookmarkHUDAnimator(animateIn: true)
+ }
+
+ func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
+ return BookmarkHUDAnimator(animateIn: false)
+ }
+}
diff --git a/Kiwix-iOS/Info.plist b/Kiwix-iOS/Info.plist
index bbe6ae2b..5a832318 100644
--- a/Kiwix-iOS/Info.plist
+++ b/Kiwix-iOS/Info.plist
@@ -49,7 +49,7 @@
CFBundleVersion
- 1.8.2963
+ 1.8.2978
ITSAppUsesNonExemptEncryption
LSRequiresIPhoneOS
diff --git a/Kiwix-iOS/Storyboard/Bookmark.storyboard b/Kiwix-iOS/Storyboard/Bookmark.storyboard
index 49f8af0e..ed6bf5a6 100644
--- a/Kiwix-iOS/Storyboard/Bookmark.storyboard
+++ b/Kiwix-iOS/Storyboard/Bookmark.storyboard
@@ -1,7 +1,11 @@
-
+
+
+
+
-
+
+
@@ -18,13 +22,14 @@
-
+
-
+
+
@@ -63,13 +70,14 @@
-
+
-
+
+