cloud kit sub

This commit is contained in:
Chris Li 2016-12-29 17:21:55 -05:00
parent e7c988404d
commit 2e4891e42e
3 changed files with 55 additions and 0 deletions

View File

@ -57,6 +57,9 @@ class RecentSearchController: UIViewController, UICollectionViewDataSource, UICo
// MARK: - CollectionView Delegate
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
guard let mainVC = parent?.parent?.parent as? MainController else {return}
print("tapped")
// guard let mainVC = parent?.parent?.parent as? MainController,
// let searchController = parent?.parent as? SearchController,
// let cell = collectionView.cellForItem(at: indexPath) as? LocalLangCell,

View File

@ -74,6 +74,7 @@
9779C3141D4575AD0064CC8E /* NotificationCenter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 97E609F01D103DED00EBCB9D /* NotificationCenter.framework */; };
9779C3171D4575AE0064CC8E /* TodayViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9779C3161D4575AE0064CC8E /* TodayViewController.swift */; };
9779C31E1D4575AE0064CC8E /* Bookmarks.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 9779C3131D4575AD0064CC8E /* Bookmarks.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
977A458C1E14EA140089C596 /* Cloud.swift in Sources */ = {isa = PBXBuildFile; fileRef = 977A458B1E14EA140089C596 /* Cloud.swift */; };
977AE7F91DD8F22400F1E581 /* SearchBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 971A102A1D022AD5007FC62C /* SearchBar.swift */; };
977B954D1DD4C40400F6F62B /* ScanLocalBook.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97D6811E1D6F70AC00E5FA99 /* ScanLocalBook.swift */; };
97A08C151DD263B90070D0E4 /* Book.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97D681341D6F711A00E5FA99 /* Book.swift */; };
@ -232,6 +233,7 @@
9779C3131D4575AD0064CC8E /* Bookmarks.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = Bookmarks.appex; sourceTree = BUILT_PRODUCTS_DIR; };
9779C3161D4575AE0064CC8E /* TodayViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TodayViewController.swift; sourceTree = "<group>"; };
9779C31B1D4575AE0064CC8E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
977A458B1E14EA140089C596 /* Cloud.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Cloud.swift; sourceTree = "<group>"; };
9788419C1DA2FF2A00D22D3C /* MainInterface.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = MainInterface.storyboard; sourceTree = "<group>"; };
97A127C51D777CF100FB204D /* RecentSearchController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RecentSearchController.swift; sourceTree = "<group>"; };
97A127C61D777CF100FB204D /* SearchScopeAndHistoryController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SearchScopeAndHistoryController.swift; sourceTree = "<group>"; };
@ -511,6 +513,7 @@
973BCD1F1CEB412E00F10B44 /* Shared */ = {
isa = PBXGroup;
children = (
977A458A1E14E98F0089C596 /* Cloud */,
9711872D1CEB507600B9909D /* CoreData */,
97163D321CD7E79F008BE2D6 /* Help Docs */,
974C495E1DA307FF00E276E1 /* JavaScripts */,
@ -609,6 +612,14 @@
path = Bookmarks;
sourceTree = "<group>";
};
977A458A1E14E98F0089C596 /* Cloud */ = {
isa = PBXGroup;
children = (
977A458B1E14EA140089C596 /* Cloud.swift */,
);
path = Cloud;
sourceTree = "<group>";
};
9787BC1F1D9318080030D311 /* Others */ = {
isa = PBXGroup;
children = (
@ -1108,6 +1119,7 @@
97A1FD3B1D6F724E00A80EE2 /* stringTools.cpp in Sources */,
970E7F741D9DB0FC00741290 /* 1.8.xcmappingmodel in Sources */,
973207A01DD1983D00EDD3DC /* DownloadTasksController.swift in Sources */,
977A458C1E14EA140089C596 /* Cloud.swift in Sources */,
97D0E9931DDA487E0029530E /* SearchBaseController.swift in Sources */,
97A1FD321D6F723D00A80EE2 /* resourceTools.cpp in Sources */,
97A1FD451D6F728200A80EE2 /* StringTools.swift in Sources */,

40
Kiwix/Cloud/Cloud.swift Normal file
View File

@ -0,0 +1,40 @@
//
// Cloud.swift
// Kiwix
//
// Created by Chris Li on 12/29/16.
// Copyright © 2016 Chris Li. All rights reserved.
//
import CloudKit
class Cloud {
class var privateDatabase: CKDatabase {
return CKContainer.default().privateCloudDatabase
}
class func subscribeForChanges() {
let subscription = CKDatabaseSubscription(subscriptionID: "")
subscription.notificationInfo = CKNotificationInfo()
subscription.notificationInfo?.shouldSendContentAvailable = true
let operation = CKModifySubscriptionsOperation(subscriptionsToSave: [subscription], subscriptionIDsToDelete: nil)
operation.qualityOfService = .utility
operation.modifySubscriptionsCompletionBlock = { saved, deleted, error in
if let error = error {
// handle error
} else {
//seuscriptionIsLocallyCached = true
}
}
// add to a database's operation queue
privateDatabase.add(operation)
}
class func handlePush() {
}
}