-
-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- use Realm in replace of CoreData as database - fix: unable to detect embedded index in some situations - fix: unable to cancel erroneous download tasks
- Loading branch information
1 parent
00d1b55
commit c755738
Showing
56 changed files
with
3,336 additions
and
2,897 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,3 @@ | |
// | ||
|
||
#import "ZimMultiReader.h" | ||
#import "ZimMetaData.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// | ||
// Bookmark.swift | ||
// iOS | ||
// | ||
// Created by Chris Li on 4/27/18. | ||
// Copyright © 2018 Chris Li. All rights reserved. | ||
// | ||
|
||
import RealmSwift | ||
|
||
class Bookmark: Object{ | ||
@objc dynamic var path = "" | ||
@objc dynamic var zimFile: ZimFile? | ||
|
||
@objc dynamic var title = "" | ||
@objc dynamic var snippet: String? | ||
@objc dynamic var thumbImagePath: String? | ||
@objc dynamic var date: Date? | ||
|
||
var thumbImageData: Data? { | ||
guard let thumbImagePath = thumbImagePath, let zimFile = zimFile, | ||
let url = URL(bookID: zimFile.id, contentPath: thumbImagePath) else {return nil} | ||
return try? Data(contentsOf: url) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// | ||
// Database.swift | ||
// iOS | ||
// | ||
// Created by Chris Li on 4/10/18. | ||
// Copyright © 2018 Chris Li. All rights reserved. | ||
// | ||
|
||
import RealmSwift | ||
|
||
extension Realm { | ||
static func resetDatabase() { | ||
guard let url = Realm.defaultConfig.fileURL else {return} | ||
try? FileManager.default.removeItem(at: url) | ||
} | ||
|
||
static let defaultConfig: Realm.Configuration = { | ||
var config = Realm.Configuration() | ||
config.fileURL = try! FileManager.default.url(for: .libraryDirectory, in: .userDomainMask, appropriateFor: nil, create: false).appendingPathComponent("realm") | ||
return config | ||
}() | ||
} |
Oops, something went wrong.