redirection handling with new version of libkiwix (#125)

This commit is contained in:
Chris Li 2018-05-06 14:09:56 -04:00 committed by GitHub
parent e8fb80cd42
commit 00d1b5515b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 661 additions and 601 deletions

File diff suppressed because it is too large Load Diff

View File

@ -24,5 +24,68 @@
</Locations>
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Shared/Procedure/LibraryRefreshProcedure.swift"
timestampString = "547074450.8264019"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "108"
endingLineNumber = "108"
landmarkName = "execute()"
landmarkType = "7">
<Locations>
<Location
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "Kiwix.(ProcessProcedure in _6965C0AAE2F8E23C2E8F87291CBA11F5).__ivar_destroyer"
moduleName = "Kiwix"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/chrisli/Developer/Kiwix/Shared/Procedure/LibraryRefreshProcedure.swift"
timestampString = "547242682.849393"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "0"
endingLineNumber = "0"
offsetFromSymbolStart = "4">
</Location>
<Location
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "Kiwix.(ProcessProcedure in _6965C0AAE2F8E23C2E8F87291CBA11F5).__deallocating_deinit"
moduleName = "Kiwix"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/chrisli/Developer/Kiwix/Shared/Procedure/LibraryRefreshProcedure.swift"
timestampString = "547242682.851963"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "0"
endingLineNumber = "0"
offsetFromSymbolStart = "4">
</Location>
<Location
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "Kiwix.(ProcessProcedure in _6965C0AAE2F8E23C2E8F87291CBA11F5).init(disableAutomaticFinishing: Swift.Bool) -&gt; Kiwix.(ProcessProcedure in _6965C0AAE2F8E23C2E8F87291CBA11F5)"
moduleName = "Kiwix"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/chrisli/Developer/Kiwix/Shared/Procedure/LibraryRefreshProcedure.swift"
timestampString = "547242682.8541"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "109"
endingLineNumber = "109"
offsetFromSymbolStart = "16">
</Location>
</Locations>
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>

View File

@ -129,10 +129,10 @@ NSMutableDictionary *fileURLs = [[NSMutableDictionary alloc] init]; // [ID: File
std::string contentPathC = [contentPath cStringUsingEncoding:NSUTF8StringEncoding];
try {
kiwix::Entry entry = reader->getEntryFromUrl(contentPathC);
kiwix::Entry entry = reader->getEntryFromPath(contentPathC);
entry = entry.getFinalEntry();
std::string redirectedContentPathC = entry.getUrl();
std::string redirectedContentPathC = entry.getPath();
if (redirectedContentPathC.substr(0, 1) != "/") {
redirectedContentPathC = "/" + redirectedContentPathC;
}
@ -158,10 +158,10 @@ NSMutableDictionary *fileURLs = [[NSMutableDictionary alloc] init]; // [ID: File
std::shared_ptr<kiwix::Reader> reader = found->second;
try {
kiwix::Entry entry = reader->getEntryFromUrl([contentURL cStringUsingEncoding:NSUTF8StringEncoding]);
kiwix::Entry entry = reader->getEntryFromPath([contentURL cStringUsingEncoding:NSUTF8StringEncoding]);
NSData *data = [NSData dataWithBytes:entry.getContent().data() length:entry.getSize()];
NSString *mime = [NSString stringWithUTF8String:entry.getMimetype().c_str()];
NSNumber *length = [NSNumber numberWithUnsignedInt:entry.getSize()];
NSNumber *length = [NSNumber numberWithUnsignedLongLong:entry.getSize()];
return @{@"data": data, @"mime": mime, @"length": length};
} catch (kiwix::NoEntry) {
return nil;

View File

@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>1.9</string>
<key>CFBundleVersion</key>
<string>12</string>
<string>16</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionMainStoryboard</key>

View File

@ -256,7 +256,7 @@ class LibraryBookDetailController: UIViewController, UITableViewDelegate, UITabl
cell.textLabel?.text = NSLocalizedString("Date", comment: "Book Detail Cell")
cell.detailTextLabel?.text = book.dateDescription
case .hasIndex:
cell.textLabel?.text = NSLocalizedString("Indexed", comment: "Book Detail Cell")
cell.textLabel?.text = NSLocalizedString("Index", comment: "Book Detail Cell")
cell.detailTextLabel?.text = {
if book.state == .local {
if ZimMultiReader.shared.hasEmbeddedIndex(id: book.id) {

View File

@ -110,7 +110,7 @@ class LegacyWebController: UIViewController, UIWebViewDelegate, WebViewControlle
}
return false
} else {
return false
return true
}
} else if url.scheme == "http" || url.scheme == "https" {
let policy = ExternalLinkLoadingPolicy(rawValue: Defaults[.externalLinkLoadingPolicy]) ?? .alwaysAsk

View File

@ -30,7 +30,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>12</string>
<string>16</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>