This commit is contained in:
Chris Li 2016-09-28 15:11:58 -04:00
parent a8a3cb4d2a
commit 1cc5ca6ded
9 changed files with 35 additions and 52 deletions

View File

@ -136,7 +136,7 @@ extension MainController: UIWebViewDelegate, SFSafariViewControllerDelegate, LPT
}
func searchBarSearchButtonClicked(searchBar: UISearchBar) {
ControllerRetainer.search.searchResultTBVC?.selectFirstResultIfPossible()
ControllerRetainer.search.searchResultController?.selectFirstResultIfPossible()
}
// MARK: - UIPopoverPresentationControllerDelegate

View File

@ -1,5 +1,5 @@
//
// RecentSearchCVC.swift
// RecentSearchController.swift
// Kiwix
//
// Created by Chris Li on 6/19/16.
@ -9,7 +9,7 @@
import UIKit
import CoreData
class RecentSearchCVC: UIViewController, UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout, NSFetchedResultsControllerDelegate {
class RecentSearchController: UIViewController, UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout, NSFetchedResultsControllerDelegate {
@IBOutlet weak var collectionView: UICollectionView!

View File

@ -76,7 +76,7 @@ class SearchBooksController: UIViewController, UITableViewDelegate, UITableViewD
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: "language.name", cacheName: "ScopeFRC")
let fetchedResultsController = NSFetchedResultsController(fetchRequest: fetchRequest, managedObjectContext: self.managedObjectContext, sectionNameKeyPath: nil, cacheName: "ScopeFRC" + NSBundle.buildVersion)
fetchedResultsController.delegate = self
fetchedResultsController.performFetch(deleteCache: false)
return fetchedResultsController

View File

@ -13,7 +13,7 @@ class SearchController: UIViewController, UISearchBarDelegate, UIGestureRecogniz
@IBOutlet weak var tabControllerContainer: UIView!
@IBOutlet weak var searchResultTBVCContainer: UIView!
@IBOutlet var tapGestureRecognizer: UITapGestureRecognizer!
var searchResultTBVC: SearchResultTBVC?
var searchResultController: SearchResultController?
private var searchText = "" {
didSet {
@ -40,9 +40,9 @@ class SearchController: UIViewController, UISearchBarDelegate, UIGestureRecogniz
}
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "EmbeddedSearchResultTBVC" {
guard let destinationViewController = segue.destinationViewController as? SearchResultTBVC else {return}
searchResultTBVC = destinationViewController
if segue.identifier == "EmbeddedSearchResultController" {
guard let destinationViewController = segue.destinationViewController as? SearchResultController else {return}
searchResultController = destinationViewController
}
}
@ -64,10 +64,10 @@ class SearchController: UIViewController, UISearchBarDelegate, UIGestureRecogniz
let previousSearchText = searchText
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64(275 * USEC_PER_SEC)), dispatch_get_main_queue()) {
guard previousSearchText == self.searchText else {return}
self.searchResultTBVC?.startSearch(self.searchText)
self.searchResultController?.startSearch(self.searchText)
}
} else {
searchResultTBVC?.startSearch(searchText)
searchResultController?.startSearch(searchText)
}
}

View File

@ -1,5 +1,5 @@
//
// SearchResultTBVC.swift
// SearchResultController.swift
// Kiwix
//
// Created by Chris Li on 8/13/15.
@ -9,7 +9,7 @@
import UIKit
import Operations
class SearchResultTBVC: UIViewController, UITableViewDataSource, UITableViewDelegate {
class SearchResultController: UIViewController, UITableViewDataSource, UITableViewDelegate {
@IBOutlet weak var tableView: UITableView!
var searchResults = [SearchResult]()
@ -35,8 +35,8 @@ class SearchResultTBVC: UIViewController, UITableViewDataSource, UITableViewDele
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
tableView.reloadData()
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(SearchResultTBVC.keyboardDidShow(_:)), name: UIKeyboardDidShowNotification, object: nil)
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(SearchResultTBVC.keyboardWillHide(_:)), name: UIKeyboardWillHideNotification, object: nil)
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(SearchResultController.keyboardDidShow(_:)), name: UIKeyboardDidShowNotification, object: nil)
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(SearchResultController.keyboardWillHide(_:)), name: UIKeyboardWillHideNotification, object: nil)
}
override func viewWillDisappear(animated: Bool) {

View File

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

View File

@ -29,7 +29,7 @@
</containerView>
<containerView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="l6w-E8-vrr" customClass="SearchRoundedCornerView" customModule="Kiwix" customModuleProvider="target">
<connections>
<segue destination="fgz-Yy-Pok" kind="embed" identifier="EmbeddedSearchResultTBVC" id="hg6-op-GYf"/>
<segue destination="fgz-Yy-Pok" kind="embed" identifier="EmbeddedSearchResultController" id="hg6-op-GYf"/>
</connections>
</containerView>
</subviews>
@ -160,7 +160,7 @@
<rect key="frame" x="0.0" y="28" width="375" 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">
<frame key="frameInset" width="375" height="43"/>
<frame key="frameInset" width="375" 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">
@ -240,23 +240,6 @@
<outlet property="titleLabel" destination="GW1-dh-vyc" id="JfI-I6-Bqn"/>
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="Cell" textLabel="jU7-ZQ-dsg" style="IBUITableViewCellStyleDefault" id="jhQ-Rz-z7y">
<rect key="frame" x="0.0" y="72" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="jhQ-Rz-z7y" id="0Qp-fj-4c4">
<frame key="frameInset" width="375" height="43"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="jU7-ZQ-dsg">
<frame key="frameInset" minX="15" width="345" height="43"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<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>
</subviews>
</tableViewCellContentView>
</tableViewCell>
</prototypes>
</tableView>
<containerView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="H44-bK-YA5" customClass="DropShadowView" customModule="Kiwix" customModuleProvider="target">
@ -288,12 +271,12 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="R0s-FA-lXA" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1852" y="-1003"/>
<point key="canvasLocation" x="1852" y="-1003.4482758620691"/>
</scene>
<!--Search ResultTBVC-->
<!--Search Result Controller-->
<scene sceneID="g1P-db-EbE">
<objects>
<viewController storyboardIdentifier="SearchResultTBVC" id="fgz-Yy-Pok" customClass="SearchResultTBVC" customModule="Kiwix" customModuleProvider="target" sceneMemberID="viewController">
<viewController storyboardIdentifier="SearchResultController" id="fgz-Yy-Pok" customClass="SearchResultController" customModule="Kiwix" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="gjd-DF-nun"/>
<viewControllerLayoutGuide type="bottom" id="U6y-Va-LE0"/>
@ -309,7 +292,7 @@
<rect key="frame" x="0.0" y="28" width="375" 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">
<frame key="frameInset" width="375" height="43"/>
<frame key="frameInset" width="375" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="UgG-QR-OX4">
@ -363,7 +346,7 @@
<rect key="frame" x="0.0" y="72" width="375" 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">
<frame key="frameInset" width="375" height="86"/>
<frame key="frameInset" width="375" height="86.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="ien-Dp-MNO">
@ -462,12 +445,12 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="oOZ-eA-xq3" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1852" y="-305"/>
<point key="canvasLocation" x="1852" y="-305.39730134932535"/>
</scene>
<!--Recent SearchCVC-->
<!--Recent Search Controller-->
<scene sceneID="ymK-iU-ozA">
<objects>
<viewController id="yhc-fp-Uja" customClass="RecentSearchCVC" customModule="Kiwix" customModuleProvider="target" sceneMemberID="viewController">
<viewController id="yhc-fp-Uja" customClass="RecentSearchController" customModule="Kiwix" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="gBf-Af-tdE"/>
<viewControllerLayoutGuide type="bottom" id="Xnw-As-VGc"/>
@ -526,7 +509,7 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="RyG-of-G9K" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="2759" y="-1004"/>
<point key="canvasLocation" x="2785" y="-1004"/>
</scene>
</scenes>
<resources>

View File

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

View File

@ -93,10 +93,10 @@
979CB6C81D05CF37005E1BA1 /* SearchResultController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 979CB6C71D05CF37005E1BA1 /* SearchResultController.swift */; };
979CB6CA1D05D26E005E1BA1 /* WebViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 979CB6C91D05D26E005E1BA1 /* WebViewController.swift */; };
97A127C41D774C9900FB204D /* ControllerRetainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97A127C31D774C9900FB204D /* ControllerRetainer.swift */; };
97A127C91D777CF100FB204D /* RecentSearchCVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97A127C51D777CF100FB204D /* RecentSearchCVC.swift */; };
97A127C91D777CF100FB204D /* RecentSearchController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97A127C51D777CF100FB204D /* RecentSearchController.swift */; };
97A127CA1D777CF100FB204D /* SearchBooksController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97A127C61D777CF100FB204D /* SearchBooksController.swift */; };
97A127CB1D777CF100FB204D /* SearchController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97A127C71D777CF100FB204D /* SearchController.swift */; };
97A127CC1D777CF100FB204D /* SearchResultTBVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97A127C81D777CF100FB204D /* SearchResultTBVC.swift */; };
97A127CC1D777CF100FB204D /* SearchResultController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97A127C81D777CF100FB204D /* SearchResultController.swift */; };
97A1FD161D6F71CE00A80EE2 /* DirectoryMonitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97A1FD121D6F71CE00A80EE2 /* DirectoryMonitor.swift */; };
97A1FD171D6F71CE00A80EE2 /* Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97A1FD131D6F71CE00A80EE2 /* Extension.swift */; };
97A1FD181D6F71CE00A80EE2 /* SearchResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97A1FD141D6F71CE00A80EE2 /* SearchResult.swift */; };
@ -316,10 +316,10 @@
979CB6C71D05CF37005E1BA1 /* SearchResultController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SearchResultController.swift; path = Controllers/SearchResultController.swift; sourceTree = "<group>"; };
979CB6C91D05D26E005E1BA1 /* WebViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = WebViewController.swift; path = Controllers/WebViewController.swift; sourceTree = "<group>"; };
97A127C31D774C9900FB204D /* ControllerRetainer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ControllerRetainer.swift; sourceTree = "<group>"; };
97A127C51D777CF100FB204D /* RecentSearchCVC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RecentSearchCVC.swift; sourceTree = "<group>"; };
97A127C51D777CF100FB204D /* RecentSearchController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RecentSearchController.swift; sourceTree = "<group>"; };
97A127C61D777CF100FB204D /* SearchBooksController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SearchBooksController.swift; sourceTree = "<group>"; };
97A127C71D777CF100FB204D /* SearchController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SearchController.swift; sourceTree = "<group>"; };
97A127C81D777CF100FB204D /* SearchResultTBVC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SearchResultTBVC.swift; sourceTree = "<group>"; };
97A127C81D777CF100FB204D /* SearchResultController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SearchResultController.swift; sourceTree = "<group>"; };
97A1FD121D6F71CE00A80EE2 /* DirectoryMonitor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DirectoryMonitor.swift; sourceTree = "<group>"; };
97A1FD131D6F71CE00A80EE2 /* Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Extension.swift; sourceTree = "<group>"; };
97A1FD141D6F71CE00A80EE2 /* SearchResult.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SearchResult.swift; sourceTree = "<group>"; };
@ -985,8 +985,8 @@
children = (
97A127C71D777CF100FB204D /* SearchController.swift */,
97A127C61D777CF100FB204D /* SearchBooksController.swift */,
97A127C51D777CF100FB204D /* RecentSearchCVC.swift */,
97A127C81D777CF100FB204D /* SearchResultTBVC.swift */,
97A127C51D777CF100FB204D /* RecentSearchController.swift */,
97A127C81D777CF100FB204D /* SearchResultController.swift */,
);
path = Search;
sourceTree = "<group>";
@ -1563,7 +1563,7 @@
975B90FE1CEB909100D13906 /* iOSExtensions.swift in Sources */,
971A10521D022D9D007FC62C /* AppDelegate.swift in Sources */,
9764F5991D833F2B00E0B1C4 /* KiwixURL.swift in Sources */,
97A127CC1D777CF100FB204D /* SearchResultTBVC.swift in Sources */,
97A127CC1D777CF100FB204D /* SearchResultController.swift in Sources */,
97A8AD841D6C951A00584ED1 /* LocalBooksController.swift in Sources */,
97D4D64F1D874E6E00C1B065 /* SearchOperation.swift in Sources */,
97D452BE1D1723FF0033666F /* CollectionViewCells.swift in Sources */,
@ -1598,7 +1598,7 @@
970E68BB1D3809A3001E8514 /* MainControllerDelegates.swift in Sources */,
97D681281D6F70AC00E5FA99 /* UpdateWidgetDataSourceOperation.swift in Sources */,
97D681241D6F70AC00E5FA99 /* RefreshLibraryOperation.swift in Sources */,
97A127C91D777CF100FB204D /* RecentSearchCVC.swift in Sources */,
97A127C91D777CF100FB204D /* RecentSearchController.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};