This commit is contained in:
Chris Li 2016-09-22 10:10:51 -04:00
parent 896d8dcdf9
commit 72a885d604
8 changed files with 36 additions and 7 deletions

View File

@ -59,7 +59,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
}
func application(app: UIApplication, openURL url: NSURL, options: [String : AnyObject]) -> Bool {
guard url.scheme!.caseInsensitiveCompare("kiwix") == .OrderedSame else {return false}
guard url.isKiwixURL else {return false}
let operation = ArticleLoadOperation(url: url)
GlobalQueue.shared.add(load: operation)
return true

View File

@ -135,3 +135,12 @@ class ShowHelpPageOperation: Operation {
}
}
class CannotFinishHandoffAlert: AlertOperation<UIViewController> {
init(context: UIViewController) {
super.init(presentAlertFrom: context)
title = NSLocalizedString("Cannot Finish Handoff", comment: "Cannot Finish Handoff Alert")
message = NSLocalizedString("The book required to complete the Handoff is not on the device. Please download the book and try again.", comment: "Cannot Finish Handoff Alert")
addActionWithTitle(LocalizedStrings.ok)
}
}

View File

@ -112,7 +112,8 @@ class MainController: UIViewController {
let operation = ArticleLoadOperation(url: url)
GlobalQueue.shared.add(load: operation)
} else {
// TODO: - Alert cannot complete hand off
let operation = CannotFinishHandoffAlert(context: self)
GlobalQueue.shared.addOperation(operation)
}
}

View File

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

View File

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

View File

@ -19,5 +19,21 @@
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Kiwix/Operations/GlobalQueue.swift"
timestampString = "496186011.525439"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "44"
endingLineNumber = "44"
landmarkName = "add(load:)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>

View File

@ -77,10 +77,12 @@ class ArticleLoadOperation: Operation {
NSOperationQueue.mainQueue().addOperationWithBlock {
controller.hideSearch(animated: self.animated)
controller.presentingViewController?.dismissViewControllerAnimated(self.animated, completion: nil)
// hide toc
if controller.traitCollection.horizontalSizeClass == .Compact {controller.hideTableOfContentsController()}
if controller.webView.request?.URL != url {
controller.webView.loadRequest(request)
}
guard controller.webView.request?.URL != url else {return}
controller.webView.loadRequest(request)
self.finish()
}
}

View File

@ -89,6 +89,7 @@ class ScanLocalBookOperation: Operation {
book.isLocal = true
book.hasIndex = reader.hasIndex()
book.hasPic = !reader.fileURL.absoluteString!.containsString("nopic")
if let downloadTask = book.downloadTask {context.deleteObject(downloadTask)}
}
for (id, book) in localBooks {