fix warnings

This commit is contained in:
Chris Li 2016-11-26 17:07:22 -05:00
parent 61218ada6d
commit 0758d73cb3
16 changed files with 74 additions and 189 deletions

View File

@ -73,9 +73,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
return true
}
func application(_ application: UIApplication, didRegister notificationSettings: UIUserNotificationSettings) {
// Here we get what notification permission user currently allows
}
// func application(_ application: UIApplication, didRegister notificationSettings: UIUserNotificationSettings) {
// // Here we get what notification permission user currently allows
// }
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.

View File

@ -80,7 +80,7 @@ class CloudBooksController: LibraryBaseController, UITableViewDelegate, UITableV
func showLanguageFilterController() {
guard let splitViewController = splitViewController as? LibrarySplitViewController, !splitViewController.isShowingLangFilter else {return}
guard let controller = UIStoryboard.library.initViewController(LanguageFilterController.self) else {return}
let controller = UIStoryboard(name: "library", bundle: nil).instantiateViewController(withIdentifier: "LanguageFilterController") as! LanguageFilterController
controller.delegate = self
let navController = UINavigationController(rootViewController: controller)
showDetailViewController(navController, sender: self)
@ -116,7 +116,7 @@ class CloudBooksController: LibraryBaseController, UITableViewDelegate, UITableV
self.tableView.reloadEmptyDataSet()
}
if let error = errors.first {
if let _ = errors.first {
// handle error [network, xmlparse]
} else {
if operation.firstTime {
@ -307,15 +307,16 @@ class CloudBooksController: LibraryBaseController, UITableViewDelegate, UITableV
fetchRequest.sortDescriptors = [langDescriptor, titleDescriptor]
fetchRequest.predicate = self.onlineCompoundPredicate
let fetchedResultsController = NSFetchedResultsController(fetchRequest: fetchRequest, managedObjectContext: self.managedObjectContext, sectionNameKeyPath: "language.name", cacheName: "OnlineFRC" + Bundle.buildVersion)
fetchedResultsController.delegate = self
fetchedResultsController.performFetch(deleteCache: false)
return fetchedResultsController as! NSFetchedResultsController<Book>
let controller = NSFetchedResultsController(fetchRequest: fetchRequest, managedObjectContext: self.managedObjectContext, sectionNameKeyPath: "language.name", cacheName: "OnlineFRC" + Bundle.buildVersion)
controller.delegate = self
try? controller.performFetch()
return controller as! NSFetchedResultsController<Book>
}()
func refreshFetchedResultController() {
fetchedResultController.fetchRequest.predicate = onlineCompoundPredicate
fetchedResultController.performFetch(deleteCache: true)
NSFetchedResultsController<Book>.deleteCache(withName: fetchedResultController.cacheName)
try? fetchedResultController.performFetch()
tableView.reloadData()
}

View File

@ -101,8 +101,8 @@ class DownloadTasksController: LibraryBaseController, UITableViewDelegate, UITab
}
override func configureCell(_ cell: UITableViewCell, atIndexPath indexPath: IndexPath) {
guard let downloadTask = fetchedResultController.object(at: indexPath) as? DownloadTask,
let book = downloadTask.book,
let downloadTask = fetchedResultController.object(at: indexPath)
guard let book = downloadTask.book,
let cell = cell as? DownloadBookCell else {return}
cell.titleLabel.text = book.title
@ -248,10 +248,10 @@ class DownloadTasksController: LibraryBaseController, UITableViewDelegate, UITab
let creationTimeDescriptor = NSSortDescriptor(key: "creationTime", ascending: true)
fetchRequest.sortDescriptors = [creationTimeDescriptor]
let fetchedResultsController = NSFetchedResultsController(fetchRequest: fetchRequest, managedObjectContext: self.managedObjectContext, sectionNameKeyPath: nil, cacheName: "DownloadFRC" + Bundle.buildVersion)
fetchedResultsController.delegate = self
fetchedResultsController.performFetch(deleteCache: false)
return fetchedResultsController as! NSFetchedResultsController<DownloadTask>
let controller = NSFetchedResultsController(fetchRequest: fetchRequest, managedObjectContext: self.managedObjectContext, sectionNameKeyPath: nil, cacheName: "DownloadFRC" + Bundle.buildVersion)
controller.delegate = self
try? controller.performFetch()
return controller as! NSFetchedResultsController<DownloadTask>
}()
}

View File

@ -138,7 +138,7 @@ class LocalBooksController: LibraryBaseController, UITableViewDelegate, UITableV
fetchRequest.predicate = NSPredicate(format: "stateRaw >= 2")
let fetchedResultsController = NSFetchedResultsController(fetchRequest: fetchRequest, managedObjectContext: self.managedObjectContext, sectionNameKeyPath: "stateRaw", cacheName: "LocalFRC" + Bundle.buildVersion)
fetchedResultsController.delegate = self
fetchedResultsController.performFetch(deleteCache: false)
try? fetchedResultsController.performFetch()
return fetchedResultsController as! NSFetchedResultsController<Book>
}()

View File

@ -71,5 +71,4 @@ class MainController: UIViewController {
}
}
}

View File

@ -9,27 +9,8 @@
import UIKit
class WelcomeController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
// place holder for adding stuff like resume last read, suggestions in welcome screen
// maybe this class one day will become tabs controller
}

View File

@ -36,21 +36,6 @@ class SearchBooksController: SearchBaseTableController, UITableViewDelegate, UIT
recentSearchContainer.setNeedsDisplay()
}
// MARK: - Fetched Results Controller
let managedObjectContext = AppDelegate.persistentContainer.viewContext
lazy var fetchedResultController: NSFetchedResultsController<Book> = {
let fetchRequest = Book.fetchRequest()
let langDescriptor = NSSortDescriptor(key: "language.name", ascending: true)
let titleDescriptor = NSSortDescriptor(key: "title", ascending: true)
fetchRequest.sortDescriptors = [langDescriptor, titleDescriptor]
fetchRequest.predicate = NSPredicate(format: "stateRaw == 2")
let fetchedResultsController = NSFetchedResultsController(fetchRequest: fetchRequest, managedObjectContext: self.managedObjectContext, sectionNameKeyPath: nil, cacheName: "ScopeFRC" + Bundle.buildVersion)
fetchedResultsController.delegate = self
fetchedResultsController.performFetch(deleteCache: false)
return fetchedResultsController as! NSFetchedResultsController<Book>
}()
// MARK: - Table Cell Delegate
func didTapOnAccessoryViewForCell(_ cell: UITableViewCell) {
@ -175,4 +160,19 @@ class SearchBooksController: SearchBaseTableController, UITableViewDelegate, UIT
func verticalOffsetForEmptyDataSet(_ scrollView: UIScrollView!) -> CGFloat {
return -(tableView.contentInset.bottom + recentSearchBarHeight.constant) / 2.5
}
// MARK: - Fetched Results Controller
let managedObjectContext = AppDelegate.persistentContainer.viewContext
lazy var fetchedResultController: NSFetchedResultsController<Book> = {
let fetchRequest = Book.fetchRequest()
let langDescriptor = NSSortDescriptor(key: "language.name", ascending: true)
let titleDescriptor = NSSortDescriptor(key: "title", ascending: true)
fetchRequest.sortDescriptors = [langDescriptor, titleDescriptor]
fetchRequest.predicate = NSPredicate(format: "stateRaw == 2")
let fetchedResultsController = NSFetchedResultsController(fetchRequest: fetchRequest, managedObjectContext: self.managedObjectContext, sectionNameKeyPath: nil, cacheName: "ScopeFRC" + Bundle.buildVersion)
fetchedResultsController.delegate = self
try? fetchedResultsController.performFetch()
return fetchedResultsController as! NSFetchedResultsController<Book>
}()
}

View File

@ -104,10 +104,11 @@ class SettingTBVC: UITableViewController {
case LocalizedStrings.rateKiwix:
showRateKiwixAlert(showRemindLater: false)
case LocalizedStrings.about:
let controller = UIStoryboard(name: "Setting", bundle: nil)
.instantiateViewController(withIdentifier: "WebViewControllerOld") as! WebViewControllerOld
controller.page = .About
navigationController?.pushViewController(controller, animated: true)
break
// let controller = UIStoryboard(name: "Setting", bundle: nil)
// .instantiateViewController(withIdentifier: "WebViewControllerOld") as! WebViewControllerOld
// controller.page = .About
// navigationController?.pushViewController(controller, animated: true)
default:
break
}
@ -152,8 +153,8 @@ class SettingTBVC: UITableViewController {
}
func goRateInAppStore() {
let url = URL(string: "http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?id=997079563&pageNumber=0&sortOrdering=2&type=Purple+Software&mt=8")!
UIApplication.shared.openURL(url)
// let url = URL(string: "http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?id=997079563&pageNumber=0&sortOrdering=2&type=Purple+Software&mt=8")!
// UIApplication.shared.openURL(url)
}
// MARK: - Actions

View File

@ -52,6 +52,7 @@ class WebViewControllerOld: UIViewController, UIWebViewDelegate {
func webView(_ webView: UIWebView, shouldStartLoadWith request: URLRequest, navigationType: UIWebViewNavigationType) -> Bool {
if navigationType == .linkClicked {
UIApplication.shared.open(<#T##url: URL##URL#>, options: <#T##[String : Any]#>, completionHandler: <#T##((Bool) -> Void)?##((Bool) -> Void)?##(Bool) -> Void#>)
UIApplication.shared.openURL(request.url!)
return false
}

View File

@ -49,7 +49,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.8.3308</string>
<string>1.8.3342</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSRequiresIPhoneOS</key>

View File

@ -7,9 +7,3 @@
//
import UIKit
class DownloadFinishedNotifications: UILocalNotification {
}
//@available(iOS 10, *)

View File

@ -209,61 +209,6 @@
</objects>
<point key="canvasLocation" x="2607" y="432"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="sKQ-wF-qqU">
<objects>
<navigationController id="3qT-fi-cxa" sceneMemberID="viewController">
<navigationBar key="navigationBar" contentMode="scaleToFill" id="nNd-2P-KwU">
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<connections>
<segue destination="OSe-sS-HTX" kind="relationship" relationship="rootViewController" id="WBP-1c-ZMf"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="1xD-QM-7xK" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="756" y="-348"/>
</scene>
<!--Main Controller-->
<scene sceneID="WLR-6p-ElI">
<objects>
<viewController id="OSe-sS-HTX" customClass="MainController" customModule="Kiwix" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="KVH-WC-JGt"/>
<viewControllerLayoutGuide type="bottom" id="UIX-e1-SUg"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="hRW-ET-fRA">
<rect key="frame" x="0.0" y="0.0" width="414" height="736"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<webView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="MjM-In-ehJ">
<rect key="frame" x="0.0" y="0.0" width="414" height="736"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</webView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="MjM-In-ehJ" firstAttribute="top" secondItem="KVH-WC-JGt" secondAttribute="bottom" constant="-64" id="1Om-9P-m57">
<variation key="heightClass=compact-widthClass=regular" constant="-44"/>
</constraint>
<constraint firstItem="MjM-In-ehJ" firstAttribute="leading" secondItem="hRW-ET-fRA" secondAttribute="leading" id="Kf8-Rn-ROp"/>
<constraint firstItem="UIX-e1-SUg" firstAttribute="top" secondItem="MjM-In-ehJ" secondAttribute="bottom" constant="-44" id="MRq-VY-WQT">
<variation key="widthClass=regular" constant="0.0"/>
</constraint>
<constraint firstAttribute="trailing" secondItem="MjM-In-ehJ" secondAttribute="trailing" id="tIZ-J4-u59"/>
</constraints>
</view>
<navigationItem key="navigationItem" id="fuj-b7-iB1"/>
<simulatedToolbarMetrics key="simulatedBottomBarMetrics"/>
<connections>
<outlet property="webView" destination="MjM-In-ehJ" id="bOM-dN-Gc6"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Yrv-8u-IwG" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1651" y="-351"/>
</scene>
<!--Main Controller-->
<scene sceneID="nEL-IB-dp3">
<objects>

View File

@ -1,6 +1,6 @@
<?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="aWb-Y7-c2Y">
<device id="ipad9_7" orientation="portrait">
<device id="retina5_5" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
@ -20,18 +20,18 @@
<viewControllerLayoutGuide type="bottom" id="fIX-c6-nY4"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="HEy-pW-bRk">
<rect key="frame" x="0.0" y="64" width="538" height="653"/>
<rect key="frame" x="0.0" y="64" width="414" height="608"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="nDJ-c8-oj6">
<rect key="frame" x="0.0" y="44" width="538" height="609"/>
<rect key="frame" x="0.0" y="44" width="414" height="564"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="CheckMarkBookCell" id="BZj-UA-kZf" customClass="CheckMarkBookCell" customModule="Kiwix">
<rect key="frame" x="0.0" y="28" width="538" height="44"/>
<rect key="frame" x="0.0" y="28" width="414" height="44"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="BZj-UA-kZf" id="QkJ-pZ-dqx">
<rect key="frame" x="0.0" y="0.0" width="538" height="43"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="43.5"/>
<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="GW1-dh-vyc">
@ -119,7 +119,7 @@
</prototypes>
</tableView>
<containerView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="H44-bK-YA5" customClass="DropShadowView" customModule="Kiwix" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="538" height="44"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="44"/>
<constraints>
<constraint firstAttribute="height" constant="44" id="4d0-gR-IwP"/>
</constraints>
@ -160,18 +160,18 @@
<viewControllerLayoutGuide type="bottom" id="U6y-Va-LE0"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="oES-Vw-jgP">
<rect key="frame" x="0.0" y="0.0" width="538" height="717"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="672"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="526-mx-VrZ">
<rect key="frame" x="0.0" y="0.0" width="538" height="717"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="672"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="ArticleCell" id="z8v-Ld-3tX" customClass="ArticleCell" customModule="Kiwix" customModuleProvider="target">
<rect key="frame" x="0.0" y="28" width="538" height="44"/>
<rect key="frame" x="0.0" y="28" width="414" height="44"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="z8v-Ld-3tX" id="PYl-F0-kUl">
<rect key="frame" x="0.0" y="0.0" width="538" height="43"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="UgG-QR-OX4">
@ -189,7 +189,7 @@
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="T" lineBreakMode="tailTruncation" adjustsLetterSpacingToFitWidth="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="79o-Kq-Tr5">
<rect key="frame" x="48" y="6" width="712" height="32"/>
<rect key="frame" x="48" y="6" width="358" height="32"/>
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="32" id="KoF-qx-tar"/>
</constraints>
@ -225,10 +225,10 @@
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="ArticleSnippetCell" rowHeight="87" id="wBv-ub-ny7" customClass="ArticleSnippetCell" customModule="Kiwix" customModuleProvider="target">
<rect key="frame" x="0.0" y="72" width="538" height="87"/>
<rect key="frame" x="0.0" y="72" width="414" height="87"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="wBv-ub-ny7" id="fk4-EM-rH7">
<rect key="frame" x="0.0" y="0.0" width="538" height="86"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="86.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="ien-Dp-MNO">
@ -246,7 +246,7 @@
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="T" lineBreakMode="tailTruncation" adjustsLetterSpacingToFitWidth="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="qUd-SU-d1A">
<rect key="frame" x="48" y="10" width="712" height="24"/>
<rect key="frame" x="48" y="10" width="358" height="24"/>
<constraints>
<constraint firstAttribute="height" constant="24" id="Xnz-4D-mht"/>
</constraints>
@ -255,7 +255,7 @@
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="3" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="R3d-Xp-YAT">
<rect key="frame" x="48" y="34" width="712" height="45"/>
<rect key="frame" x="48" y="34" width="358" height="45"/>
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="2" id="vpN-us-saa"/>
</constraints>
@ -334,11 +334,11 @@
<viewControllerLayoutGuide type="bottom" id="Xnw-As-VGc"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="kCv-em-FrJ">
<rect key="frame" x="0.0" y="0.0" width="538" height="44"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="44"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="gmD-FQ-6K1">
<rect key="frame" x="0.0" y="0.0" width="538" height="44"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="44"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<collectionViewFlowLayout key="collectionViewLayout" scrollDirection="horizontal" minimumLineSpacing="10" minimumInteritemSpacing="10" id="UGg-ww-zQ6">
<size key="itemSize" width="102" height="42"/>
@ -355,7 +355,7 @@
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0QZ-Yd-dSd">
<rect key="frame" x="8" y="11" width="86" height="20.5"/>
<rect key="frame" x="8" y="11.000000000000002" width="86" height="20.666666666666671"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
@ -400,7 +400,7 @@
<viewControllerLayoutGuide type="bottom" id="io0-SJ-WNQ"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="4ma-1x-rrV">
<rect key="frame" x="0.0" y="0.0" width="768" height="1024"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="736"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="aYO-40-lc1">
@ -412,13 +412,13 @@
</connections>
</view>
<containerView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="TwU-1D-XoU" customClass="SearchRoundedCornerView" customModule="Kiwix" customModuleProvider="target">
<rect key="frame" x="115" y="64" width="538" height="717"/>
<rect key="frame" x="0.0" y="64" width="414" height="672"/>
<connections>
<segue destination="vSQ-RM-B8e" kind="embed" identifier="EmbeddedScopeAndHistoryController" id="5c8-AT-w6g"/>
</connections>
</containerView>
<containerView hidden="YES" opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="mQq-ba-VqM" customClass="SearchRoundedCornerView" customModule="Kiwix" customModuleProvider="target">
<rect key="frame" x="115" y="64" width="538" height="717"/>
<rect key="frame" x="0.0" y="64" width="414" height="672"/>
<connections>
<segue destination="fgz-Yy-Pok" kind="embed" identifier="EmbeddedResultController" id="8xc-8P-ZTh"/>
</connections>
@ -453,6 +453,10 @@
<exclude reference="Ic8-db-q3b"/>
<exclude reference="Ipm-Zl-2Mg"/>
<exclude reference="xF2-nV-4Vp"/>
<exclude reference="kHq-Kc-KeD"/>
<exclude reference="BVS-ar-WL4"/>
<exclude reference="I4h-o0-seW"/>
<exclude reference="tGo-AF-P3V"/>
</mask>
</variation>
<variation key="widthClass=compact">
@ -470,6 +474,10 @@
<include reference="8Ra-9F-JD4"/>
<include reference="FMO-4e-tUF"/>
<include reference="Ic8-db-q3b"/>
<include reference="kHq-Kc-KeD"/>
<include reference="BVS-ar-WL4"/>
<include reference="I4h-o0-seW"/>
<include reference="tGo-AF-P3V"/>
</mask>
</variation>
</view>

View File

@ -6,27 +6,8 @@
// Copyright © 2016 Chris Li. All rights reserved.
//
import Foundation
import CoreData
import UIKit
// MARK: - CoreData
extension NSFetchedResultsController {
func performFetch(deleteCache: Bool) {
do {
if deleteCache {
guard let cacheName = cacheName else {return}
NSFetchedResultsController.deleteCache(withName: cacheName)
}
try performFetch()
} catch let error as NSError {
print("FetchedResultController performFetch failed: \(error.localizedDescription)")
}
}
}
// MARK: - UI
enum BuildStatus {
@ -41,30 +22,6 @@ extension UIApplication {
}
}
extension UIStoryboard {
class var library: UIStoryboard {get {return UIStoryboard(name: "Library", bundle: nil)}}
class var main: UIStoryboard {get {return UIStoryboard(name: "Main", bundle: nil)}}
class var search: UIStoryboard {get {return UIStoryboard(name: "Search", bundle: nil)}}
class var setting: UIStoryboard {get {return UIStoryboard(name: "Setting", bundle: nil)}}
class var welcome: UIStoryboard {get {return UIStoryboard(name: "Welcome", bundle: nil)}}
func initViewController<T:UIViewController>(_ type: T.Type) -> T? {
guard let className = NSStringFromClass(T).components(separatedBy: ".").last else {
print("NSManagedObjectExtension: Unable to get class name")
return nil
}
return instantiateViewController(withIdentifier: className) as? T
}
func initViewController<T:UIViewController>(_ identifier: String, type: T.Type) -> T? {
return instantiateViewController(withIdentifier: identifier) as? T
}
func controller<T:UIViewController>(_ type: T.Type) -> T? {
return instantiateViewController(withIdentifier: String(describing: T.self)) as? T
}
}
extension UIColor {
class var defaultTint: UIColor {return UIColor(red: 0, green: 122/255, blue: 1, alpha: 1)}

View File

@ -21,7 +21,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.8.3308</string>
<string>1.8.3342</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionMainStoryboard</key>

View File

@ -11,7 +11,6 @@
970A2A221DD562CB0078BB7C /* BookOperations.swift in Sources */ = {isa = PBXBuildFile; fileRef = 970A2A211DD562CB0078BB7C /* BookOperations.swift */; };
970E7F741D9DB0FC00741290 /* 1.8.xcmappingmodel in Sources */ = {isa = PBXBuildFile; fileRef = 970E7F731D9DB0FC00741290 /* 1.8.xcmappingmodel */; };
970E7F771D9DBEA900741290 /* SettingController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 970E7F761D9DBEA900741290 /* SettingController.swift */; };
970E7F791DA003FA00741290 /* WebViewControllerOld.swift in Sources */ = {isa = PBXBuildFile; fileRef = 970E7F781DA003FA00741290 /* WebViewControllerOld.swift */; };
970E7F7B1DA0069600741290 /* FontSizeController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 970E7F7A1DA0069600741290 /* FontSizeController.swift */; };
970E7F821DA0305000741290 /* TableOfContentsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 970E7F7E1DA0305000741290 /* TableOfContentsController.swift */; };
970E7F831DA0305000741290 /* WelcomeController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 970E7F7F1DA0305000741290 /* WelcomeController.swift */; };
@ -1145,7 +1144,6 @@
97D6813A1D6F711A00E5FA99 /* Language.swift in Sources */,
97BC0FBF1DD90A65004BBAD1 /* JSInjection.swift in Sources */,
97BC0FC01DD90A65004BBAD1 /* MainController.swift in Sources */,
970E7F791DA003FA00741290 /* WebViewControllerOld.swift in Sources */,
97A1FD421D6F728200A80EE2 /* Extensions.swift in Sources */,
97A1FD3A1D6F724E00A80EE2 /* reader.cpp in Sources */,
973207A31DD1983D00EDD3DC /* LanguageFilterController.swift in Sources */,