Skip to content

Commit

Permalink
Merge pull request #27 from pmfawkes/bump-SWCompression-version
Browse files Browse the repository at this point in the history
Bump SWCompression version and remove hack
  • Loading branch information
yuweipei authored Jun 8, 2021
2 parents 5020da3 + e8ef1c3 commit 88b65d9
Show file tree
Hide file tree
Showing 7 changed files with 161 additions and 178 deletions.
80 changes: 40 additions & 40 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@
PODS:
- AEXML (4.3.3)
- BitByteData (1.4.1)
- FolioReaderKit (1.4.10.2):
- BitByteData (1.4.4)
- FolioReaderKit (1.4.13):
- AEXML (= 4.3.3)
- FontBlaster (= 4.1.0)
- MenuItemKit (= 3.1.3)
- SWCompression (= 4.5.1)
- SWCompression (= 4.5.10)
- FontBlaster (4.1.0)
- MenuItemKit (3.1.3)
- Nimble (7.3.1)
- Quick (1.3.2)
- SWCompression (4.5.1):
- BitByteData (~> 1.4.0)
- SWCompression/BZip2 (= 4.5.1)
- SWCompression/Deflate (= 4.5.1)
- SWCompression/GZip (= 4.5.1)
- SWCompression/LZMA (= 4.5.1)
- SWCompression/LZMA2 (= 4.5.1)
- SWCompression/SevenZip (= 4.5.1)
- SWCompression/TAR (= 4.5.1)
- SWCompression/XZ (= 4.5.1)
- SWCompression/ZIP (= 4.5.1)
- SWCompression/Zlib (= 4.5.1)
- SWCompression/BZip2 (4.5.1):
- BitByteData (~> 1.4.0)
- SWCompression/Deflate (4.5.1):
- BitByteData (~> 1.4.0)
- SWCompression/GZip (4.5.1):
- BitByteData (~> 1.4.0)
- SWCompression (4.5.10):
- BitByteData (~> 1.4.4)
- SWCompression/BZip2 (= 4.5.10)
- SWCompression/Deflate (= 4.5.10)
- SWCompression/GZip (= 4.5.10)
- SWCompression/LZMA (= 4.5.10)
- SWCompression/LZMA2 (= 4.5.10)
- SWCompression/SevenZip (= 4.5.10)
- SWCompression/TAR (= 4.5.10)
- SWCompression/XZ (= 4.5.10)
- SWCompression/ZIP (= 4.5.10)
- SWCompression/Zlib (= 4.5.10)
- SWCompression/BZip2 (4.5.10):
- BitByteData (~> 1.4.4)
- SWCompression/Deflate (4.5.10):
- BitByteData (~> 1.4.4)
- SWCompression/GZip (4.5.10):
- BitByteData (~> 1.4.4)
- SWCompression/Deflate
- SWCompression/LZMA (4.5.1):
- BitByteData (~> 1.4.0)
- SWCompression/LZMA2 (4.5.1):
- BitByteData (~> 1.4.0)
- SWCompression/LZMA (4.5.10):
- BitByteData (~> 1.4.4)
- SWCompression/LZMA2 (4.5.10):
- BitByteData (~> 1.4.4)
- SWCompression/LZMA
- SWCompression/SevenZip (4.5.1):
- BitByteData (~> 1.4.0)
- SWCompression/SevenZip (4.5.10):
- BitByteData (~> 1.4.4)
- SWCompression/LZMA2
- SWCompression/TAR (4.5.1):
- BitByteData (~> 1.4.0)
- SWCompression/XZ (4.5.1):
- BitByteData (~> 1.4.0)
- SWCompression/TAR (4.5.10):
- BitByteData (~> 1.4.4)
- SWCompression/XZ (4.5.10):
- BitByteData (~> 1.4.4)
- SWCompression/LZMA2
- SWCompression/ZIP (4.5.1):
- BitByteData (~> 1.4.0)
- SWCompression/ZIP (4.5.10):
- BitByteData (~> 1.4.4)
- SWCompression/Deflate
- SWCompression/Zlib (4.5.1):
- BitByteData (~> 1.4.0)
- SWCompression/Zlib (4.5.10):
- BitByteData (~> 1.4.4)
- SWCompression/Deflate

DEPENDENCIES:
Expand All @@ -55,7 +55,7 @@ DEPENDENCIES:
- Quick (= 1.3.2)

SPEC REPOS:
https://github.com/CocoaPods/Specs.git:
trunk:
- AEXML
- BitByteData
- FontBlaster
Expand All @@ -70,14 +70,14 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
AEXML: 601f41fcaa7bda7605cad153b0f43db9ec006c0f
BitByteData: 40d356e9ce103ae62f34b74ed76c746eb5cc783f
FolioReaderKit: 9be7b704fc4d1f958ea54a52c300dd5aadea9a0a
BitByteData: 50012554283a93b1e43e5e7b3ad00171e52589e9
FolioReaderKit: bb1e17290be3d3cf3b9a96e47d2eef49c70eb9b2
FontBlaster: 127aa66419478d1c62926c7fdb39841633344a45
MenuItemKit: 0f850e630b0a3d2bd80fec54db87ce0d2077ada2
Nimble: 04f732da099ea4d153122aec8c2a88fd0c7219ae
Quick: 2623cb30d7a7f41ca62f684f679586558f483d46
SWCompression: 02a231af1b1df08be91802df4986d328f2a7c906
SWCompression: 9f45075af7b7915ad5116364f81eab647414fed7

PODFILE CHECKSUM: 27ab1fac998a63edc76004d8dd44cba189cff4ad

COCOAPODS: 1.8.4
COCOAPODS: 1.10.1
2 changes: 1 addition & 1 deletion FolioReaderKit.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ Pod::Spec.new do |s|
s.dependency 'MenuItemKit', '3.1.3'
s.dependency 'AEXML', '4.3.3'
s.dependency 'FontBlaster', '4.1.0'
s.dependency 'SWCompression', '4.5.1'
s.dependency 'SWCompression', '4.5.10'

end
21 changes: 11 additions & 10 deletions Source/Database/DBAPIManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//

import Foundation
import os.log

class DBAPIManager: NSObject {

Expand Down Expand Up @@ -34,17 +35,17 @@ class DBAPIManager: NSObject {
private func connectLocalDatabase() {
do {
dbHandler = try SQLiteDatabase.open(path: databasePath)
print("Successfully opened connection to database.")
os_log("Successfully opened connection to database.", type: .info)
} catch {
print("Unable to open database. Verify that you created the directory described in the Getting Started section.")
os_log("Unable to open database. Verify that you created the directory described in the Getting Started section.", type: .error)
}
}

private func createTablesIfNeeded() {
do {
try dbHandler?.createTable(table: Highlight.self)
} catch {
print(dbHandler?.errorMessage ?? "")
os_log("createTablesIfNeeded error: %{public}@", type: .error, dbHandler?.errorMessage ?? "")
}
}

Expand All @@ -56,7 +57,7 @@ class DBAPIManager: NSObject {
do {
try dbHandler?.addHighlight(highlight)
} catch {
print("can't insert highlight")
os_log("addHighlight error: can't insert highlight", type: .error)
}
}

Expand All @@ -69,7 +70,7 @@ class DBAPIManager: NSObject {
do {
try dbHandler?.updateHighlight(id: id, type: type.rawValue)
} catch {
print(dbHandler?.errorMessage ?? "")
os_log("updateHighlight error: %{public}@", type: .error, dbHandler?.errorMessage ?? "")
}
}

Expand All @@ -82,7 +83,7 @@ class DBAPIManager: NSObject {
do {
try dbHandler?.updateHighLight(id: id, note: note)
} catch {
print(dbHandler?.errorMessage ?? "")
os_log("updateHighlight error: %{public}@", type: .error, dbHandler?.errorMessage ?? "")
}
}

Expand All @@ -94,7 +95,7 @@ class DBAPIManager: NSObject {
do {
try dbHandler?.removeHighlight(id: id)
} catch {
print(dbHandler?.errorMessage ?? "")
os_log("removeHighlight error: %{public}@", type: .error, dbHandler?.errorMessage ?? "")
}
}

Expand All @@ -108,7 +109,7 @@ class DBAPIManager: NSObject {
do {
return try dbHandler?.getHighlight(id: id)
} catch {
print(dbHandler?.errorMessage ?? "")
os_log("getHighlight error: %{public}@", type: .error, dbHandler?.errorMessage ?? "")
return nil
}
}
Expand All @@ -123,7 +124,7 @@ class DBAPIManager: NSObject {
do {
return try dbHandler?.getAllHighlights(byBookId: id, page: page) ?? []
} catch {
print(dbHandler?.errorMessage ?? "")
os_log("getAllHighlight error: %{public}@", type: .error, dbHandler?.errorMessage ?? "")
return []
}

Expand All @@ -136,7 +137,7 @@ class DBAPIManager: NSObject {
do {
return try dbHandler?.getAllHighlights() ?? []
} catch {
print(dbHandler?.errorMessage ?? "")
os_log("getAllHighlights error: %{public}@", type: .error, dbHandler?.errorMessage ?? "")
return []
}
}
Expand Down
3 changes: 2 additions & 1 deletion Source/EPUBCore/FREpubParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import UIKit
import AEXML
import SWCompression
import os.log

class FREpubParser: NSObject {

Expand Down Expand Up @@ -106,7 +107,7 @@ class FREpubParser: NSObject {
try readContainer()
try readOpf()
} catch {
print(error.localizedDescription)
os_log("readEpub error: %{public}@", type: .error, error.localizedDescription)
}

return self.book
Expand Down
12 changes: 8 additions & 4 deletions Source/FolioReaderCenter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
//

import UIKit
import os.log

//import ZFDragableModalTransition
public extension Notification.Name {
static let pageDidLoadNotification = Notification.Name("pageDidAppearNotif")
Expand Down Expand Up @@ -501,7 +503,7 @@ open class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UIColl
if let modifiedHtmlContent = self.delegate?.htmlContentForPage?(cell, htmlContent: html) {
html = modifiedHtmlContent
}

cell.loadHTMLString(html, baseURL: URL(fileURLWithPath: resource.fullHref).deletingLastPathComponent())
return cell
}
Expand Down Expand Up @@ -673,14 +675,14 @@ open class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UIColl

func pagesForCurrentPage(_ page: FolioReaderPage?) {
guard let page = page, let webView = page.webView else { return }

let pageSize = self.readerConfig.isDirection(pageHeight, self.pageWidth, pageHeight)
let contentSize = page.webView?.scrollView.contentSize.forDirection(withConfiguration: self.readerConfig) ?? 0
self.pageIndicatorView?.totalPages = ((pageSize != 0) ? Int(ceil(contentSize / pageSize)) : 0)

let pageOffSet = self.readerConfig.isDirection(webView.scrollView.contentOffset.x, webView.scrollView.contentOffset.x, webView.scrollView.contentOffset.y)
let webViewPage = pageForOffset(pageOffSet, pageHeight: pageSize)

self.pageIndicatorView?.currentPage = webViewPage
}

Expand Down Expand Up @@ -782,7 +784,9 @@ open class FolioReaderCenter: UIViewController, UICollectionViewDelegate, UIColl
}

UIView.animate(withDuration: animated ? 0.3 : 0, delay: 0, options: UIView.AnimationOptions(), animations: { () -> Void in
self.collectionView.isPagingEnabled = false
self.collectionView.scrollToItem(at: indexPath, at: .direction(withConfiguration: self.readerConfig), animated: false)
self.collectionView.isPagingEnabled = true
}) { (finished: Bool) -> Void in
completion?()
}
Expand Down
2 changes: 1 addition & 1 deletion Source/FolioReaderKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ extension FolioReader {
Bool = true) {
let readerContainer = FolioReaderContainer(withConfig: config, folioReader: self, epubPath: epubPath, unzipPath: unzipPath, decryptionKey: decryptionKey, removeEpub: shouldRemoveEpub)
self.readerContainer = readerContainer
readerContainer.modalPresentationStyle = .fullScreen
readerContainer.modalPresentationStyle = .overFullScreen
readerContainer.transitioningDelegate = transitionDelegate
parentViewController.present(readerContainer, animated: animated) {
NotificationCenter.default.post(name: .folioReaderPresentationCompleted, object: nil)
Expand Down
Loading

0 comments on commit 88b65d9

Please sign in to comment.