Basic for bookmarks

This commit is contained in:
Chris Li 2017-01-12 13:41:54 -05:00
parent 553fd63612
commit a3f1687e54
8 changed files with 325 additions and 33 deletions

View File

@ -0,0 +1,71 @@
//
// BookmarkBooksController.swift
// Kiwix
//
// Created by Chris Li on 1/11/17.
// Copyright © 2017 Chris Li. All rights reserved.
//
import UIKit
import CoreData
class BookmarkBooksController: CoreDataTableBaseController, UITableViewDelegate, UITableViewDataSource {
override func viewDidLoad() {
super.viewDidLoad()
title = "Bookmarks"
}
@IBAction func dismiss(_ sender: UIBarButtonItem) {
dismiss(animated: true, completion: nil)
}
// MARK: - TableView Data Source
func numberOfSections(in tableView: UITableView) -> Int {
return fetchedResultController.sections?.count ?? 0
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
guard let sectionInfo = fetchedResultController.sections?[section] else {return 0}
return sectionInfo.numberOfObjects
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath)
configureCell(cell, atIndexPath: indexPath)
return cell
}
override func configureCell(_ cell: UITableViewCell, atIndexPath indexPath: IndexPath) {
guard let cell = cell as? BasicBookCell else {return}
let book = fetchedResultController.object(at: indexPath)
cell.titleLabel.text = book.title
cell.hasPic = book.hasPic
cell.favIcon.image = UIImage(data: book.favIcon ?? Data())
cell.subtitleLabel.text = book.detailedDescription
cell.accessoryType = splitViewController?.traitCollection.horizontalSizeClass == .compact ? .disclosureIndicator : .none
}
func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
guard let stateRaw = fetchedResultController.sections?[section].name, let stateInt = Int(stateRaw) else {return nil}
return BookState(rawValue: stateInt)?.description
}
// MARK: - Fetched Results Controller
let managedObjectContext = AppDelegate.persistentContainer.viewContext
lazy var fetchedResultController: NSFetchedResultsController<Book> = {
let fetchRequest = Book.fetchRequest()
let stateDescriptor = NSSortDescriptor(key: "stateRaw", ascending: true)
let titleDescriptor = NSSortDescriptor(key: "title", ascending: true)
fetchRequest.sortDescriptors = [stateDescriptor, titleDescriptor]
fetchRequest.predicate = NSPredicate(format: "stateRaw >= 2")
let fetchedResultsController = NSFetchedResultsController(fetchRequest: fetchRequest, managedObjectContext: self.managedObjectContext, sectionNameKeyPath: "stateRaw", cacheName: "BookmarkBooksFRC" + Bundle.buildVersion)
fetchedResultsController.delegate = self
try? fetchedResultsController.performFetch()
return fetchedResultsController as! NSFetchedResultsController<Book>
}()
}

View File

@ -0,0 +1,36 @@
//
// BookmarkSplitController.swift
// Kiwix
//
// Created by Chris Li on 1/12/17.
// Copyright © 2017 Chris Li. All rights reserved.
//
import UIKit
class BookmarkSplitController: UISplitViewController, UISplitViewControllerDelegate {
override func viewDidLoad() {
super.viewDidLoad()
preferredDisplayMode = .allVisible
minimumPrimaryColumnWidth = 320.0
delegate = self
}
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
guard traitCollection != previousTraitCollection else {return}
let controller: CoreDataTableBaseController? = {
let nav = viewControllers.first as? UINavigationController
return nav?.topViewController as? CoreDataTableBaseController
}()
controller?.tableView.indexPathsForVisibleRows?.forEach({ (indexPath) in
guard let cell = controller?.tableView.cellForRow(at: indexPath) else {return}
controller?.configureCell(cell, atIndexPath: indexPath)
})
}
func splitViewController(_ splitViewController: UISplitViewController, collapseSecondary secondaryViewController: UIViewController, onto primaryViewController: UIViewController) -> Bool {
return true
}
}

View File

@ -34,6 +34,8 @@ class Buttons: LPTBarButtonItemDelegate {
delegate?.didTapForwardButton()
case toc:
delegate?.didTapTOCButton()
case bookmark:
delegate?.didTapBookmarkButton()
case library:
delegate?.didTapLibraryButton()
default:

View File

@ -19,23 +19,8 @@ class Controllers {
}
// MARK: - Bookmark
//
// private var bookmark: UINavigationController?
//
// class var bookmark: UINavigationController {
// let controller = Controllers.shared.bookmark ?? UIStoryboard(name: "Bookmark", bundle: nil).instantiateInitialViewController() as! UINavigationController
// Controllers.shared.bookmark = controller
// return controller
// }
//
// private var bookmarkHUD: BookmarkHUD?
//
// class var bookmarkHUD: BookmarkHUD {
// let controller = Controllers.shared.bookmarkHUD ?? UIStoryboard(name: "Bookmark", bundle: nil).instantiateViewController(withIdentifier: "BookmarkHUD") as! BookmarkHUD
// Controllers.shared.bookmarkHUD = controller
// return controller
// }
private(set) lazy var bookmark = UIStoryboard(name: "Bookmark", bundle: nil).instantiateInitialViewController() as! UISplitViewController
private(set) lazy var bookmarkHUD = UIStoryboard(name: "Bookmark", bundle: nil).instantiateViewController(withIdentifier: "BookmarkHUD") as! BookmarkHUD
// MARK: - Library

View File

@ -323,9 +323,9 @@ extension MainController {
extension MainController: UIViewControllerTransitioningDelegate {
func showBookmarkController() {
// let controller = Controllers.bookmark
// controller.modalPresentationStyle = .formSheet
// present(controller, animated: true, completion: nil)
let controller = controllers.bookmark
controller.modalPresentationStyle = .fullScreen
present(controller, animated: true, completion: nil)
}
func showBookmarkHUD() {

View File

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11762" systemVersion="16C68" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="ALQ-3b-cEW">
<device id="retina5_5" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11755"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
<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"/>
@ -22,10 +22,10 @@
<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="55.5" width="414" height="66"/>
<rect key="frame" x="0.0" y="56" width="414" height="66"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="5PG-FL-cxF" id="xaN-IW-A8Q">
<rect key="frame" x="0.0" y="0.0" width="414" height="66"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="65"/>
<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">
@ -38,7 +38,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="kTX-Se-1Tr">
<rect key="frame" x="66" y="36" width="340" height="19.666666666666664"/>
<rect key="frame" x="66" y="36" width="340" height="20"/>
<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"/>
@ -70,10 +70,10 @@
</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="121.5" width="414" height="149"/>
<rect key="frame" x="0.0" y="122" width="414" height="149"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="63j-xA-eDr" id="vOo-g4-SUY">
<rect key="frame" x="0.0" y="0.0" width="414" height="149"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="148"/>
<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">
@ -86,7 +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="340" height="19.666666666666664"/>
<rect key="frame" x="66" y="36" width="340" height="20"/>
<constraints>
<constraint firstAttribute="height" constant="19.5" id="Z3G-7m-zmO"/>
</constraints>
@ -102,7 +102,7 @@
</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="398" height="74.666666666666657"/>
<rect key="frame" x="8" y="66" width="398" height="75"/>
<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"/>
@ -157,6 +157,168 @@
</objects>
<point key="canvasLocation" x="2402" y="1764"/>
</scene>
<!--View Controller-->
<scene sceneID="cHE-4Y-51R">
<objects>
<viewController id="oLN-7t-Pr8" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="f18-bT-5eI"/>
<viewControllerLayoutGuide type="bottom" id="ZaM-mS-Ov3"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="CNz-v0-bW2">
<rect key="frame" x="0.0" y="0.0" width="414" height="736"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
<navigationItem key="navigationItem" id="Wqn-bE-ueD"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="9Ru-B3-FcT" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="3289.8550724637685" y="3196.467391304348"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="i96-PS-3ib">
<objects>
<navigationController id="8sg-ud-siF" sceneMemberID="viewController">
<navigationBar key="navigationBar" contentMode="scaleToFill" id="THl-YC-SF3">
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<connections>
<segue destination="6ta-bG-bwf" kind="relationship" relationship="rootViewController" id="00r-M0-WcP"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="KtC-fm-L5w" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="2384" y="2552"/>
</scene>
<!--Bookmark Books Controller-->
<scene sceneID="g5J-tc-3iG">
<objects>
<viewController id="6ta-bG-bwf" customClass="BookmarkBooksController" customModule="Kiwix" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="urC-8o-1iM"/>
<viewControllerLayoutGuide type="bottom" id="T69-r2-wBm"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="yBA-aj-9iL">
<rect key="frame" x="0.0" y="0.0" width="414" height="736"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="18" sectionFooterHeight="18" translatesAutoresizingMaskIntoConstraints="NO" id="Q7g-uD-S7M">
<rect key="frame" x="0.0" y="0.0" width="414" height="736"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="Cell" id="ZwJ-s2-oXZ" customClass="BasicBookCell" customModule="Kiwix" customModuleProvider="target">
<rect key="frame" x="0.0" y="56" width="414" height="44"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="ZwJ-s2-oXZ" id="acz-8H-Je1">
<rect key="frame" x="0.0" y="0.0" width="381" height="43"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" lineBreakMode="tailTruncation" minimumFontSize="8" adjustsLetterSpacingToFitWidth="YES" translatesAutoresizingMaskIntoConstraints="NO" id="F5J-kg-p5Y">
<rect key="frame" x="48" y="6" width="326" height="20"/>
<constraints>
<constraint firstAttribute="height" constant="19.5" id="hqN-t5-kD7"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<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="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="jBa-Dl-ouL">
<rect key="frame" x="6" y="6" width="32" height="32"/>
<constraints>
<constraint firstAttribute="width" constant="32" id="LbM-2K-Mmc"/>
<constraint firstAttribute="height" constant="32" id="c2d-b9-Uw7"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wUN-Co-X2K">
<rect key="frame" x="48" y="26.000000000000004" width="326" height="12.333333333333339"/>
<fontDescription key="fontDescription" type="system" pointSize="11"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="vCd-Vo-NUE">
<rect key="frame" x="42" y="6" width="2" height="31.5"/>
<color key="backgroundColor" red="1" green="0.40000000000000002" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="width" constant="2" id="mUe-cP-6T5"/>
</constraints>
</view>
</subviews>
<constraints>
<constraint firstItem="wUN-Co-X2K" firstAttribute="top" secondItem="F5J-kg-p5Y" secondAttribute="bottom" id="3pg-Eu-r1r"/>
<constraint firstItem="F5J-kg-p5Y" firstAttribute="leading" secondItem="vCd-Vo-NUE" secondAttribute="trailing" constant="4" id="74u-jr-tc1"/>
<constraint firstAttribute="bottomMargin" secondItem="wUN-Co-X2K" secondAttribute="bottom" constant="-2.5" id="N9w-ZM-Moh"/>
<constraint firstItem="jBa-Dl-ouL" firstAttribute="leading" secondItem="acz-8H-Je1" secondAttribute="leadingMargin" constant="-2" id="NUQ-lj-5ST"/>
<constraint firstItem="wUN-Co-X2K" firstAttribute="leading" secondItem="vCd-Vo-NUE" secondAttribute="trailing" constant="4" id="ocN-8W-1Gb"/>
<constraint firstItem="vCd-Vo-NUE" firstAttribute="leading" secondItem="jBa-Dl-ouL" secondAttribute="trailing" constant="4" id="ogX-H8-V96"/>
<constraint firstItem="F5J-kg-p5Y" firstAttribute="top" secondItem="acz-8H-Je1" secondAttribute="topMargin" constant="-2" id="s9t-Yx-dgH"/>
<constraint firstItem="vCd-Vo-NUE" firstAttribute="top" secondItem="acz-8H-Je1" secondAttribute="topMargin" constant="-2" id="yJk-2H-Uvq"/>
<constraint firstItem="jBa-Dl-ouL" firstAttribute="centerY" secondItem="acz-8H-Je1" secondAttribute="centerY" id="zik-qh-84v"/>
<constraint firstAttribute="bottomMargin" secondItem="vCd-Vo-NUE" secondAttribute="bottom" constant="-2" id="zoM-TX-UXr"/>
</constraints>
</tableViewCellContentView>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="jBa-Dl-ouL" firstAttribute="top" secondItem="ZwJ-s2-oXZ" secondAttribute="top" constant="6" id="LQ5-bh-rz7"/>
<constraint firstAttribute="trailing" secondItem="F5J-kg-p5Y" secondAttribute="trailing" constant="40" id="abU-dZ-xEk"/>
<constraint firstAttribute="trailing" secondItem="wUN-Co-X2K" secondAttribute="trailing" constant="40" id="kwo-EU-4cI"/>
</constraints>
<variation key="default">
<mask key="constraints">
<exclude reference="LQ5-bh-rz7"/>
</mask>
</variation>
<connections>
<outlet property="favIcon" destination="jBa-Dl-ouL" id="ltI-BJ-LRY"/>
<outlet property="hasPicIndicator" destination="vCd-Vo-NUE" id="oxG-mF-2gO"/>
<outlet property="subtitleLabel" destination="wUN-Co-X2K" id="tJG-Vg-Ctp"/>
<outlet property="titleLabel" destination="F5J-kg-p5Y" id="SGC-oq-RQ6"/>
</connections>
</tableViewCell>
</prototypes>
<connections>
<outlet property="dataSource" destination="6ta-bG-bwf" id="g0B-b6-OZB"/>
<outlet property="delegate" destination="6ta-bG-bwf" id="ma7-ZJ-t6r"/>
</connections>
</tableView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="T69-r2-wBm" firstAttribute="top" secondItem="Q7g-uD-S7M" secondAttribute="bottom" id="7uu-wP-C81"/>
<constraint firstItem="Q7g-uD-S7M" firstAttribute="top" secondItem="yBA-aj-9iL" secondAttribute="top" id="THv-jE-RfJ"/>
<constraint firstAttribute="trailing" secondItem="Q7g-uD-S7M" secondAttribute="trailing" id="aiY-aT-WkV"/>
<constraint firstItem="Q7g-uD-S7M" firstAttribute="leading" secondItem="yBA-aj-9iL" secondAttribute="leading" id="cbW-93-3Lq"/>
</constraints>
</view>
<navigationItem key="navigationItem" id="UEE-7Y-VJP">
<barButtonItem key="leftBarButtonItem" image="Cross" id="RPs-GS-f73">
<connections>
<action selector="dismiss:" destination="6ta-bG-bwf" id="kaO-mc-iVc"/>
</connections>
</barButtonItem>
</navigationItem>
<connections>
<outlet property="tableView" destination="Q7g-uD-S7M" id="EnJ-hw-TgP"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Mda-Cj-fak" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="3244.9275362318845" y="2551.630434782609"/>
</scene>
<!--Bookmark Split Controller-->
<scene sceneID="SDm-nf-Wpq">
<objects>
<splitViewController id="ALQ-3b-cEW" customClass="BookmarkSplitController" customModule="Kiwix" customModuleProvider="target" sceneMemberID="viewController">
<connections>
<segue destination="8sg-ud-siF" kind="relationship" relationship="masterViewController" id="25F-nw-ITK"/>
<segue destination="hDm-kh-ZLk" kind="relationship" relationship="detailViewController" id="ipW-qc-ph3"/>
</connections>
</splitViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="XnC-Pf-fz7" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1468" y="2878"/>
</scene>
<!--BookmarkHUD-->
<scene sceneID="eMu-pk-jX5">
<objects>
@ -176,7 +338,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="BookmarkAdded" highlightedImage="BookmarkRemoved" translatesAutoresizingMaskIntoConstraints="NO" id="Ez8-bg-mmo">
<rect key="frame" x="142.66666666666669" y="215" width="128.00000000000006" height="128"/>
<rect key="frame" x="143" y="215" 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"/>
@ -293,9 +455,28 @@
</objects>
<point key="canvasLocation" x="1560.8" y="1764.4677661169417"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="IbQ-Ft-djH">
<objects>
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="hDm-kh-ZLk" sceneMemberID="viewController">
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" id="lNg-T6-EiE">
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<nil name="viewControllers"/>
<connections>
<segue destination="oLN-7t-Pr8" kind="relationship" relationship="rootViewController" id="EN4-w7-1UJ"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="avJ-P8-fSY" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="2382.608695652174" y="3196.467391304348"/>
</scene>
</scenes>
<resources>
<image name="BookmarkAdded" width="348" height="331"/>
<image name="BookmarkRemoved" width="348" height="331"/>
<image name="Cross" width="16" height="16"/>
</resources>
</document>

View File

@ -65,6 +65,8 @@
975227D01D022814001D1DDE /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 975227CF1D022814001D1DDE /* LaunchScreen.storyboard */; };
9757C74A1E10660B008A9469 /* DownloadManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9757C7491E10660B008A9469 /* DownloadManager.swift */; };
9757C74C1E106958008A9469 /* BackgroundDownload.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9757C74B1E106958008A9469 /* BackgroundDownload.swift */; };
97599AA21E26D3B000BA15EF /* BookmarkBooksController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97599AA11E26D3B000BA15EF /* BookmarkBooksController.swift */; };
97599AE01E28031A00BA15EF /* BookmarkSplitController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97599ADF1E28031A00BA15EF /* BookmarkSplitController.swift */; };
975B90FE1CEB909100D13906 /* iOSExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 975B90FD1CEB909100D13906 /* iOSExtensions.swift */; };
9764CBD11D806AD800072D6A /* RefreshLibControl.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9764CBD01D806AD800072D6A /* RefreshLibControl.swift */; };
9764F5931D830EF200E0B1C4 /* liblzma.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 9764F5921D830EF200E0B1C4 /* liblzma.tbd */; };
@ -222,6 +224,8 @@
975227CF1D022814001D1DDE /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = "Kiwix-iOS/Storyboard/LaunchScreen.storyboard"; sourceTree = SOURCE_ROOT; };
9757C7491E10660B008A9469 /* DownloadManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DownloadManager.swift; sourceTree = "<group>"; };
9757C74B1E106958008A9469 /* BackgroundDownload.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BackgroundDownload.swift; sourceTree = "<group>"; };
97599AA11E26D3B000BA15EF /* BookmarkBooksController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BookmarkBooksController.swift; sourceTree = "<group>"; };
97599ADF1E28031A00BA15EF /* BookmarkSplitController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BookmarkSplitController.swift; sourceTree = "<group>"; };
975B90FD1CEB909100D13906 /* iOSExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = iOSExtensions.swift; path = "Kiwix-iOS/iOSExtensions.swift"; sourceTree = SOURCE_ROOT; };
9763275D1D64FE0F0034F120 /* BookDetailController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BookDetailController.swift; sourceTree = "<group>"; };
9764CBD01D806AD800072D6A /* RefreshLibControl.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RefreshLibControl.swift; sourceTree = "<group>"; };
@ -531,6 +535,8 @@
9749A1B21C430653000F2D1E /* Bookmark */ = {
isa = PBXGroup;
children = (
97599ADF1E28031A00BA15EF /* BookmarkSplitController.swift */,
97599AA11E26D3B000BA15EF /* BookmarkBooksController.swift */,
97C5BD4A1D9AF4B5009692CF /* BookmarkController.swift */,
97219DBC1D383A00009FDFF1 /* BookmarkHUD.swift */,
);
@ -1120,6 +1126,7 @@
970E7F741D9DB0FC00741290 /* 1.8.xcmappingmodel in Sources */,
973207A01DD1983D00EDD3DC /* DownloadTasksController.swift in Sources */,
977A458C1E14EA140089C596 /* Cloud.swift in Sources */,
97599AA21E26D3B000BA15EF /* BookmarkBooksController.swift in Sources */,
97D0E9931DDA487E0029530E /* SearchBaseController.swift in Sources */,
97A1FD321D6F723D00A80EE2 /* resourceTools.cpp in Sources */,
97A1FD451D6F728200A80EE2 /* StringTools.swift in Sources */,
@ -1142,6 +1149,7 @@
97A1FD191D6F71CE00A80EE2 /* ZimMultiReader.swift in Sources */,
97A1FD261D6F71E200A80EE2 /* ZimReader.mm in Sources */,
97A1FD1C1D6F71D800A80EE2 /* KiwixURLProtocol.swift in Sources */,
97599AE01E28031A00BA15EF /* BookmarkSplitController.swift in Sources */,
97C2C26A1DDCC58500A9CC64 /* ArticleOperation.swift in Sources */,
973A5C991DEBC54800C7804C /* CloudKit.swift in Sources */,
973208261DD21E9C00EDD3DC /* CoreDataContainer.swift in Sources */,
@ -1326,7 +1334,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = DA0AB5D61F19BE37BD0AFA0A /* Pods-Kiwix-iOS.debug.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)";
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
@ -1363,7 +1371,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 5B9300794E7F4EFE5B3E8F19 /* Pods-Kiwix-iOS.release.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)";
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";

View File

@ -241,8 +241,17 @@ class Book: NSManagedObject {
}
}
enum BookState: Int {
enum BookState: Int, CustomStringConvertible {
case cloud, downloading, local, retained
var description: String {
switch self {
case .cloud: return "Cloud"
case .downloading: return "Downloading"
case .local: return "Local"
case .retained: return "Retained"
}
}
}