mirror of
https://github.com/kiwix/kiwix-apple.git
synced 2025-09-29 15:05:21 -04:00
cloud kit try
This commit is contained in:
parent
decd800275
commit
dd00ebecf7
@ -49,7 +49,7 @@
|
|||||||
</dict>
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>1.8.1688</string>
|
<string>1.8.1706</string>
|
||||||
<key>ITSAppUsesNonExemptEncryption</key>
|
<key>ITSAppUsesNonExemptEncryption</key>
|
||||||
<false/>
|
<false/>
|
||||||
<key>LSRequiresIPhoneOS</key>
|
<key>LSRequiresIPhoneOS</key>
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
<key>CFBundleSignature</key>
|
<key>CFBundleSignature</key>
|
||||||
<string>????</string>
|
<string>????</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>1.8.1688</string>
|
<string>1.8.1707</string>
|
||||||
<key>NSExtension</key>
|
<key>NSExtension</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>NSExtensionMainStoryboard</key>
|
<key>NSExtensionMainStoryboard</key>
|
||||||
|
@ -693,6 +693,7 @@
|
|||||||
975334CD1CEB6A78007ED50B /* Others */,
|
975334CD1CEB6A78007ED50B /* Others */,
|
||||||
931D277C156AE671D3F9EADA /* Frameworks */,
|
931D277C156AE671D3F9EADA /* Frameworks */,
|
||||||
F544A4E4357A6D33CF234C6B /* Pods */,
|
F544A4E4357A6D33CF234C6B /* Pods */,
|
||||||
|
9C1D0054BEA442431151A95D /* Products */,
|
||||||
);
|
);
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
@ -796,6 +797,13 @@
|
|||||||
path = "Kiwix-iOSWidgets";
|
path = "Kiwix-iOSWidgets";
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
|
9C1D0054BEA442431151A95D /* Products */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
);
|
||||||
|
name = Products;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
CFDF64EC6F9DB861DEEB91A0 /* Frameworks */ = {
|
CFDF64EC6F9DB861DEEB91A0 /* Frameworks */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
@ -955,8 +963,11 @@
|
|||||||
compatibilityVersion = "Xcode 3.2";
|
compatibilityVersion = "Xcode 3.2";
|
||||||
developmentRegion = English;
|
developmentRegion = English;
|
||||||
hasScannedForEncodings = 0;
|
hasScannedForEncodings = 0;
|
||||||
|
knownRegions = (
|
||||||
|
en,
|
||||||
|
);
|
||||||
mainGroup = 97A2AB7F1C1B80FF00052E74;
|
mainGroup = 97A2AB7F1C1B80FF00052E74;
|
||||||
productRefGroup = 97A2AB891C1B80FF00052E74 /* Products */;
|
productRefGroup = 9C1D0054BEA442431151A95D /* Products */;
|
||||||
projectDirPath = "";
|
projectDirPath = "";
|
||||||
projectRoot = "";
|
projectRoot = "";
|
||||||
targets = (
|
targets = (
|
||||||
|
@ -91,32 +91,53 @@ class BookmarkCloudKitOperation: Operation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override func execute() {
|
override func execute() {
|
||||||
guard let bookID = article.book?.id else {finish(); return}
|
// guard let bookID = article.book?.id else {finish(); return}
|
||||||
|
// let container = CKContainer(identifier: "iCloud.org.kiwix")
|
||||||
|
// container.accountStatusWithCompletionHandler { (status, error) in
|
||||||
|
// guard status == .Available else {self.finish(); return}
|
||||||
|
//
|
||||||
|
// container.fetchUserRecordIDWithCompletionHandler({ (recordID, error) in
|
||||||
|
// guard let ownerName = recordID?.recordName else {self.finish(); return}
|
||||||
|
// let database = container.privateCloudDatabase
|
||||||
|
// let zoneID = CKRecordZoneID(zoneName: bookID, ownerName: ownerName)
|
||||||
|
// database.fetchRecordZoneWithID(zoneID, completionHandler: { (zone, error) in
|
||||||
|
// if let zone = zone {
|
||||||
|
//
|
||||||
|
// } else {
|
||||||
|
// database.
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// })
|
||||||
|
}
|
||||||
|
|
||||||
let recordID = CKRecordID(recordName: bookID + "|" + article.path)
|
|
||||||
let database = CKContainer(identifier: "iCloud.org.kiwix").privateCloudDatabase
|
|
||||||
|
|
||||||
database.fetchRecordWithID(recordID) { (record, error) in
|
|
||||||
if let record = record {
|
// guard let bookID = article.book?.id else {finish(); return}
|
||||||
if self.article.isBookmarked {
|
//
|
||||||
self.populate(record, with: self.article)
|
// let recordID = CKRecordID(recordName: bookID + "|" + article.path)
|
||||||
database.saveRecord(record, completionHandler: { (record, error) in
|
// let database = CKContainer(identifier: "iCloud.org.kiwix").privateCloudDatabase
|
||||||
self.finish()
|
//
|
||||||
})
|
// database.fetchRecordWithID(recordID) { (record, error) in
|
||||||
} else {
|
// if let record = record {
|
||||||
database.deleteRecordWithID(recordID, completionHandler: { (recordID, error) in
|
// if self.article.isBookmarked {
|
||||||
self.finish()
|
// self.populate(record, with: self.article)
|
||||||
})
|
// database.saveRecord(record, completionHandler: { (record, error) in
|
||||||
}
|
// self.finish()
|
||||||
} else {
|
// })
|
||||||
guard self.article.isBookmarked else {self.finish(); return}
|
// } else {
|
||||||
let record = CKRecord(recordType: "Article", recordID: recordID)
|
// database.deleteRecordWithID(recordID, completionHandler: { (recordID, error) in
|
||||||
self.populate(record, with: self.article)
|
// self.finish()
|
||||||
database.saveRecord(record, completionHandler: { (record, error) in
|
// })
|
||||||
self.finish()
|
// }
|
||||||
})
|
// } else {
|
||||||
}
|
// guard self.article.isBookmarked else {self.finish(); return}
|
||||||
}
|
// let record = CKRecord(recordType: "Article", recordID: recordID)
|
||||||
|
// self.populate(record, with: self.article)
|
||||||
|
// database.saveRecord(record, completionHandler: { (record, error) in
|
||||||
|
// self.finish()
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
func populate(record: CKRecord, with article: Article) {
|
func populate(record: CKRecord, with article: Article) {
|
||||||
|
2
Podfile
2
Podfile
@ -12,7 +12,7 @@ pod 'Operations', :git => 'https://github.com/ProcedureKit/ProcedureKit.git', :b
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
target 'Kiwix-OSX' do
|
target 'Kiwix-macOS' do
|
||||||
|
|
||||||
platform :osx, '10.10'
|
platform :osx, '10.10'
|
||||||
|
|
||||||
|
@ -28,6 +28,6 @@ SPEC CHECKSUMS:
|
|||||||
Operations: 6a33d325dae88de21b8edc69b9884fce01aea22b
|
Operations: 6a33d325dae88de21b8edc69b9884fce01aea22b
|
||||||
SwiftyUserDefaults: 7abdba50a50ea0c18ee8903af3c88e4c1cb8448d
|
SwiftyUserDefaults: 7abdba50a50ea0c18ee8903af3c88e4c1cb8448d
|
||||||
|
|
||||||
PODFILE CHECKSUM: 7fce2ab788d4fea2728405e44965e38a852f02db
|
PODFILE CHECKSUM: e345ab565b0ce78937afe5c9543a0acc00375442
|
||||||
|
|
||||||
COCOAPODS: 1.0.1
|
COCOAPODS: 1.0.1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user