mirror of
https://github.com/kiwix/kiwix-apple.git
synced 2025-09-24 04:03:03 -04:00
Some bug fix and various improvements
This commit is contained in:
parent
1471350fcc
commit
a6e03b6fec
@ -539,7 +539,6 @@
|
|||||||
9714D8D61C6E5C2600AABCA7 /* LTBarButtonItem.swift */,
|
9714D8D61C6E5C2600AABCA7 /* LTBarButtonItem.swift */,
|
||||||
9787E87B1C3D696E0000F529 /* RefreshHUD.swift */,
|
9787E87B1C3D696E0000F529 /* RefreshHUD.swift */,
|
||||||
973381681C343F2C0016CEFB /* Logo.swift */,
|
973381681C343F2C0016CEFB /* Logo.swift */,
|
||||||
97999D881C52D27D003CAFF3 /* SearchBar.swift */,
|
|
||||||
);
|
);
|
||||||
name = View;
|
name = View;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -582,6 +581,7 @@
|
|||||||
978C587B1C1CCCA30077AE47 /* Coredata */ = {
|
978C587B1C1CCCA30077AE47 /* Coredata */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
97999D881C52D27D003CAFF3 /* SearchBar.swift */,
|
||||||
978C589D1C1CD8750077AE47 /* Properties */,
|
978C589D1C1CD8750077AE47 /* Properties */,
|
||||||
978C58901C1CD86E0077AE47 /* Book.swift */,
|
978C58901C1CD86E0077AE47 /* Book.swift */,
|
||||||
978C588E1C1CD86E0077AE47 /* Language.swift */,
|
978C588E1C1CD86E0077AE47 /* Language.swift */,
|
||||||
|
@ -35,9 +35,9 @@ class SpaceNotEnoughAlert: AlertOperation {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class LanguageFilterAlert: AlertOperation {
|
class RefreshLibraryLanguageFilterAlert: AlertOperation {
|
||||||
let context = UIApplication.appDelegate.managedObjectContext
|
let context = UIApplication.appDelegate.managedObjectContext
|
||||||
init(libraryOnlineTBVC: LibraryOnlineTBVC) {
|
init(libraryOnlineTBVC: LibraryOnlineTBVC?) {
|
||||||
super.init(presentationContext: libraryOnlineTBVC)
|
super.init(presentationContext: libraryOnlineTBVC)
|
||||||
|
|
||||||
var preferredLanguageCodes = [String]()
|
var preferredLanguageCodes = [String]()
|
||||||
@ -77,7 +77,7 @@ class LanguageFilterAlert: AlertOperation {
|
|||||||
guard let code = language.code else {continue}
|
guard let code = language.code else {continue}
|
||||||
language.isDisplayed = preferredLanguageCodes.contains(code)
|
language.isDisplayed = preferredLanguageCodes.contains(code)
|
||||||
}
|
}
|
||||||
libraryOnlineTBVC.refreshFetchedResultController()
|
libraryOnlineTBVC?.refreshFetchedResultController()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
addAction(LocalizedStrings.cancel)
|
addAction(LocalizedStrings.cancel)
|
||||||
@ -91,3 +91,15 @@ class LanguageFilterAlert: AlertOperation {
|
|||||||
return a + " " + LocalizedStrings.and + " " + b
|
return a + " " + LocalizedStrings.and + " " + b
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class RefreshLibraryInternetRequiredAlert: AlertOperation {
|
||||||
|
override init(presentationContext: UIViewController?) {
|
||||||
|
super.init(presentationContext: presentationContext)
|
||||||
|
|
||||||
|
let comment = "Library: Internet Required Alert"
|
||||||
|
|
||||||
|
title = NSLocalizedString("Internet Connection Required", comment: comment)
|
||||||
|
message = NSLocalizedString("You need to connect to the Internet to refresh the library.", comment: comment)
|
||||||
|
addAction(LocalizedStrings.ok)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
// AppDelegate.swift
|
// AppDelegate.swift
|
||||||
// Kiwix
|
// Kiwix
|
||||||
//
|
//
|
||||||
|
@ -10,7 +10,7 @@ import UIKit
|
|||||||
|
|
||||||
// MARK: - Normal Cells
|
// MARK: - Normal Cells
|
||||||
|
|
||||||
class ScopeBookCell: UITableViewCell {
|
class BasicBookCell: UITableViewCell {
|
||||||
private let hasPicIndicatorOrange = UIColor(red: 1, green: 0.5, blue: 0, alpha: 1)
|
private let hasPicIndicatorOrange = UIColor(red: 1, green: 0.5, blue: 0, alpha: 1)
|
||||||
private let hasIndexIndicatorBlue = UIColor(red: 0.304706, green: 0.47158, blue: 1, alpha: 1)
|
private let hasIndexIndicatorBlue = UIColor(red: 0.304706, green: 0.47158, blue: 1, alpha: 1)
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ class BookmarkTBVC: UITableViewController, NSFetchedResultsControllerDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func configureCell(cell: UITableViewCell, atIndexPath indexPath: NSIndexPath) {
|
func configureCell(cell: UITableViewCell, atIndexPath indexPath: NSIndexPath) {
|
||||||
guard let cell = cell as? ArticleSnippetCell else {return}
|
guard let cell = cell as? ArticleCell else {return}
|
||||||
guard let article = fetchedResultController.objectAtIndexPath(indexPath) as? Article else {return}
|
guard let article = fetchedResultController.objectAtIndexPath(indexPath) as? Article else {return}
|
||||||
guard let book = article.book else {return}
|
guard let book = article.book else {return}
|
||||||
|
|
||||||
|
@ -312,15 +312,26 @@ sup {
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<h2 id="toc_0">Download a book</h2>
|
<h2 id="toc_0">Add a book</h2>
|
||||||
|
|
||||||
<p>Downloaded books will show up here automatically.</p>
|
<ul>
|
||||||
|
<li>Download a book in app</li>
|
||||||
|
<li>Add books through iTunes File Sharing. They will show up here automatically.</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
<h2 id="toc_1">Import a book</h2>
|
<h2 id="toc_1">About picture and index</h2>
|
||||||
|
|
||||||
<p>Books added through iTunes will be automatically detected too. They instantly become searchable. </p>
|
<ul>
|
||||||
|
<li><img src="/Users/chrisli/Desktop/P.png" alt="Drawing" style="width: 12px;"/> indicates book has pictures</li>
|
||||||
|
<li><img src="/Users/chrisli/Desktop/I.png" alt="Drawing" style="width: 12px;"/> indicates kiwix can find a idx folder associated with the book
|
||||||
|
|
||||||
<p>You can also include / exclude a book in search by going to main interface -> searchbar -> search setting (the wrench icon).</p>
|
<ul>
|
||||||
|
<li>To add index, rename the idx folder to zim file name + .idx. For example, if the zim file is xyz.zim or xyz.zimaa, xyz.zimab, etc., name the idx folder xyz.zim.idx</li>
|
||||||
|
<li>You may have to restart the app for Kiwix to recognize the idx folder</li>
|
||||||
|
</ul></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h3 id="toc_2"><center>Happy Reading!</center></h3>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
## Download a book
|
## Add a book
|
||||||
Downloaded books will show up here automatically.
|
* Download a book in app
|
||||||
|
* Add books through iTunes File Sharing. They will show up here automatically.
|
||||||
|
|
||||||
## Import a book
|
## About picture and index
|
||||||
Books added through iTunes File Sharing will be detected automatically. They instantly become searchable.
|
* <img src="/Users/chrisli/Desktop/P.png" alt="Drawing" style="width: 12px;"/> indicates book has pictures
|
||||||
|
* <img src="/Users/chrisli/Desktop/I.png" alt="Drawing" style="width: 12px;"/> indicates kiwix can find a idx folder associated with the book
|
||||||
|
* To add index, rename the idx folder to zim file name + .idx. For example, if the zim file is xyz.zim or xyz.zimaa, xyz.zimab, etc., name the idx folder xyz.zim.idx
|
||||||
|
* You may have to restart the app for Kiwix to recognize the idx folder
|
||||||
|
|
||||||
You can also include / exclude a book in search by going to main interface -> search bar -> search setting (the wrench icon).
|
### <center>Happy Reading!</center>
|
||||||
|
|
||||||
> Q: What does I
|
|
@ -3,6 +3,7 @@
|
|||||||
<dependencies>
|
<dependencies>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
|
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
|
||||||
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
|
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
|
||||||
|
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<scenes>
|
<scenes>
|
||||||
<!--Library Tab Bar Controller-->
|
<!--Library Tab Bar Controller-->
|
||||||
@ -358,78 +359,119 @@
|
|||||||
<!--Library LocalTBVC-->
|
<!--Library LocalTBVC-->
|
||||||
<scene sceneID="Yg5-WZ-rA5">
|
<scene sceneID="Yg5-WZ-rA5">
|
||||||
<objects>
|
<objects>
|
||||||
<tableViewController hidesBottomBarWhenPushed="YES" id="0Nq-lG-X15" customClass="LibraryLocalTBVC" customModule="Kiwix" customModuleProvider="target" sceneMemberID="viewController">
|
<tableViewController id="0Nq-lG-X15" customClass="LibraryLocalTBVC" customModule="Kiwix" customModuleProvider="target" sceneMemberID="viewController">
|
||||||
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" id="D2l-PQ-jkT">
|
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" id="D2l-PQ-jkT">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||||
<prototypes>
|
<prototypes>
|
||||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="Cell" id="DW9-Uz-qm3" customClass="LocalBookCell" customModule="Kiwix" customModuleProvider="target">
|
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="Cell" id="DDG-cf-Mys" customClass="BasicBookCell" customModule="Kiwix" customModuleProvider="target">
|
||||||
<rect key="frame" x="0.0" y="92" width="600" height="44"/>
|
<rect key="frame" x="0.0" y="92" width="600" height="44"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="DW9-Uz-qm3" id="VMr-uW-Ag0">
|
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="DDG-cf-Mys" id="XX5-rM-xxX">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="567" height="43.5"/>
|
<rect key="frame" x="0.0" y="0.0" width="600" height="43.5"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="LS4-pL-Xoa">
|
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" lineBreakMode="tailTruncation" minimumFontSize="8" adjustsLetterSpacingToFitWidth="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Iuo-Go-bTN">
|
||||||
<rect key="frame" x="6" y="6" width="32" height="32"/>
|
<rect key="frame" x="59" y="6" width="533" height="20"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="width" constant="32" id="fCm-fa-aO6"/>
|
<constraint firstAttribute="height" constant="19.5" id="6UM-WJ-K8N"/>
|
||||||
<constraint firstAttribute="height" constant="32" id="wDj-E2-1qg"/>
|
|
||||||
</constraints>
|
|
||||||
</imageView>
|
|
||||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="28W-Rp-pCD">
|
|
||||||
<rect key="frame" x="42" y="6" width="2" height="32"/>
|
|
||||||
<color key="backgroundColor" red="1" green="0.40000000000000002" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
|
|
||||||
<constraints>
|
|
||||||
<constraint firstAttribute="width" constant="2" id="IKg-Tc-bbc"/>
|
|
||||||
</constraints>
|
|
||||||
</view>
|
|
||||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1dK-dg-Wcp">
|
|
||||||
<rect key="frame" x="48" y="26" width="510" height="12"/>
|
|
||||||
<fontDescription key="fontDescription" type="system" pointSize="11"/>
|
|
||||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
|
|
||||||
<nil key="highlightedColor"/>
|
|
||||||
</label>
|
|
||||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" lineBreakMode="tailTruncation" minimumFontSize="8" adjustsLetterSpacingToFitWidth="YES" translatesAutoresizingMaskIntoConstraints="NO" id="RdO-qw-xfv">
|
|
||||||
<rect key="frame" x="48" y="6" width="510" height="20"/>
|
|
||||||
<constraints>
|
|
||||||
<constraint firstAttribute="height" constant="19.5" id="odv-Qr-8Ph"/>
|
|
||||||
</constraints>
|
</constraints>
|
||||||
<fontDescription key="fontDescription" type="system" pointSize="16"/>
|
<fontDescription key="fontDescription" type="system" pointSize="16"/>
|
||||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
|
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
|
||||||
<nil key="highlightedColor"/>
|
<nil key="highlightedColor"/>
|
||||||
</label>
|
</label>
|
||||||
|
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="aCd-Pp-eaQ">
|
||||||
|
<rect key="frame" x="6" y="6" width="32" height="32"/>
|
||||||
|
<constraints>
|
||||||
|
<constraint firstAttribute="width" constant="32" id="Htl-gy-6U4"/>
|
||||||
|
<constraint firstAttribute="height" constant="32" id="p8s-cv-nJc"/>
|
||||||
|
</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="Lh8-wm-jXh">
|
||||||
|
<rect key="frame" x="59" y="26" width="533" height="12"/>
|
||||||
|
<fontDescription key="fontDescription" type="system" pointSize="11"/>
|
||||||
|
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
|
||||||
|
<nil key="highlightedColor"/>
|
||||||
|
</label>
|
||||||
|
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="P" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="iry-4l-Vnn">
|
||||||
|
<rect key="frame" x="42" y="6" width="13" height="13"/>
|
||||||
|
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
|
||||||
|
<constraints>
|
||||||
|
<constraint firstAttribute="width" constant="13" id="6du-kL-n9g"/>
|
||||||
|
<constraint firstAttribute="height" constant="13" id="8tA-Vv-Eip"/>
|
||||||
|
</constraints>
|
||||||
|
<fontDescription key="fontDescription" type="system" pointSize="11"/>
|
||||||
|
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
|
||||||
|
<nil key="highlightedColor"/>
|
||||||
|
</label>
|
||||||
|
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="I" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rRM-N1-WwQ">
|
||||||
|
<rect key="frame" x="42" y="23" width="13" height="13"/>
|
||||||
|
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
|
||||||
|
<constraints>
|
||||||
|
<constraint firstAttribute="height" constant="13" id="45I-IU-tr8"/>
|
||||||
|
<constraint firstAttribute="width" constant="13" id="6xD-Gw-A5S"/>
|
||||||
|
</constraints>
|
||||||
|
<fontDescription key="fontDescription" type="system" pointSize="11"/>
|
||||||
|
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
|
||||||
|
<nil key="highlightedColor"/>
|
||||||
|
</label>
|
||||||
|
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="GcZ-Eq-rP2">
|
||||||
|
<rect key="frame" x="42" y="19" width="10" height="4"/>
|
||||||
|
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||||
|
<constraints>
|
||||||
|
<constraint firstAttribute="width" constant="10" id="R1o-wk-FLE"/>
|
||||||
|
<constraint firstAttribute="height" constant="4" id="yrE-U0-mai"/>
|
||||||
|
</constraints>
|
||||||
|
<variation key="default">
|
||||||
|
<mask key="constraints">
|
||||||
|
<exclude reference="yrE-U0-mai"/>
|
||||||
|
</mask>
|
||||||
|
</variation>
|
||||||
|
</view>
|
||||||
</subviews>
|
</subviews>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstItem="RdO-qw-xfv" firstAttribute="top" secondItem="VMr-uW-Ag0" secondAttribute="topMargin" constant="-2" id="DfW-ZU-bQx"/>
|
<constraint firstItem="rRM-N1-WwQ" firstAttribute="top" secondItem="Lh8-wm-jXh" secondAttribute="top" id="51A-O3-sWq"/>
|
||||||
<constraint firstItem="LS4-pL-Xoa" firstAttribute="centerY" secondItem="VMr-uW-Ag0" secondAttribute="centerY" id="IaA-5D-Dmp"/>
|
<constraint firstItem="GcZ-Eq-rP2" firstAttribute="leading" secondItem="aCd-Pp-eaQ" secondAttribute="trailing" constant="4" id="DEx-cH-Uby"/>
|
||||||
<constraint firstItem="LS4-pL-Xoa" firstAttribute="leading" secondItem="VMr-uW-Ag0" secondAttribute="leadingMargin" constant="-2" id="Qhc-Iy-GjC"/>
|
<constraint firstItem="rRM-N1-WwQ" firstAttribute="top" secondItem="GcZ-Eq-rP2" secondAttribute="bottom" id="E9x-Ms-MmD"/>
|
||||||
<constraint firstItem="28W-Rp-pCD" firstAttribute="top" secondItem="VMr-uW-Ag0" secondAttribute="topMargin" constant="-2" id="Qsf-uB-7GK"/>
|
<constraint firstItem="Iuo-Go-bTN" firstAttribute="top" secondItem="XX5-rM-xxX" secondAttribute="topMargin" constant="-2" id="L1t-1M-Poa"/>
|
||||||
<constraint firstItem="RdO-qw-xfv" firstAttribute="leading" secondItem="28W-Rp-pCD" secondAttribute="trailing" constant="4" id="RHW-C1-XcJ"/>
|
<constraint firstItem="rRM-N1-WwQ" firstAttribute="leading" secondItem="aCd-Pp-eaQ" secondAttribute="trailing" constant="4" id="R58-fp-AqP"/>
|
||||||
<constraint firstItem="1dK-dg-Wcp" firstAttribute="leading" secondItem="28W-Rp-pCD" secondAttribute="trailing" constant="4" id="Y4i-AS-HAb"/>
|
<constraint firstItem="GcZ-Eq-rP2" firstAttribute="height" secondItem="XX5-rM-xxX" secondAttribute="height" multiplier="0.09" id="UTH-Bf-ssb"/>
|
||||||
<constraint firstAttribute="bottomMargin" secondItem="28W-Rp-pCD" secondAttribute="bottom" constant="-2.5" id="b2x-zw-yBw"/>
|
<constraint firstItem="GcZ-Eq-rP2" firstAttribute="top" secondItem="iry-4l-Vnn" secondAttribute="bottom" id="Wxd-bX-B02"/>
|
||||||
<constraint firstAttribute="bottomMargin" secondItem="1dK-dg-Wcp" secondAttribute="bottom" constant="-2.5" id="eRS-mq-sSL"/>
|
<constraint firstItem="iry-4l-Vnn" firstAttribute="top" secondItem="Iuo-Go-bTN" secondAttribute="top" id="ZaU-12-pNb"/>
|
||||||
<constraint firstItem="28W-Rp-pCD" firstAttribute="leading" secondItem="LS4-pL-Xoa" secondAttribute="trailing" constant="4" id="iSq-mo-lJi"/>
|
<constraint firstItem="Lh8-wm-jXh" firstAttribute="leading" secondItem="rRM-N1-WwQ" secondAttribute="trailing" constant="4" id="aDF-jX-esb"/>
|
||||||
<constraint firstItem="1dK-dg-Wcp" firstAttribute="top" secondItem="RdO-qw-xfv" secondAttribute="bottom" id="nvc-np-E69"/>
|
<constraint firstItem="Iuo-Go-bTN" firstAttribute="leading" secondItem="iry-4l-Vnn" secondAttribute="trailing" constant="4" id="csp-gh-yi1"/>
|
||||||
|
<constraint firstItem="aCd-Pp-eaQ" firstAttribute="leading" secondItem="XX5-rM-xxX" secondAttribute="leadingMargin" constant="-2" id="ecG-3C-wXV"/>
|
||||||
|
<constraint firstItem="Lh8-wm-jXh" firstAttribute="top" secondItem="Iuo-Go-bTN" secondAttribute="bottom" id="lRB-Ar-3U6"/>
|
||||||
|
<constraint firstItem="GcZ-Eq-rP2" firstAttribute="centerY" secondItem="XX5-rM-xxX" secondAttribute="centerY" id="oie-lC-n0m"/>
|
||||||
|
<constraint firstItem="iry-4l-Vnn" firstAttribute="leading" secondItem="aCd-Pp-eaQ" secondAttribute="trailing" constant="4" id="qbb-h5-cCB"/>
|
||||||
|
<constraint firstItem="aCd-Pp-eaQ" firstAttribute="centerY" secondItem="XX5-rM-xxX" secondAttribute="centerY" id="rbX-m2-r2Y"/>
|
||||||
|
<constraint firstAttribute="bottomMargin" secondItem="Lh8-wm-jXh" secondAttribute="bottom" constant="-2.5" id="wOe-fs-UE8"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
|
<variation key="default">
|
||||||
|
<mask key="constraints">
|
||||||
|
<exclude reference="ZaU-12-pNb"/>
|
||||||
|
<exclude reference="51A-O3-sWq"/>
|
||||||
|
</mask>
|
||||||
|
</variation>
|
||||||
</tableViewCellContentView>
|
</tableViewCellContentView>
|
||||||
|
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="trailing" secondItem="RdO-qw-xfv" secondAttribute="trailing" constant="42" id="9dR-Ac-e4R"/>
|
<constraint firstAttribute="trailing" secondItem="Lh8-wm-jXh" secondAttribute="trailing" constant="8" id="UVT-wl-c2t"/>
|
||||||
<constraint firstItem="LS4-pL-Xoa" firstAttribute="top" secondItem="DW9-Uz-qm3" secondAttribute="top" constant="6" id="QrU-EI-mju"/>
|
<constraint firstItem="aCd-Pp-eaQ" firstAttribute="top" secondItem="DDG-cf-Mys" secondAttribute="top" constant="6" id="eTZ-tk-NDL"/>
|
||||||
<constraint firstAttribute="trailing" secondItem="1dK-dg-Wcp" secondAttribute="trailing" constant="42" id="vsV-lK-41G"/>
|
<constraint firstAttribute="trailing" secondItem="Iuo-Go-bTN" secondAttribute="trailing" constant="8" id="fPE-3E-GrE"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<variation key="default">
|
<variation key="default">
|
||||||
<mask key="constraints">
|
<mask key="constraints">
|
||||||
<exclude reference="QrU-EI-mju"/>
|
<exclude reference="eTZ-tk-NDL"/>
|
||||||
</mask>
|
</mask>
|
||||||
</variation>
|
</variation>
|
||||||
<connections>
|
<connections>
|
||||||
<outlet property="favIcon" destination="LS4-pL-Xoa" id="8t2-OC-Bwj"/>
|
<outlet property="favIcon" destination="aCd-Pp-eaQ" id="ZCm-fK-dwD"/>
|
||||||
<outlet property="hasPicIndicator" destination="28W-Rp-pCD" id="h8L-fx-tFc"/>
|
<outlet property="hasIndexIndicator" destination="rRM-N1-WwQ" id="gMl-5Q-MvE"/>
|
||||||
<outlet property="subtitleLabel" destination="1dK-dg-Wcp" id="Pbv-S7-BEb"/>
|
<outlet property="hasPicIndicator" destination="iry-4l-Vnn" id="vtX-Df-7RM"/>
|
||||||
<outlet property="titleLabel" destination="RdO-qw-xfv" id="ulf-U4-srm"/>
|
<outlet property="subtitleLabel" destination="Lh8-wm-jXh" id="DFw-3z-YmO"/>
|
||||||
<segue destination="NUs-oQ-3KH" kind="show" identifier="showBookDetail" id="dEx-Dd-RKo"/>
|
<outlet property="titleLabel" destination="Iuo-Go-bTN" id="A9k-wr-inZ"/>
|
||||||
</connections>
|
</connections>
|
||||||
</tableViewCell>
|
</tableViewCell>
|
||||||
</prototypes>
|
</prototypes>
|
||||||
@ -481,8 +523,8 @@
|
|||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<color key="backgroundColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="calibratedRGB"/>
|
<color key="backgroundColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="calibratedRGB"/>
|
||||||
<prototypes>
|
<prototypes>
|
||||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="Cell" textLabel="ZEq-mN-wfj" detailTextLabel="Xyr-0M-RWU" style="IBUITableViewCellStyleValue1" id="pJP-PP-g4s">
|
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="Cell" textLabel="ZEq-mN-wfj" detailTextLabel="Xyr-0M-RWU" style="IBUITableViewCellStyleValue1" id="pJP-PP-g4s">
|
||||||
<rect key="frame" x="0.0" y="113.5" width="600" height="44"/>
|
<rect key="frame" x="0.0" y="49.5" width="600" height="44"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="pJP-PP-g4s" id="WdZ-6d-Fcx">
|
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="pJP-PP-g4s" id="WdZ-6d-Fcx">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="600" height="43.5"/>
|
<rect key="frame" x="0.0" y="0.0" width="600" height="43.5"/>
|
||||||
|
@ -93,7 +93,8 @@ class LibraryDownloadTBVC: UITableViewController, NSFetchedResultsControllerDele
|
|||||||
}
|
}
|
||||||
|
|
||||||
func configureMessage() {
|
func configureMessage() {
|
||||||
guard let count = fetchedResultController.fetchedObjects?.count else {return}
|
guard let sectionInfos = fetchedResultController.sections else {messageButton.text = nil; return}
|
||||||
|
let count = sectionInfos.reduce(0) {$0 + $1.numberOfObjects}
|
||||||
let localizedString = String.localizedStringWithFormat(NSLocalizedString("%d download tasks", comment: "Book Library, book downloader message"), count)
|
let localizedString = String.localizedStringWithFormat(NSLocalizedString("%d download tasks", comment: "Book Library, book downloader message"), count)
|
||||||
messageButton.text = localizedString
|
messageButton.text = localizedString
|
||||||
}
|
}
|
||||||
@ -227,12 +228,12 @@ class LibraryDownloadTBVC: UITableViewController, NSFetchedResultsControllerDele
|
|||||||
let book = downloadTask.book else {return}
|
let book = downloadTask.book else {return}
|
||||||
Network.sharedInstance.cancel(book)
|
Network.sharedInstance.cancel(book)
|
||||||
book.isLocal = false
|
book.isLocal = false
|
||||||
|
FileManager.removeResumeData(book)
|
||||||
let context = UIApplication.appDelegate.managedObjectContext
|
let context = UIApplication.appDelegate.managedObjectContext
|
||||||
context.performBlockAndWait({ () -> Void in
|
context.performBlockAndWait({ () -> Void in
|
||||||
book.isLocal = false
|
book.isLocal = false
|
||||||
context.deleteObject(downloadTask)
|
context.deleteObject(downloadTask)
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
return [remove]
|
return [remove]
|
||||||
}
|
}
|
||||||
|
@ -11,27 +11,53 @@ import UIKit
|
|||||||
class LibraryLocalBookDetailTBVC: UITableViewController {
|
class LibraryLocalBookDetailTBVC: UITableViewController {
|
||||||
|
|
||||||
var book: Book?
|
var book: Book?
|
||||||
|
let sections = [LocalizedStrings.info, LocalizedStrings.file]
|
||||||
|
let titles = [[LocalizedStrings.title, LocalizedStrings.creationDate, LocalizedStrings.articleCount, LocalizedStrings.mediaCount],
|
||||||
|
[LocalizedStrings.size, LocalizedStrings.fileName]]
|
||||||
|
|
||||||
override func viewDidLoad() {
|
override func viewDidLoad() {
|
||||||
super.viewDidLoad()
|
super.viewDidLoad()
|
||||||
title = book?.title
|
title = book?.title
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override func viewWillAppear(animated: Bool) {
|
||||||
|
super.viewWillAppear(animated)
|
||||||
|
navigationController?.toolbarHidden = true
|
||||||
|
}
|
||||||
|
|
||||||
|
override func viewWillDisappear(animated: Bool) {
|
||||||
|
super.viewWillDisappear(animated)
|
||||||
|
navigationController?.toolbarHidden = false
|
||||||
|
}
|
||||||
|
|
||||||
// MARK: - Table view data source
|
// MARK: - Table view data source
|
||||||
|
|
||||||
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
|
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
|
||||||
return book == nil ? 0 : 1
|
return book == nil ? 0 : sections.count
|
||||||
}
|
}
|
||||||
|
|
||||||
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||||
return 1
|
return titles[section].count
|
||||||
}
|
}
|
||||||
|
|
||||||
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
|
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
|
||||||
let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath)
|
let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath)
|
||||||
|
|
||||||
// Configure the cell...
|
cell.textLabel?.text = titles[indexPath.section][indexPath.row]
|
||||||
|
cell.detailTextLabel?.text = "placehold"
|
||||||
|
|
||||||
return cell
|
return cell
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension LocalizedStrings {
|
||||||
|
class var info: String {return NSLocalizedString("Info", comment: "Book Detail")}
|
||||||
|
class var title: String {return NSLocalizedString("Title", comment: "Book Detail")}
|
||||||
|
class var creationDate: String {return NSLocalizedString("Creation Date", comment: "Book Detail")}
|
||||||
|
class var articleCount: String {return NSLocalizedString("Article Count", comment: "Book Detail")}
|
||||||
|
class var mediaCount: String {return NSLocalizedString("Media Count", comment: "Book Detail")}
|
||||||
|
|
||||||
|
class var file: String {return NSLocalizedString("File", comment: "Book Detail")}
|
||||||
|
class var size: String {return NSLocalizedString("size", comment: "Book Detail")}
|
||||||
|
class var fileName: String {return NSLocalizedString("File Name", comment: "Book Detail")}
|
||||||
|
}
|
||||||
|
@ -135,12 +135,14 @@ class LibraryLocalTBVC: UITableViewController, NSFetchedResultsControllerDelegat
|
|||||||
|
|
||||||
func configureCell(cell: UITableViewCell, atIndexPath indexPath: NSIndexPath) {
|
func configureCell(cell: UITableViewCell, atIndexPath indexPath: NSIndexPath) {
|
||||||
guard let book = fetchedResultController.objectAtIndexPath(indexPath) as? Book else {return}
|
guard let book = fetchedResultController.objectAtIndexPath(indexPath) as? Book else {return}
|
||||||
guard let cell = cell as? LocalBookCell else {return}
|
guard let cell = cell as? BasicBookCell else {return}
|
||||||
|
|
||||||
cell.titleLabel.text = book.title
|
cell.titleLabel.text = book.title
|
||||||
cell.hasPicIndicator.backgroundColor = book.hasPic ? UIColor.havePicTintColor : UIColor.lightGrayColor()
|
|
||||||
cell.favIcon.image = UIImage(data: book.favIcon ?? NSData())
|
|
||||||
cell.subtitleLabel.text = book.detailedDescription1
|
cell.subtitleLabel.text = book.detailedDescription1
|
||||||
|
|
||||||
|
cell.favIcon.image = UIImage(data: book.favIcon ?? NSData())
|
||||||
|
cell.hasPic = book.hasPic
|
||||||
|
cell.hasIndex = book.hasIndex
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: Other Data Source
|
// MARK: Other Data Source
|
||||||
@ -187,6 +189,9 @@ class LibraryLocalTBVC: UITableViewController, NSFetchedResultsControllerDelegat
|
|||||||
self.managedObjectContext.performBlock({ () -> Void in
|
self.managedObjectContext.performBlock({ () -> Void in
|
||||||
if let id = book.id, let zimURL = ZIMMultiReader.sharedInstance.readers[id]?.fileURL {
|
if let id = book.id, let zimURL = ZIMMultiReader.sharedInstance.readers[id]?.fileURL {
|
||||||
FileManager.removeItem(atURL: zimURL)
|
FileManager.removeItem(atURL: zimURL)
|
||||||
|
|
||||||
|
let indexFolderURL = zimURL.URLByAppendingPathExtension("idx")
|
||||||
|
FileManager.removeItem(atURL: indexFolderURL)
|
||||||
}
|
}
|
||||||
|
|
||||||
if let _ = book.url {
|
if let _ = book.url {
|
||||||
|
@ -78,10 +78,6 @@ class LibraryOnlineTBVC: UITableViewController, NSFetchedResultsControllerDelega
|
|||||||
func refreshDidFinish() {
|
func refreshDidFinish() {
|
||||||
configureRefreshStatus()
|
configureRefreshStatus()
|
||||||
configureToolBarVisibility(animated: true)
|
configureToolBarVisibility(animated: true)
|
||||||
|
|
||||||
guard !Preference.libraryHasShownPreferredLanguagePrompt else {return}
|
|
||||||
let langFilterOperation = LanguageFilterAlert(libraryOnlineTBVC: self)
|
|
||||||
UIApplication.appDelegate.globalOperationQueue.addOperation(langFilterOperation)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Others
|
// MARK: - Others
|
||||||
@ -139,7 +135,8 @@ class LibraryOnlineTBVC: UITableViewController, NSFetchedResultsControllerDelega
|
|||||||
|
|
||||||
func configureMessage(isRefreshing isRefreshing: Bool = false) {
|
func configureMessage(isRefreshing isRefreshing: Bool = false) {
|
||||||
if !isRefreshing {
|
if !isRefreshing {
|
||||||
guard let count = fetchedResultController.fetchedObjects?.count else {messageButton.text = nil; return}
|
guard let sectionInfos = fetchedResultController.sections else {messageButton.text = nil; return}
|
||||||
|
let count = sectionInfos.reduce(0) {$0 + $1.numberOfObjects}
|
||||||
let localizedBookCountString = String.localizedStringWithFormat(NSLocalizedString("%d book(s) available for download", comment: "Book Library, online book catalogue message"), count)
|
let localizedBookCountString = String.localizedStringWithFormat(NSLocalizedString("%d book(s) available for download", comment: "Book Library, online book catalogue message"), count)
|
||||||
guard count > 0 else {messageButton.text = localizedBookCountString; return}
|
guard count > 0 else {messageButton.text = localizedBookCountString; return}
|
||||||
guard let lastRefreshTime = Preference.libraryLastRefreshTime else {messageButton.text = localizedBookCountString; return}
|
guard let lastRefreshTime = Preference.libraryLastRefreshTime else {messageButton.text = localizedBookCountString; return}
|
||||||
|
@ -372,7 +372,7 @@
|
|||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||||
<prototypes>
|
<prototypes>
|
||||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="blue" indentationWidth="10" reuseIdentifier="Cell" id="QXK-je-ISm" customClass="ScopeBookCell" customModule="Kiwix" customModuleProvider="target">
|
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="Cell" id="QXK-je-ISm" customClass="BasicBookCell" customModule="Kiwix">
|
||||||
<rect key="frame" x="0.0" y="28" width="600" height="44"/>
|
<rect key="frame" x="0.0" y="28" width="600" height="44"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="QXK-je-ISm" id="bj5-Xo-SR6">
|
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="QXK-je-ISm" id="bj5-Xo-SR6">
|
||||||
@ -402,7 +402,7 @@
|
|||||||
<nil key="highlightedColor"/>
|
<nil key="highlightedColor"/>
|
||||||
</label>
|
</label>
|
||||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="P" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="TmV-G9-g51">
|
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="P" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="TmV-G9-g51">
|
||||||
<rect key="frame" x="42" y="6.5" width="13" height="13"/>
|
<rect key="frame" x="42" y="6" width="13" height="13"/>
|
||||||
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
|
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="height" constant="13" id="TX0-hy-6dI"/>
|
<constraint firstAttribute="height" constant="13" id="TX0-hy-6dI"/>
|
||||||
@ -413,7 +413,7 @@
|
|||||||
<nil key="highlightedColor"/>
|
<nil key="highlightedColor"/>
|
||||||
</label>
|
</label>
|
||||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="I" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="9y6-m2-QTb">
|
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="I" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="9y6-m2-QTb">
|
||||||
<rect key="frame" x="42" y="23.5" width="13" height="13"/>
|
<rect key="frame" x="42" y="23" width="13" height="13"/>
|
||||||
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
|
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="height" constant="13" id="UWv-F1-PPl"/>
|
<constraint firstAttribute="height" constant="13" id="UWv-F1-PPl"/>
|
||||||
@ -424,18 +424,24 @@
|
|||||||
<nil key="highlightedColor"/>
|
<nil key="highlightedColor"/>
|
||||||
</label>
|
</label>
|
||||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="PGj-Uz-NTF">
|
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="PGj-Uz-NTF">
|
||||||
<rect key="frame" x="42" y="19.5" width="10" height="4"/>
|
<rect key="frame" x="42" y="19" width="10" height="4"/>
|
||||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="width" constant="10" id="JY1-4a-Im0"/>
|
<constraint firstAttribute="width" constant="10" id="JY1-4a-Im0"/>
|
||||||
<constraint firstAttribute="height" constant="4" id="O29-j7-kSU"/>
|
<constraint firstAttribute="height" constant="4" id="O29-j7-kSU"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
|
<variation key="default">
|
||||||
|
<mask key="constraints">
|
||||||
|
<exclude reference="O29-j7-kSU"/>
|
||||||
|
</mask>
|
||||||
|
</variation>
|
||||||
</view>
|
</view>
|
||||||
</subviews>
|
</subviews>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstItem="PGj-Uz-NTF" firstAttribute="leading" secondItem="bxk-BM-3An" secondAttribute="trailing" constant="4" id="3B6-jN-jbK"/>
|
<constraint firstItem="PGj-Uz-NTF" firstAttribute="leading" secondItem="bxk-BM-3An" secondAttribute="trailing" constant="4" id="3B6-jN-jbK"/>
|
||||||
<constraint firstItem="g8b-RO-czj" firstAttribute="top" secondItem="bj5-Xo-SR6" secondAttribute="topMargin" constant="-2" id="3wG-Wf-uAm"/>
|
<constraint firstItem="g8b-RO-czj" firstAttribute="top" secondItem="bj5-Xo-SR6" secondAttribute="topMargin" constant="-2" id="3wG-Wf-uAm"/>
|
||||||
<constraint firstItem="9y6-m2-QTb" firstAttribute="leading" secondItem="bxk-BM-3An" secondAttribute="trailing" constant="4" id="6va-XC-chZ"/>
|
<constraint firstItem="9y6-m2-QTb" firstAttribute="leading" secondItem="bxk-BM-3An" secondAttribute="trailing" constant="4" id="6va-XC-chZ"/>
|
||||||
|
<constraint firstItem="PGj-Uz-NTF" firstAttribute="height" secondItem="bj5-Xo-SR6" secondAttribute="height" multiplier="0.09" id="9ds-vD-nqD"/>
|
||||||
<constraint firstItem="TmV-G9-g51" firstAttribute="top" secondItem="g8b-RO-czj" secondAttribute="top" id="AcV-0E-WGd"/>
|
<constraint firstItem="TmV-G9-g51" firstAttribute="top" secondItem="g8b-RO-czj" secondAttribute="top" id="AcV-0E-WGd"/>
|
||||||
<constraint firstAttribute="bottomMargin" secondItem="Lna-QC-TaS" secondAttribute="bottom" constant="-2.5" id="BQQ-R5-5fd"/>
|
<constraint firstAttribute="bottomMargin" secondItem="Lna-QC-TaS" secondAttribute="bottom" constant="-2.5" id="BQQ-R5-5fd"/>
|
||||||
<constraint firstItem="9y6-m2-QTb" firstAttribute="top" secondItem="PGj-Uz-NTF" secondAttribute="bottom" id="LrR-7P-oLk"/>
|
<constraint firstItem="9y6-m2-QTb" firstAttribute="top" secondItem="PGj-Uz-NTF" secondAttribute="bottom" id="LrR-7P-oLk"/>
|
||||||
@ -506,7 +512,7 @@
|
|||||||
<rect key="frame" x="15" y="0.0" width="570" height="43.5"/>
|
<rect key="frame" x="15" y="0.0" width="570" height="43.5"/>
|
||||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||||
<fontDescription key="fontDescription" type="system" pointSize="16"/>
|
<fontDescription key="fontDescription" type="system" pointSize="16"/>
|
||||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
|
||||||
<nil key="highlightedColor"/>
|
<nil key="highlightedColor"/>
|
||||||
</label>
|
</label>
|
||||||
</subviews>
|
</subviews>
|
||||||
@ -1005,7 +1011,7 @@
|
|||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="height" constant="30" id="IJN-Sq-wew"/>
|
<constraint firstAttribute="height" constant="30" id="IJN-Sq-wew"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<state key="normal" image="Home"/>
|
<state key="normal" image="MainPage"/>
|
||||||
<connections>
|
<connections>
|
||||||
<action selector="mainPageButtonTapped:" destination="9gZ-CS-CgY" eventType="touchUpInside" id="eP8-f4-PRQ"/>
|
<action selector="mainPageButtonTapped:" destination="9gZ-CS-CgY" eventType="touchUpInside" id="eP8-f4-PRQ"/>
|
||||||
</connections>
|
</connections>
|
||||||
@ -1089,42 +1095,11 @@
|
|||||||
</objects>
|
</objects>
|
||||||
<point key="canvasLocation" x="1852" y="-1015"/>
|
<point key="canvasLocation" x="1852" y="-1015"/>
|
||||||
</scene>
|
</scene>
|
||||||
<!--Item-->
|
|
||||||
<scene sceneID="IL6-vK-0b0">
|
|
||||||
<objects>
|
|
||||||
<viewController storyboardIdentifier="Controller1" id="gyW-Ny-9yk" sceneMemberID="viewController">
|
|
||||||
<layoutGuides>
|
|
||||||
<viewControllerLayoutGuide type="top" id="dkW-zK-ilF"/>
|
|
||||||
<viewControllerLayoutGuide type="bottom" id="tnO-qA-Knc"/>
|
|
||||||
</layoutGuides>
|
|
||||||
<view key="view" contentMode="scaleToFill" id="qYz-v0-7vl">
|
|
||||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
|
||||||
<subviews>
|
|
||||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="This page will show search history" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="k23-fr-Mg5">
|
|
||||||
<rect key="frame" x="169.5" y="289" width="261" height="21"/>
|
|
||||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
|
||||||
<color key="textColor" red="0.0" green="0.0" blue="1" alpha="1" colorSpace="calibratedRGB"/>
|
|
||||||
<nil key="highlightedColor"/>
|
|
||||||
</label>
|
|
||||||
</subviews>
|
|
||||||
<color key="backgroundColor" red="1" green="0.59999999999999998" blue="0.40000000000000002" alpha="1" colorSpace="calibratedRGB"/>
|
|
||||||
<constraints>
|
|
||||||
<constraint firstItem="k23-fr-Mg5" firstAttribute="centerY" secondItem="qYz-v0-7vl" secondAttribute="centerY" id="N6j-d1-r3Z"/>
|
|
||||||
<constraint firstItem="k23-fr-Mg5" firstAttribute="centerX" secondItem="qYz-v0-7vl" secondAttribute="centerX" id="nCE-sd-G7m"/>
|
|
||||||
</constraints>
|
|
||||||
</view>
|
|
||||||
<tabBarItem key="tabBarItem" title="Item" id="Y8H-9B-SVJ"/>
|
|
||||||
</viewController>
|
|
||||||
<placeholder placeholderIdentifier="IBFirstResponder" id="OGe-hz-Hkf" sceneMemberID="firstResponder"/>
|
|
||||||
</objects>
|
|
||||||
<point key="canvasLocation" x="203" y="-619"/>
|
|
||||||
</scene>
|
|
||||||
</scenes>
|
</scenes>
|
||||||
<resources>
|
<resources>
|
||||||
<image name="DownArrow" width="21" height="21"/>
|
<image name="DownArrow" width="21" height="21"/>
|
||||||
<image name="History" width="21" height="21"/>
|
<image name="History" width="21" height="21"/>
|
||||||
<image name="Home" width="21" height="21"/>
|
<image name="MainPage" width="21" height="21"/>
|
||||||
<image name="SearchSetting" width="21" height="21"/>
|
<image name="SearchSetting" width="21" height="21"/>
|
||||||
<image name="Star" width="21" height="20"/>
|
<image name="Star" width="21" height="20"/>
|
||||||
<image name="StarHighlighted" width="21" height="20"/>
|
<image name="StarHighlighted" width="21" height="20"/>
|
||||||
|
@ -30,7 +30,7 @@ class MainVC: UIViewController {
|
|||||||
super.viewDidLoad()
|
super.viewDidLoad()
|
||||||
|
|
||||||
webView.delegate = self
|
webView.delegate = self
|
||||||
webView.scrollView.delegate = self
|
webView.scrollView.delegate = nil
|
||||||
|
|
||||||
navigationItem.titleView = searchBar
|
navigationItem.titleView = searchBar
|
||||||
searchBar.delegate = self
|
searchBar.delegate = self
|
||||||
|
@ -12,8 +12,10 @@ import CoreData
|
|||||||
class RefreshLibraryOperation: GroupOperation {
|
class RefreshLibraryOperation: GroupOperation {
|
||||||
|
|
||||||
weak var delegate: RefreshLibraryOperationDelegate?
|
weak var delegate: RefreshLibraryOperationDelegate?
|
||||||
|
weak var presentationContext: LibraryOnlineTBVC?
|
||||||
var completionHandler: (() -> Void)?
|
var completionHandler: (() -> Void)?
|
||||||
init(invokedAutomatically: Bool = true, completionHandler: (() -> Void)? = nil) {
|
|
||||||
|
init(invokedAutomatically: Bool, presentationContext: LibraryOnlineTBVC? = nil, completionHandler: (() -> Void)? = nil) {
|
||||||
super.init(operations: [])
|
super.init(operations: [])
|
||||||
|
|
||||||
name = String(RefreshLibraryOperation)
|
name = String(RefreshLibraryOperation)
|
||||||
@ -48,6 +50,7 @@ class RefreshLibraryOperation: GroupOperation {
|
|||||||
if invokedAutomatically {
|
if invokedAutomatically {
|
||||||
addCondition(AllowAutoRefreshCondition())
|
addCondition(AllowAutoRefreshCondition())
|
||||||
addCondition(LibraryIsOldCondition())
|
addCondition(LibraryIsOldCondition())
|
||||||
|
addCondition(ReachabilityCondition(host: url, allowCellular: Preference.libraryRefreshAllowCellularData))
|
||||||
}
|
}
|
||||||
|
|
||||||
addOperation(fetchOperation)
|
addOperation(fetchOperation)
|
||||||
@ -56,7 +59,14 @@ class RefreshLibraryOperation: GroupOperation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override func finished(errors: [NSError]) {
|
override func finished(errors: [NSError]) {
|
||||||
|
if let firstError = errors.first {
|
||||||
|
if firstError.code == .NetworkError {
|
||||||
|
produceOperation(RefreshLibraryInternetRequiredAlert(presentationContext: presentationContext))
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
guard !Preference.libraryHasShownPreferredLanguagePrompt else {return}
|
||||||
|
produceOperation(RefreshLibraryLanguageFilterAlert(libraryOnlineTBVC: presentationContext))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,8 +15,6 @@ class SearchHistoryTBVC: UITableViewController, NSFetchedResultsControllerDelega
|
|||||||
super.viewDidLoad()
|
super.viewDidLoad()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// MARK: - Fetched Results Controller
|
// MARK: - Fetched Results Controller
|
||||||
|
|
||||||
let managedObjectContext = UIApplication.appDelegate.managedObjectContext
|
let managedObjectContext = UIApplication.appDelegate.managedObjectContext
|
||||||
@ -53,6 +51,17 @@ class SearchHistoryTBVC: UITableViewController, NSFetchedResultsControllerDelega
|
|||||||
cell.textLabel?.text = article.title
|
cell.textLabel?.text = article.title
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MARK: - Table view delegates
|
||||||
|
|
||||||
|
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
|
||||||
|
guard let mainVC = parentViewController?.parentViewController?.parentViewController as? MainVC,
|
||||||
|
let article = fetchedResultController.objectAtIndexPath(indexPath) as? Article else {return}
|
||||||
|
mainVC.hideSearch()
|
||||||
|
mainVC.load(article.url)
|
||||||
|
|
||||||
|
tableView.deselectRowAtIndexPath(indexPath, animated: true)
|
||||||
|
}
|
||||||
|
|
||||||
// MARK: - Fetched Result Controller Delegate
|
// MARK: - Fetched Result Controller Delegate
|
||||||
|
|
||||||
func controllerWillChangeContent(controller: NSFetchedResultsController) {
|
func controllerWillChangeContent(controller: NSFetchedResultsController) {
|
||||||
|
@ -24,7 +24,7 @@ class SearchScopeSelectTBVC: UITableViewController, NSFetchedResultsControllerDe
|
|||||||
let titleDescriptor = NSSortDescriptor(key: "title", ascending: true)
|
let titleDescriptor = NSSortDescriptor(key: "title", ascending: true)
|
||||||
fetchRequest.sortDescriptors = [langDescriptor, titleDescriptor]
|
fetchRequest.sortDescriptors = [langDescriptor, titleDescriptor]
|
||||||
fetchRequest.predicate = NSPredicate(format: "isLocal == true")
|
fetchRequest.predicate = NSPredicate(format: "isLocal == true")
|
||||||
let fetchedResultsController = NSFetchedResultsController(fetchRequest: fetchRequest, managedObjectContext: self.managedObjectContext, sectionNameKeyPath: "language.name", cacheName: "ScopeFRC")
|
let fetchedResultsController = NSFetchedResultsController(fetchRequest: fetchRequest, managedObjectContext: self.managedObjectContext, sectionNameKeyPath: nil, cacheName: "ScopeFRC")
|
||||||
fetchedResultsController.delegate = self
|
fetchedResultsController.delegate = self
|
||||||
fetchedResultsController.performFetch(deleteCache: false)
|
fetchedResultsController.performFetch(deleteCache: false)
|
||||||
return fetchedResultsController
|
return fetchedResultsController
|
||||||
@ -37,12 +37,8 @@ class SearchScopeSelectTBVC: UITableViewController, NSFetchedResultsControllerDe
|
|||||||
}
|
}
|
||||||
|
|
||||||
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||||
if section == 0 {
|
guard let sectionInfo = fetchedResultController.sections?[section] else {return 0}
|
||||||
guard let sectionInfo = fetchedResultController.sections?[section] else {return 0}
|
return sectionInfo.numberOfObjects
|
||||||
return sectionInfo.numberOfObjects
|
|
||||||
} else {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
|
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
|
||||||
@ -53,7 +49,7 @@ class SearchScopeSelectTBVC: UITableViewController, NSFetchedResultsControllerDe
|
|||||||
|
|
||||||
func configureCell(cell: UITableViewCell, atIndexPath indexPath: NSIndexPath) {
|
func configureCell(cell: UITableViewCell, atIndexPath indexPath: NSIndexPath) {
|
||||||
guard let book = fetchedResultController.objectAtIndexPath(indexPath) as? Book else {return}
|
guard let book = fetchedResultController.objectAtIndexPath(indexPath) as? Book else {return}
|
||||||
guard let cell = cell as? ScopeBookCell else {return}
|
guard let cell = cell as? BasicBookCell else {return}
|
||||||
|
|
||||||
cell.titleLabel.text = book.title
|
cell.titleLabel.text = book.title
|
||||||
cell.subtitleLabel.text = book.detailedDescription
|
cell.subtitleLabel.text = book.detailedDescription
|
||||||
@ -76,7 +72,6 @@ class SearchScopeSelectTBVC: UITableViewController, NSFetchedResultsControllerDe
|
|||||||
// MARK: Table view delegate
|
// MARK: Table view delegate
|
||||||
|
|
||||||
override func tableView(tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
|
override func tableView(tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
|
||||||
//guard tableView.numberOfSections > 1 else {return 0.0}
|
|
||||||
guard let headerText = self.tableView(tableView, titleForHeaderInSection: section) else {return 0.0}
|
guard let headerText = self.tableView(tableView, titleForHeaderInSection: section) else {return 0.0}
|
||||||
guard headerText != "" else {return 0.0}
|
guard headerText != "" else {return 0.0}
|
||||||
return 20.0
|
return 20.0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user