mirror of
https://github.com/kiwix/kiwix-apple.git
synced 2025-09-25 21:05:09 -04:00
cloud kit
This commit is contained in:
parent
3a8a83ae56
commit
9fd752f096
@ -84,8 +84,11 @@ extension MainController: UIWebViewDelegate, SFSafariViewControllerDelegate, LPT
|
||||
if article.isBookmarked {article.bookmarkDate = NSDate()}
|
||||
if article.snippet == nil {article.snippet = JSInjection.getSnippet(webView)}
|
||||
|
||||
let operation = UpdateWidgetDataSourceOperation()
|
||||
GlobalQueue.shared.addOperation(operation)
|
||||
let cloudKitUpdateOperation = BookmarkCloudKitOperation(article: article)
|
||||
GlobalQueue.shared.addOperation(cloudKitUpdateOperation)
|
||||
|
||||
let updateWidgetOperation = UpdateWidgetDataSourceOperation()
|
||||
GlobalQueue.shared.addOperation(updateWidgetOperation)
|
||||
|
||||
let controller = Controllers.bookmarkHUD
|
||||
controller.bookmarkAdded = article.isBookmarked
|
||||
|
@ -49,7 +49,7 @@
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.8.1660</string>
|
||||
<string>1.8.1668</string>
|
||||
<key>ITSAppUsesNonExemptEncryption</key>
|
||||
<false/>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
|
@ -2,6 +2,18 @@
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>aps-environment</key>
|
||||
<string>development</string>
|
||||
<key>com.apple.developer.icloud-container-identifiers</key>
|
||||
<array>
|
||||
<string>iCloud.org.kiwix</string>
|
||||
</array>
|
||||
<key>com.apple.developer.icloud-services</key>
|
||||
<array>
|
||||
<string>CloudKit</string>
|
||||
</array>
|
||||
<key>com.apple.developer.ubiquity-kvstore-identifier</key>
|
||||
<string>$(TeamIdentifierPrefix)$(CFBundleIdentifier)</string>
|
||||
<key>com.apple.security.application-groups</key>
|
||||
<array>
|
||||
<string>group.kiwix</string>
|
||||
|
@ -21,7 +21,7 @@
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.8.1660</string>
|
||||
<string>1.8.1668</string>
|
||||
<key>NSExtension</key>
|
||||
<dict>
|
||||
<key>NSExtensionMainStoryboard</key>
|
||||
|
@ -58,6 +58,7 @@
|
||||
974C49641DA307FF00E276E1 /* adjustlayoutiPhone.js in Resources */ = {isa = PBXBuildFile; fileRef = 974C49601DA307FF00E276E1 /* adjustlayoutiPhone.js */; };
|
||||
974C49651DA307FF00E276E1 /* getSnippet.js in Resources */ = {isa = PBXBuildFile; fileRef = 974C49611DA307FF00E276E1 /* getSnippet.js */; };
|
||||
974C49661DA307FF00E276E1 /* getTableOfContents.js in Resources */ = {isa = PBXBuildFile; fileRef = 974C49621DA307FF00E276E1 /* getTableOfContents.js */; };
|
||||
974C49681DA4266200E276E1 /* CloudKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 974C49671DA4266200E276E1 /* CloudKit.framework */; };
|
||||
974F33C61D99CAD700879D35 /* BookmarkOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 974F33C51D99CAD700879D35 /* BookmarkOperation.swift */; };
|
||||
975227CD1D0227E8001D1DDE /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 975227CA1D0227E8001D1DDE /* Main.storyboard */; };
|
||||
975227CE1D0227E8001D1DDE /* Setting.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 975227CB1D0227E8001D1DDE /* Setting.storyboard */; };
|
||||
@ -232,6 +233,7 @@
|
||||
974C49601DA307FF00E276E1 /* adjustlayoutiPhone.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = adjustlayoutiPhone.js; sourceTree = "<group>"; };
|
||||
974C49611DA307FF00E276E1 /* getSnippet.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = getSnippet.js; sourceTree = "<group>"; };
|
||||
974C49621DA307FF00E276E1 /* getTableOfContents.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = getTableOfContents.js; sourceTree = "<group>"; };
|
||||
974C49671DA4266200E276E1 /* CloudKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CloudKit.framework; path = System/Library/Frameworks/CloudKit.framework; sourceTree = SDKROOT; };
|
||||
974F33C51D99CAD700879D35 /* BookmarkOperation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BookmarkOperation.swift; sourceTree = "<group>"; };
|
||||
975227CA1D0227E8001D1DDE /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = Main.storyboard; path = "Kiwix-iOS/Storyboard/Main.storyboard"; sourceTree = SOURCE_ROOT; };
|
||||
975227CB1D0227E8001D1DDE /* Setting.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = Setting.storyboard; path = "Kiwix-iOS/Storyboard/Setting.storyboard"; sourceTree = SOURCE_ROOT; };
|
||||
@ -336,6 +338,7 @@
|
||||
973DD4121D343F2F009D45DB /* libicule.a in Frameworks */,
|
||||
973DD4131D343F2F009D45DB /* libiculx.a in Frameworks */,
|
||||
973DD4141D343F2F009D45DB /* libicutest.a in Frameworks */,
|
||||
974C49681DA4266200E276E1 /* CloudKit.framework in Frameworks */,
|
||||
973DD4151D343F2F009D45DB /* libicutu.a in Frameworks */,
|
||||
973DD4161D343F2F009D45DB /* libicuuc.a in Frameworks */,
|
||||
973DD4181D343F2F009D45DB /* libxapian.a in Frameworks */,
|
||||
@ -365,6 +368,7 @@
|
||||
931D277C156AE671D3F9EADA /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
974C49671DA4266200E276E1 /* CloudKit.framework */,
|
||||
9764F5921D830EF200E0B1C4 /* liblzma.tbd */,
|
||||
976A0C801D41619C0006A742 /* DZNEmptyDataSet.framework */,
|
||||
973DD4041D343F2F009D45DB /* libicudata.a */,
|
||||
@ -942,6 +946,12 @@
|
||||
com.apple.Maps.iOS = {
|
||||
enabled = 0;
|
||||
};
|
||||
com.apple.Push = {
|
||||
enabled = 1;
|
||||
};
|
||||
com.apple.iCloud = {
|
||||
enabled = 1;
|
||||
};
|
||||
};
|
||||
};
|
||||
97A2AB9E1C1B80FF00052E74 = {
|
||||
|
@ -7,6 +7,7 @@
|
||||
//
|
||||
|
||||
import CoreData
|
||||
import CloudKit
|
||||
import Operations
|
||||
|
||||
class BookmarkMigrationOperation: Operation {
|
||||
@ -79,3 +80,29 @@ class BookmarkTrashOperation: Operation {
|
||||
finish()
|
||||
}
|
||||
}
|
||||
|
||||
class BookmarkCloudKitOperation: Operation {
|
||||
let article: Article
|
||||
|
||||
init(article: Article) {
|
||||
self.article = article
|
||||
super.init()
|
||||
name = String(self)
|
||||
}
|
||||
|
||||
override func execute() {
|
||||
defer {finish()}
|
||||
guard let bookID = article.book?.id else {return}
|
||||
|
||||
let recordID = CKRecordID(recordName: bookID + "|" + article.path)
|
||||
let record = CKRecord(recordType: "Article", recordID: recordID)
|
||||
record["path"] = article.path
|
||||
record["title"] = article.title
|
||||
record["snippet"] = article.snippet
|
||||
|
||||
let database = CKContainer(identifier: "iCloud.org.kiwix").privateCloudDatabase
|
||||
database.saveRecord(record) { (record, error) in
|
||||
print(error?.localizedDescription)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user