Skip to content
This repository has been archived by the owner on Dec 17, 2018. It is now read-only.

Offline sync via NSPersistentHistory, support for CloudKit Sharing #51

Open
wants to merge 216 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
216 commits
Select commit Hold shift + click to select a range
5eef747
normalize on Push & Pull nomenclature
May 17, 2018
47f0d09
ignore .DS_Store files
May 17, 2018
53c2f62
more nomenclature changes
May 17, 2018
c36d4bd
still more nomenclature changes
May 22, 2018
75a1b3e
don’t need to use self.
May 22, 2018
4142fc3
enable persistent history in Core Data
May 23, 2018
ae8fdb2
move the push code outside of the didSave handler
May 23, 2018
51913b2
update to Swift 4.2
deeje Sep 23, 2018
2c7ce03
supporting transformable attributes
Scytalion Apr 3, 2018
c908d21
adding fixes for fixing relationships
Scytalion Apr 4, 2018
c3a7dab
error handling
Scytalion Apr 5, 2018
1dcee9e
update CloudCore to Swift 4.2
deeje Nov 18, 2018
7738059
support for push to CloudKit via PersistentHistory
deeje Nov 21, 2018
a7bd3b6
CloudCore.usePersistenHistoryForPush
deeje Nov 21, 2018
30d73c9
fix delete
deeje Nov 22, 2018
f71a5a1
processPersistentHistory when reachability changes
deeje Nov 22, 2018
1636053
catch overall CKModify record operation errors
deeje Nov 22, 2018
ac0ada3
delete CK records from tombstone recordData
deeje Nov 22, 2018
f644ce8
don’t push all if using persistent history
deeje Nov 22, 2018
000a82d
rename to PullResult for consistency
deeje Nov 22, 2018
98ef980
more normalizing on push/pull terminology
deeje Nov 22, 2018
f01a249
TODO: optimize by using change.updatedProperties
deeje Nov 22, 2018
eb25281
actually delete history as we push
deeje Nov 27, 2018
3bfa66a
use recordNames to match CK and CD objects
deeje Nov 27, 2018
4110154
add ServiceAttributeNames.contains(…)
deeje Nov 27, 2018
1eca3df
use existing recordName if it exists
deeje Nov 27, 2018
0cc7f5a
support for public push
deeje Nov 27, 2018
5231870
replace .isPublic with ServiceAttributeNames.scopes
deeje Nov 27, 2018
5175bd1
only setRecordInfo for scopes
deeje Nov 27, 2018
b75027e
use container.databse(with: scope)
deeje Nov 27, 2018
9f69b52
with recordName, we don’t need to store recordIDs
deeje Nov 28, 2018
e4a9963
remove unused CKRecordID extensions
deeje Nov 28, 2018
79e7f36
add ServiceAttributeNames.ownerName
deeje Nov 28, 2018
d7fe317
properly establish parent-child relationships
deeje Nov 29, 2018
ddabe38
making some extension funcs public, for sharing
deeje Nov 30, 2018
99d34af
support for (shared) database changes
deeje Nov 30, 2018
4045c02
implement recordZoneWithIDWasDeletedBlock
deeje Dec 2, 2018
3f465e3
more resilience when error during fetchHistory
deeje Dec 2, 2018
aa97c37
update test cases to newer APIs
deeje Dec 2, 2018
af07b49
update Example to latest CloudCore
deeje Dec 3, 2018
e11d9cf
update ReadMe to latest CloudCore
deeje Dec 3, 2018
961fe5e
reset Example bundle ID
deeje Dec 3, 2018
96871f3
update author list
deeje Dec 3, 2018
fb7a6f8
[deeje] updated ReadMe to properly reflect status
deeje Dec 5, 2018
eb30a80
optimize by using change.updatedProperties
deeje Dec 7, 2018
d2f1eab
update CloudKitTests
deeje Dec 7, 2018
8464bae
more updates to CloudKitTests
deeje Dec 7, 2018
2209cfd
updating swift-version and travis.yml to latest
deeje Dec 7, 2018
959b95d
tell travis to build the CloudCore.xcworkspace
deeje Dec 7, 2018
e687f46
don’t point travis to “Example/Podfile”
deeje Dec 7, 2018
2ae5ec0
update test code to Swift 4.2
deeje Dec 7, 2018
b2f6f46
enable NSPersistentHistoryTrackingKey in iOS 11
deeje Dec 7, 2018
1646c86
disabling build Example in travis
deeje Dec 7, 2018
8d4d862
Only use Reachability on iOS
deeje Dec 7, 2018
0e848a4
remove Reachability as a dependency
deeje Dec 8, 2018
5ad3e46
update travis to build project instead of workspace
deeje Dec 8, 2018
e2192b8
clean out the last of the Cocoapods from project
deeje Dec 8, 2018
c47cc09
fix use of NSPersistentHistory in CoreDataTestCase
deeje Dec 8, 2018
f1323b9
updating podspec for Travis CI
deeje Dec 8, 2018
c360a6d
skip unkown record values, probably newer schema
deeje Dec 9, 2018
3c988e4
Properly ignore unknown data from CloudKit
deeje Dec 11, 2018
0e98466
enable editing of shared data
deeje Dec 27, 2018
36fb370
Tokens now fully managed by CloudCore
deeje Jan 2, 2019
c1624bd
remove applicationWillTerminate from Example.app
deeje Jan 2, 2019
d3bb258
Pull records serially, RecordToCD.performAndWait
deeje Jan 10, 2019
6603267
on launch, check for pending changes
deeje Jan 15, 2019
5a6a56d
Make sure only app extension APIs only are used to prevent warnings b…
hyerra Jan 19, 2019
a0b1c69
support for query subscriptions on public database
deeje Apr 13, 2019
8a58af3
(silence a warning)
deeje Apr 14, 2019
ac7b7e9
don’t bother updating deleted records
deeje Apr 19, 2019
bf39fcc
add a matching unsubscribe call, generate same id
deeje Apr 23, 2019
f7172a5
remove unused/duplicate typealias
deeje Apr 25, 2019
0be39b4
making RecordToCoreDataOperation for app use
deeje Apr 27, 2019
b0b874e
udpated ReadMe to include discussion of iOS 13
deeje Jun 6, 2019
b562025
added additional note regarding iOS 13 native sync
deeje Aug 20, 2019
2f2f345
update podspec to use Swift 5.0
deeje Aug 20, 2019
38504bd
update Example project to Swift 5
deeje Aug 20, 2019
485a79d
remove .swift-version, use version in podspec
deeje Aug 20, 2019
99bc204
update to Swift 5.0
deeje Aug 20, 2019
a9b2157
update tests to Swift 5.0
deeje Aug 20, 2019
592529a
Merge branch 'release/3.0'
deeje Aug 20, 2019
078b890
Merge tag '3.0' into develop
deeje Aug 20, 2019
bdd1bb1
use Xcode 10.3 for Swift 5.0
deeje Aug 20, 2019
6f0c6c6
Release 3.0.1
deeje Aug 21, 2019
58f854d
update ReadMe CocoaPods instructions
deeje Aug 21, 2019
6062f42
Merge branch 'master' into develop
deeje Aug 21, 2019
55a3305
update to latest KeyedArchiver APIs
deeje Sep 15, 2019
3d3dd35
refactor to use ZoneConfiguration, not ZoneOptions
deeje Sep 15, 2019
54e7dfe
refactor to use CKOperation.Configuration
deeje Sep 15, 2019
99df221
update the license
deeje Feb 17, 2020
cf1e917
require iOS 13, macOS 10.15, watchOS 6, Swift 5.1
deeje Feb 17, 2020
01ce56c
enable watchOS 6 support
deeje Feb 17, 2020
c7e9a05
gracefully handle unknown references
deeje Jun 25, 2020
0392745
fix broken tokens
deeje Oct 16, 2020
5f5676b
fix bug in CoreData where _defaultOwner != __defaultOwner__
deeje Nov 17, 2020
32cdd72
fix a race condition in processChanges ?
deeje Feb 7, 2021
463556d
make CloudCoreConfig fully public
deeje Mar 16, 2021
b3d136f
implement PullResult.wkBackgroundFetchResult
deeje Mar 16, 2021
5a237be
don’t assume CKContainer.default(), use Config
deeje Mar 16, 2021
1e3be9a
container and db op queues, QoS = .userInteractive
deeje Mar 18, 2021
3d9ffdf
ability to pull a root record, useful for sharing
deeje Mar 24, 2021
c19078f
formally define persistentHistoryTokenKey
deeje Mar 30, 2021
e918116
save backghroundContexts in their own thread
deeje Apr 27, 2021
ff25623
ensure all Ops ask for background task time
deeje Apr 27, 2021
cbeaaeb
NSPersistentContainer.performBackgroundPushTask
deeje May 11, 2021
66d68ca
grab ownerName, targetScope inside context!
deeje May 11, 2021
0ad603b
eliminate warning re CloudCoreDelegate: AnyObject
deeje May 19, 2021
11c94d2
update Example to use Connectivity cocoapod
deeje May 19, 2021
f564b41
update Xcode project, target iOS 13, watchOS 6
deeje May 19, 2021
2ead889
use Xcode 12.5 for travis
deeje May 19, 2021
d9092f5
CloudCore now fetches userRecordID
deeje May 25, 2021
bc8d77c
add Sharing support
deeje May 28, 2021
0aff6d7
update Example with Sharing support
deeje May 28, 2021
470ab1d
updated ReadMe to include info about Sharing
deeje May 28, 2021
c0e0241
document windowScene(userDidAcceptCloudKitShare)
deeje Jun 4, 2021
289ebb0
make Tokens atomic
deeje Jun 18, 2021
a533cf2
dont hide potential bugs behind try?
deeje Jun 18, 2021
e3e6bb1
don’t start uploading until zone is created
deeje Jun 18, 2021
1a0cbb7
(remove unnecessary () from async call site )
deeje Jun 18, 2021
b2927cf
add PullChangesOp directly to queue
deeje Jun 18, 2021
532ab02
save context on completing recordZoneChangesOp
deeje Jun 18, 2021
b9b776e
eliminate ErrorBlocvkProxy
deeje Jun 18, 2021
ab505a9
use the context in processMissingReferences
deeje Jun 27, 2021
ec91555
add handlers for when share is saved or stopped
deeje Jul 5, 2021
8fe5d27
DRY when fetching the share
deeje Jul 6, 2021
db60ccb
don’t try to upate object when sharing stops
deeje Jul 6, 2021
cc0283d
update example when displaying sharing UI
deeje Jul 6, 2021
c649c7b
DRY, call shareDatabaseAndRecordID instead
deeje Jul 6, 2021
21859e8
call setShareRecore on start/stop sharing
deeje Jul 7, 2021
bd70c25
UIViewController. iCloudAvailable(withPrompt…)
deeje Jul 14, 2021
214de8a
when the zone is first created, do an initial pull
deeje Jul 15, 2021
d7ba6ba
(remove an duplicate line of code)
deeje Jul 23, 2021
b8fbf62
backgroundPushTask is always merge PropertyObjectTrump
deeje Jul 23, 2021
52f131a
all pull operations should be serialized
deeje Jul 23, 2021
01a8b4f
bumping podspec version to 4.0
deeje Jul 29, 2021
66ebbd7
update license & readme
deeje Jul 29, 2021
3deea7d
Merge pull request #22 from deeje/feature/4.0
deeje Jul 29, 2021
15598fb
set state of AsyncOp in its own thread
deeje Aug 5, 2021
3fb1290
still trying to resolve rando crash re missing refs
deeje Aug 5, 2021
adebd43
align podspec targets with project targets
deeje Jan 13, 2022
ed2c2a5
Merge pull request #23 from deeje/feature/4.0.1
deeje Jan 13, 2022
8d5f56c
fix for CloudKit error 3, not online when using cellular
deeje Jan 26, 2022
fde7dee
more qualityOfService = .userInitiated
deeje Jan 26, 2022
f50d8d7
CloudCore.perform { configuredcontainer in }
deeje Jan 26, 2022
1336c13
fix use of #availability
deeje Mar 19, 2022
271b953
explicitly import CloudKit in Example AppDelegate
deeje Mar 19, 2022
ba01879
bump podspec s.version = 4.0.2
deeje Mar 19, 2022
99ecd2a
Merge pull request #2 from hyerra/master
deeje Mar 31, 2022
9af949a
Merge remote-tracking branch 'deeje/master' into feature/4.0.2
deeje Mar 31, 2022
2f771f7
Merge pull request #24 from deeje/feature/4.0.2
deeje Apr 3, 2022
bc837c0
read from record.encryptedValues
deeje Apr 3, 2022
6d42cb1
if allowsCloudEncryption, store in encryptedValues
deeje Apr 3, 2022
e3562b3
update Example app to support encrypted fields
deeje Apr 3, 2022
6828049
(update sharing type to match bundleID)
deeje Apr 3, 2022
08c8a6e
handle CKErrorUserDidResetEncryptedData
deeje Apr 4, 2022
eedd564
another URL re CKErrorUserDidResetEncryptedDataKey
deeje Apr 4, 2022
eaa9db9
update project
deeje Apr 12, 2022
f657c8b
Update ReadMe to include 'Allows Cloud Encryption’
deeje Apr 12, 2022
eb611c7
update podspec version to 4.1
deeje Apr 12, 2022
7c51b88
Merge pull request #27 from deeje/feature/EncryptedFields
deeje Apr 12, 2022
f975be5
proper #available for encryption support
deeje Apr 13, 2022
3f5d575
clean up deprecated CKRecord_Reference_Action
deeje Apr 13, 2022
f3a7c2f
update podspec version to 4.1.1
deeje Apr 13, 2022
3fde4c1
masked attributes
deeje Apr 15, 2022
3020486
update version to 5.0.0
deeje Apr 15, 2022
f90e5ff
updating ReadMe with Scope, Maskable Attributes
deeje Apr 15, 2022
2d5218a
(add missing classes, update names to project)
deeje Apr 16, 2022
effef32
CloudCoreCacheable, manual upload & download
deeje Apr 20, 2022
66c4c8a
trigger upload after successful push
deeje Apr 20, 2022
2524a39
show progress during upload, automatic download
deeje Apr 20, 2022
16f739b
no refresh needed when triggering cacheable.upload
deeje Apr 20, 2022
54bcdc9
remove data file when cacheable is deleted
deeje Apr 21, 2022
3625437
(we’ll come back to .unload)
deeje Apr 21, 2022
e3cc7fd
when caching fails, save lastErrorMessage
deeje Apr 21, 2022
9184225
retry on rateLimit or zoneBusy errors
deeje Apr 21, 2022
423b123
(call UI completion handlers on main thread)
deeje Apr 21, 2022
aef1d45
merged can’t fail during pull
deeje Apr 21, 2022
9fa8f86
store cacheables in App Support directory
deeje Apr 21, 2022
5a94ae0
update ReadMe with Cacheable Assets info
deeje Apr 21, 2022
b66bd71
MUST override awakeFromInsert & prepareForDeletion
deeje Apr 21, 2022
88a80e5
very important to preserveAfterDeletion
deeje Apr 25, 2022
1c473af
move default values into awakeFromInsert
deeje Apr 25, 2022
a39bc0f
nope, developer must manually set cache state
deeje Apr 25, 2022
c8a7009
use FileManager to find, and create, user paths
deeje Apr 25, 2022
bdcd8b6
when deleting cacheable, try to cancel them too
deeje Apr 28, 2022
958dedd
return pull results in callback
deeje May 10, 2022
de85998
(fix a typo in ReadMe)
deeje May 10, 2022
a24f877
(more ReadMe edits for clarity)
deeje May 10, 2022
cc5ec9e
(updated authors attributions)
deeje May 10, 2022
6f2e983
(update comparison w NSPersistentCloudKitCOntainer)
deeje May 10, 2022
ca363ff
implement CacheState.unload
deeje May 15, 2022
6b49b57
update example to call removeLocal()
deeje May 15, 2022
5d31ad3
Merge pull request #28 from deeje/feature/Cacheable
deeje May 15, 2022
3be6fdf
fix compiler errors in Example app
deeje May 18, 2022
0c1b64b
Merge pull request #31 from deeje/fix/example5.0
deeje May 18, 2022
764379e
update version to 5.0.2
deeje May 18, 2022
8d609c4
Merge pull request #32 from deeje/fix/versionInSpec
deeje May 18, 2022
a1d4281
progress only increases, qos is configurable
deeje May 27, 2022
5cb19d1
bump podspec version to 5.1.0
deeje May 27, 2022
a83107a
always use persistentHistory, reduce churn on rapid saves
deeje May 29, 2022
32ed3f9
need to update removeStatus locally to stay in sync
deeje May 29, 2022
5ab9a31
simplify the .upload triggering
deeje May 29, 2022
3e56f14
increase delay in sync to 5 sec after last save
deeje May 29, 2022
d1e0855
cacheable ops can already be in running
deeje May 29, 2022
15c5173
restart all long-lived ops if one errors out
deeje May 30, 2022
cacc122
if CKErrorRetryAfterKey, wait to push more changes
deeje May 30, 2022
2ab656e
centralize the pause timer
deeje May 31, 2022
950234b
share MOC across CoreDataObserver & CacheManager
deeje May 31, 2022
4b93c61
push operations are atomic
deeje May 31, 2022
997898d
rapid inserts could cause converter to fail
deeje May 31, 2022
d0b3cec
(remove testing code)
deeje May 31, 2022
899df48
more cleanup of ObjectToRecordOperation
deeje May 31, 2022
85098a4
background tasks are only on iOS
deeje May 31, 2022
258b7b0
update ReadMe to include links to MediaBook app
deeje Jun 1, 2022
fb9b5e4
NSPersistentHistoryTracking is now required
deeje Jun 1, 2022
17a0b8d
Merge pull request #33 from deeje/feature/5.1
deeje Jun 1, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,4 @@ fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output
.DS_Store
1 change: 0 additions & 1 deletion .swift-version

This file was deleted.

6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
osx_image: xcode9.2
language: objective-c
osx_image: xcode12.5
language: swift
podfile: "Example/Podfile"

branches:
Expand All @@ -8,7 +8,7 @@ branches:

env:
- DESTINATION='platform=OS X' POD_LINT="YES"
- DESTINATION='platform=iOS Simulator,name=iPhone 6S' BUILD_EXAMPLE="YES"
- DESTINATION='platform=iOS Simulator,name=iPhone XS' BUILD_EXAMPLE="YES"
- DESTINATION='platform=watchOS Simulator,name=Apple Watch - 38mm' SKIP_TEST="YES"
- DESTINATION='platform=tvOS Simulator,name=Apple TV 4K'

Expand Down
23 changes: 12 additions & 11 deletions CloudCore.podspec
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
Pod::Spec.new do |s|
s.name = "CloudCore"
s.summary = "Framework that enables synchronization between CloudKit (iCloud) and Core Data. Can be used as CloudKit caching mechanism."
s.version = "2.0.1"
s.homepage = "https://github.com/sorix/CloudCore"
s.summary = "Framework that enables synchronization between CloudKit and Core Data."
s.version = "5.1.0"
s.homepage = "https://github.com/deeje/CloudCore"
s.license = 'MIT'
s.author = { "Vasily Ulianov" => "[email protected]" }
s.author = { "deeje" => "[email protected]", "Vasily Ulianov" => "[email protected]" }
s.source = {
:git => "https://github.com/sorix/CloudCore.git",
:git => "https://github.com/deeje/CloudCore.git",
:tag => s.version.to_s
}

s.ios.deployment_target = '10.0'
s.osx.deployment_target = '10.12'
s.tvos.deployment_target = '10.0'
s.watchos.deployment_target = '3.0'
s.ios.deployment_target = '13.0'
s.osx.deployment_target = '11.0'
s.tvos.deployment_target = '12.0'
s.watchos.deployment_target = '6.0'

s.source_files = 'Source/**/*.swift'

s.ios.frameworks = 'Foundation', 'CloudKit', 'CoreData'
s.osx.frameworks = 'Foundation', 'CloudKit', 'CoreData'
s.tvos.frameworks = 'Foundation', 'CloudKit', 'CoreData'
s.watchos.frameworks = 'Foundation', 'CloudKit', 'CoreData'

s.pod_target_xcconfig = { 'SWIFT_VERSION' => '4.0' }
s.documentation_url = 'http://cocoadocs.org/docsets/CloudCore/'
s.swift_versions = [5.1]
end
225 changes: 140 additions & 85 deletions CloudCore.xcodeproj/project.pbxproj
100755 → 100644

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
26 changes: 10 additions & 16 deletions CloudCore.xcodeproj/xcshareddata/xcschemes/CloudCore.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "1330"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,9 +26,17 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D5B2E89E1C3A780C00C0327D"
BuildableName = "CloudCore.framework"
BlueprintName = "CloudCore"
ReferencedContainer = "container:CloudCore.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO">
Expand All @@ -41,23 +49,11 @@
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D5B2E89E1C3A780C00C0327D"
BuildableName = "CloudCore.framework"
BlueprintName = "CloudCore"
ReferencedContainer = "container:CloudCore.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand All @@ -73,8 +69,6 @@
ReferencedContainer = "container:CloudCore.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
Loading