mirror of
https://github.com/kiwix/kiwix-apple.git
synced 2025-09-27 13:59:04 -04:00
commit
This commit is contained in:
parent
521b175106
commit
51bc049356
@ -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 {
|
||||
|
@ -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?
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,7 @@
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.8.2963</string>
|
||||
<string>1.8.2978</string>
|
||||
<key>ITSAppUsesNonExemptEncryption</key>
|
||||
<false/>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
|
@ -1,7 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11201" systemVersion="16A323" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="epu-ol-vd5">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11760" systemVersion="16B2555" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="epu-ol-vd5">
|
||||
<device id="retina4_7" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11161"/>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11755"/>
|
||||
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
|
||||
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
|
||||
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
|
||||
@ -18,13 +22,14 @@
|
||||
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
|
||||
<prototypes>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="BookmarkCell" rowHeight="66" id="5PG-FL-cxF" customClass="BookmarkCell" customModule="Kiwix" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="119.5" width="375" height="66"/>
|
||||
<rect key="frame" x="0.0" y="55.5" width="375" height="66"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="5PG-FL-cxF" id="xaN-IW-A8Q">
|
||||
<frame key="frameInset" width="375" height="65.5"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="65.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="8C5-aP-W5f">
|
||||
<rect key="frame" x="66" y="10" width="301" height="22"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="22" id="8Wa-GZ-Fdn"/>
|
||||
</constraints>
|
||||
@ -33,11 +38,13 @@
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="kTX-Se-1Tr">
|
||||
<rect key="frame" x="66" y="36" width="301" height="19.5"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="MLn-gx-0vX">
|
||||
<rect key="frame" x="8" y="8" width="50" height="50"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="50" id="HZd-Cl-V3K"/>
|
||||
<constraint firstAttribute="height" constant="50" id="uiV-Hq-hDX"/>
|
||||
@ -63,13 +70,14 @@
|
||||
</connections>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="BookmarkSnippetCell" rowHeight="149" id="63j-xA-eDr" customClass="BookmarkSnippetCell" customModule="Kiwix" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="185.5" width="375" height="149"/>
|
||||
<rect key="frame" x="0.0" y="121.5" width="375" height="149"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="63j-xA-eDr" id="vOo-g4-SUY">
|
||||
<frame key="frameInset" width="375" height="148.5"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="148.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Ucm-1R-oq2">
|
||||
<rect key="frame" x="66" y="10" width="301" height="22"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="22" id="kPD-8s-fMo"/>
|
||||
</constraints>
|
||||
@ -78,6 +86,7 @@
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ZiC-LW-CAz">
|
||||
<rect key="frame" x="66" y="36" width="301" height="19.5"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="19.5" id="Z3G-7m-zmO"/>
|
||||
</constraints>
|
||||
@ -86,12 +95,14 @@
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="fb7-cw-RPA">
|
||||
<rect key="frame" x="8" y="8" width="50" height="50"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="50" id="BXW-1c-V8W"/>
|
||||
<constraint firstAttribute="width" constant="50" id="Ur8-fD-YFg"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="justified" lineBreakMode="tailTruncation" numberOfLines="4" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="z7h-P0-nCy">
|
||||
<rect key="frame" x="8" y="66" width="359" height="74.5"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleCaption2"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
@ -159,11 +170,13 @@
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<visualEffectView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="HFe-de-R0s">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="rZm-UK-Rkk">
|
||||
<frame key="frameInset"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Bookmarked" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="I77-SP-O9K">
|
||||
<rect key="frame" x="8" y="358.5" width="359" height="40"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="40" id="sP9-Wk-HZy"/>
|
||||
</constraints>
|
||||
@ -172,6 +185,7 @@
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="bEX-sT-sCw">
|
||||
<rect key="frame" x="182.5" y="308.5" width="10" height="50"/>
|
||||
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="50" id="ZiA-Ig-RKd"/>
|
||||
@ -179,17 +193,20 @@
|
||||
</constraints>
|
||||
</view>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="BookmarkAdded" highlightedImage="BookmarkRemoved" translatesAutoresizingMaskIntoConstraints="NO" id="Ez8-bg-mmo">
|
||||
<rect key="frame" x="123.5" y="180.5" width="128" height="128"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" relation="lessThanOrEqual" constant="128" id="9Aa-nz-Quz"/>
|
||||
<constraint firstAttribute="width" secondItem="Ez8-bg-mmo" secondAttribute="height" multiplier="1:1" id="cmJ-a7-eFv"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
<visualEffectView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="TXy-BJ-W0z">
|
||||
<rect key="frame" x="8" y="599" width="359" height="24"/>
|
||||
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="lsv-Ff-iQe">
|
||||
<frame key="frameInset"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="359" height="24"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Tap anywhere to dismiss" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="OCG-cf-ckk">
|
||||
<rect key="frame" x="0.0" y="0.0" width="359" height="24"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.59999999999999998" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
|
@ -27,14 +27,14 @@
|
||||
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<prototypes>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="H1Cell" textLabel="xPq-dt-NK6" style="IBUITableViewCellStyleDefault" id="DSn-3Y-Gs4">
|
||||
<rect key="frame" x="0.0" y="28" width="270" height="44"/>
|
||||
<rect key="frame" x="0.0" y="28" width="414" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="DSn-3Y-Gs4" id="vq5-6x-vLY">
|
||||
<rect key="frame" x="0.0" y="0.0" width="270" height="43.666666666666664"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="43.666666666666664"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="xPq-dt-NK6">
|
||||
<rect key="frame" x="15" y="0.0" width="240" height="43.666666666666664"/>
|
||||
<rect key="frame" x="15" y="0.0" width="384" height="43.666666666666664"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="17"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
@ -49,14 +49,14 @@
|
||||
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="H2Cell" textLabel="DJX-Kf-59M" style="IBUITableViewCellStyleDefault" id="au4-iz-tLz">
|
||||
<rect key="frame" x="0.0" y="72" width="270" height="44"/>
|
||||
<rect key="frame" x="0.0" y="72" width="414" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="au4-iz-tLz" id="3UD-lZ-hs0">
|
||||
<rect key="frame" x="0.0" y="0.0" width="270" height="43.666666666666664"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="43.666666666666664"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="DJX-Kf-59M">
|
||||
<rect key="frame" x="15" y="0.0" width="240" height="43.666666666666664"/>
|
||||
<rect key="frame" x="15" y="0.0" width="384" height="43.666666666666664"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="17"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
@ -71,14 +71,14 @@
|
||||
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="Cell" textLabel="ry7-2s-QyS" style="IBUITableViewCellStyleDefault" id="cam-ik-ZIw">
|
||||
<rect key="frame" x="0.0" y="116" width="270" height="44"/>
|
||||
<rect key="frame" x="0.0" y="116" width="414" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="cam-ik-ZIw" id="ooG-35-3Wp">
|
||||
<rect key="frame" x="0.0" y="0.0" width="270" height="43.666666666666664"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="43.666666666666664"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="ry7-2s-QyS">
|
||||
<rect key="frame" x="15" y="0.0" width="240" height="43.666666666666664"/>
|
||||
<rect key="frame" x="15" y="0.0" width="384" height="43.666666666666664"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
|
@ -21,7 +21,7 @@
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.8.2963</string>
|
||||
<string>1.8.2978</string>
|
||||
<key>NSExtension</key>
|
||||
<dict>
|
||||
<key>NSExtensionMainStoryboard</key>
|
||||
|
Loading…
x
Reference in New Issue
Block a user