Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.

Commit 42f6117

Browse files
committed
Merge branch 'release/3.8.0'
2 parents 42e09b3 + 51ad7f8 commit 42f6117

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1891
-368
lines changed

Cartfile.resolved

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ github "Hearst-DD/ObjectMapper" "2.2.8"
33
github "Quick/Nimble" "v7.0.1"
44
github "kif-framework/KIF" "v3.6.0"
55
github "kishikawakatsumi/KeychainAccess" "v3.0.2"
6-
github "mxcl/PromiseKit" "4.3.2"
6+
github "mxcl/PromiseKit" "4.4.0"
77
github "pubnub/objective-c" "v4.6.3"
8-
github "realm/realm-cocoa" "v2.9.1"
8+
github "realm/realm-cocoa" "v2.10.0"
99
github "tjboneman/NSPredicate-MongoDB-Adaptor" "2444d4a790527eb5c9fcb4e4f7b4af417048ae18"

Kinvey.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
1616
#
1717

1818
s.name = "Kinvey"
19-
s.version = "3.7.1"
19+
s.version = "3.8.0"
2020
s.summary = "Kinvey iOS SDK"
2121

2222
# This description is used to generate tags and improve search results.

Kinvey/Kinvey.xcodeproj/project.pbxproj

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
571991091CB45EEE00070CDA /* Person.swift in Sources */ = {isa = PBXBuildFile; fileRef = 571991081CB45EEE00070CDA /* Person.swift */; };
3131
571ADCC31ED8EF6100D0A127 /* PubNub.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 57E6BCFE1EC51F64000E5C52 /* PubNub.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
3232
571ADCC41ED8EF6A00D0A127 /* PubNub.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 57E6BCFE1EC51F64000E5C52 /* PubNub.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
33+
571BA2611F55D9E600DE1886 /* MyFile.swift in Sources */ = {isa = PBXBuildFile; fileRef = 571BA2601F55D9E600DE1886 /* MyFile.swift */; };
34+
571BA2621F55DA1C00DE1886 /* MyFile.swift in Sources */ = {isa = PBXBuildFile; fileRef = 571BA2601F55D9E600DE1886 /* MyFile.swift */; };
3335
572005C81D30236300AE9AC5 /* NetworkStoreTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 576E95AC1C20DB7C00258CC3 /* NetworkStoreTests.swift */; };
3436
572005CA1D342B2800AE9AC5 /* Book.swift in Sources */ = {isa = PBXBuildFile; fileRef = 572005C91D342B2800AE9AC5 /* Book.swift */; };
3537
5726321E1EE99C940082A1A8 /* SongRecommendation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5726321D1EE99C940082A1A8 /* SongRecommendation.swift */; };
@@ -288,6 +290,14 @@
288290
57BEAE351C98AB3900479206 /* MainViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57BEAE341C98AB3900479206 /* MainViewController.swift */; };
289291
57C2F1731D5E5A68005A214B /* BuilderType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57C2F1721D5E5A68005A214B /* BuilderType.swift */; };
290292
57C71DC81C3EFBF900B1BEF2 /* Request.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57C71DC71C3EFBF900B1BEF2 /* Request.swift */; };
293+
57C731EE1F575D4B00B67C13 /* ObjectMapper.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 57B7687D1D10C02C0086AA38 /* ObjectMapper.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
294+
57C731EF1F575D5A00B67C13 /* PubNub.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 57E6BD001EC51F80000E5C52 /* PubNub.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
295+
57C731F01F575D6600B67C13 /* KeychainAccess.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 57B0C1DF1CDCE88900492D6C /* KeychainAccess.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
296+
57C731F11F575D7300B67C13 /* PromiseKit.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 57B0C1E51CDCE88900492D6C /* PromiseKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
297+
57C731F21F575DBB00B67C13 /* Realm.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 57B0C1E71CDCE88900492D6C /* Realm.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
298+
57C731F31F575DC600B67C13 /* RealmSwift.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 57B0C1E91CDCE88900492D6C /* RealmSwift.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
299+
57C731F41F575DD100B67C13 /* XCGLogger.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 577751391DF8B908006C98F1 /* XCGLogger.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
300+
57C731FA1F57721700B67C13 /* MacOSOnlyTestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57C731F91F57721700B67C13 /* MacOSOnlyTestCase.swift */; };
291301
57D386A21CC19D0C0014050D /* Kinvey.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 57A27C811C178F17000DF951 /* Kinvey.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
292302
57D386A31CC19D7C0014050D /* Kinvey.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 57A27C811C178F17000DF951 /* Kinvey.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
293303
57D643001CA3268000F6D16E /* CacheMigrationTestCaseStep1.swift in Sources */ = {isa = PBXBuildFile; fileRef = 577155531CA1D65D00C91B4B /* CacheMigrationTestCaseStep1.swift */; };
@@ -664,6 +674,22 @@
664674
);
665675
runOnlyForDeploymentPostprocessing = 0;
666676
};
677+
57C731ED1F575D3B00B67C13 /* CopyFiles */ = {
678+
isa = PBXCopyFilesBuildPhase;
679+
buildActionMask = 2147483647;
680+
dstPath = "";
681+
dstSubfolderSpec = 10;
682+
files = (
683+
57C731EE1F575D4B00B67C13 /* ObjectMapper.framework in CopyFiles */,
684+
57C731EF1F575D5A00B67C13 /* PubNub.framework in CopyFiles */,
685+
57C731F01F575D6600B67C13 /* KeychainAccess.framework in CopyFiles */,
686+
57C731F11F575D7300B67C13 /* PromiseKit.framework in CopyFiles */,
687+
57C731F21F575DBB00B67C13 /* Realm.framework in CopyFiles */,
688+
57C731F31F575DC600B67C13 /* RealmSwift.framework in CopyFiles */,
689+
57C731F41F575DD100B67C13 /* XCGLogger.framework in CopyFiles */,
690+
);
691+
runOnlyForDeploymentPostprocessing = 0;
692+
};
667693
57D6430C1CA3268000F6D16E /* CopyFiles */ = {
668694
isa = PBXCopyFilesBuildPhase;
669695
buildActionMask = 2147483647;
@@ -718,6 +744,7 @@
718744
5714EBAF1CCECE35001E3ECF /* AclTestCase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AclTestCase.swift; sourceTree = "<group>"; };
719745
5714EBB11CCEEAF9001E3ECF /* RemoveByIdOperation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RemoveByIdOperation.swift; sourceTree = "<group>"; };
720746
571991081CB45EEE00070CDA /* Person.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Person.swift; sourceTree = "<group>"; };
747+
571BA2601F55D9E600DE1886 /* MyFile.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MyFile.swift; sourceTree = "<group>"; };
721748
572005C91D342B2800AE9AC5 /* Book.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Book.swift; sourceTree = "<group>"; };
722749
5726321D1EE99C940082A1A8 /* SongRecommendation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SongRecommendation.swift; sourceTree = "<group>"; };
723750
572709B01F50BD70002DE5A4 /* RealtimeAclTestCase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RealtimeAclTestCase.swift; sourceTree = "<group>"; };
@@ -897,6 +924,7 @@
897924
57BEAE341C98AB3900479206 /* MainViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MainViewController.swift; sourceTree = "<group>"; };
898925
57C2F1721D5E5A68005A214B /* BuilderType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BuilderType.swift; sourceTree = "<group>"; };
899926
57C71DC71C3EFBF900B1BEF2 /* Request.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Request.swift; sourceTree = "<group>"; };
927+
57C731F91F57721700B67C13 /* MacOSOnlyTestCase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MacOSOnlyTestCase.swift; sourceTree = "<group>"; };
900928
57D643141CA3268000F6D16E /* KinveyTests Migration Database Step 1.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "KinveyTests Migration Database Step 1.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
901929
57D6433B1CA3268600F6D16E /* KinveyTests Migration Database Step 2.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "KinveyTests Migration Database Step 2.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
902930
57D6433D1CA326DE00F6D16E /* CacheMigrationTestCaseStep2.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CacheMigrationTestCaseStep2.swift; sourceTree = "<group>"; };
@@ -1165,6 +1193,7 @@
11651193
5705B1CE1EDF823F0006980A /* Info.plist */,
11661194
5706231F1F1825CA00B7FAE9 /* PerformanceTest.swift */,
11671195
578148581F2BCC5D009E8622 /* HierarchyCache.swift */,
1196+
57C731F91F57721700B67C13 /* MacOSOnlyTestCase.swift */,
11681197
);
11691198
path = KinveyMacAppTests;
11701199
sourceTree = "<group>";
@@ -1446,6 +1475,7 @@
14461475
57379DA61C72AE7F00E240E9 /* GetOperationTest.swift */,
14471476
5711C46C1C74F52F00073806 /* SaveOperationTest.swift */,
14481477
5781D1301CE3ADBC00369F40 /* ErrorTestCase.swift */,
1478+
571BA2601F55D9E600DE1886 /* MyFile.swift */,
14491479
5781D1351CE3D0BA00369F40 /* FileTestCase.swift */,
14501480
5771F9FE1D301F6300903777 /* Event.swift */,
14511481
57136F621D5D23BF00731DDB /* MockKinveyBackend.swift */,
@@ -1837,6 +1867,7 @@
18371867
578E79571EEB0B0F002BBF9C /* Sources */,
18381868
578E79581EEB0B0F002BBF9C /* Frameworks */,
18391869
578E79591EEB0B0F002BBF9C /* Resources */,
1870+
57C731ED1F575D3B00B67C13 /* CopyFiles */,
18401871
);
18411872
buildRules = (
18421873
);
@@ -2540,6 +2571,7 @@
25402571
578B80501EE73A77004D92A6 /* Person.swift in Sources */,
25412572
5705B1CD1EDF823F0006980A /* RealtimeMacAppTests.swift in Sources */,
25422573
578B80511EE73A84004D92A6 /* MockKinveyBackend.swift in Sources */,
2574+
57C731FA1F57721700B67C13 /* MacOSOnlyTestCase.swift in Sources */,
25432575
570623201F1825CA00B7FAE9 /* PerformanceTest.swift in Sources */,
25442576
578B805C1EE73BF2004D92A6 /* DataTypeTestCase.swift in Sources */,
25452577
578B806A1EE746B9004D92A6 /* MetadataTestCase.swift in Sources */,
@@ -2564,6 +2596,7 @@
25642596
572709B21F50BD78002DE5A4 /* RealtimeAclTestCase.swift in Sources */,
25652597
578B806E1EE746CB004D92A6 /* PersistableTestCase.swift in Sources */,
25662598
578B80691EE746B2004D92A6 /* LogTestCase.swift in Sources */,
2599+
571BA2621F55DA1C00DE1886 /* MyFile.swift in Sources */,
25672600
578B80681EE74677004D92A6 /* RefProject.swift in Sources */,
25682601
578B805E1EE74328004D92A6 /* Event.swift in Sources */,
25692602
578B80761EE876C5004D92A6 /* UserTests.swift in Sources */,
@@ -2822,6 +2855,7 @@
28222855
572709B11F50BD70002DE5A4 /* RealtimeAclTestCase.swift in Sources */,
28232856
577155521CA0F1D400C91B4B /* FindOperationTest.swift in Sources */,
28242857
575465A41E66405D0063B4B6 /* PerformanceProductTestCase.swift in Sources */,
2858+
571BA2611F55D9E600DE1886 /* MyFile.swift in Sources */,
28252859
5796B3E71DEE8EC900209C9F /* CacheStoreTests.swift in Sources */,
28262860
5754DDBD1EAEBC4A00122A7A /* DateTestCase.swift in Sources */,
28272861
57E1C3AD1C17EC9500578974 /* UserTests.swift in Sources */,

Kinvey/Kinvey/Cache.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,11 @@ class AnyCache<T: Persistable>: CacheType {
104104
private let _detach: (AnyRandomAccessCollection<Type>, Query?) -> AnyRandomAccessCollection<Type>
105105

106106
typealias `Type` = T
107+
108+
let cache: Any
107109

108110
init<Cache: CacheType>(_ cache: Cache) where Cache.`Type` == T {
111+
self.cache = cache
109112
_getDynamic = { return cache.dynamic }
110113
_getTTL = { return cache.ttl }
111114
_setTTL = { cache.ttl = $0 }

Kinvey/Kinvey/CacheManager.swift

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -41,28 +41,27 @@ internal class CacheManager: NSObject {
4141
}
4242

4343
func clearAll(_ tag: String? = nil) {
44-
if let path = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first {
45-
let basePath = (path as NSString).appendingPathComponent(persistenceId)
46-
47-
let fileManager = FileManager.default
48-
49-
var isDirectory = ObjCBool(false)
50-
let exists = fileManager.fileExists(atPath: basePath, isDirectory: &isDirectory)
51-
if exists && isDirectory.boolValue {
52-
var array = try! fileManager.subpathsOfDirectory(atPath: basePath)
53-
array = array.filter({ (path) -> Bool in
54-
return path.hasSuffix(".realm") && (tag == nil || path.caseInsensitiveCompare(tag! + ".realm") == .orderedSame)
55-
})
56-
for realmFile in array {
57-
var realmConfiguration = Realm.Configuration.defaultConfiguration
58-
realmConfiguration.fileURL = URL(fileURLWithPath: (basePath as NSString).appendingPathComponent(realmFile))
59-
if let encryptionKey = encryptionKey {
60-
realmConfiguration.encryptionKey = encryptionKey
61-
}
62-
if let realm = try? Realm(configuration: realmConfiguration), !realm.isEmpty {
63-
try! realm.write {
64-
realm.deleteAll()
65-
}
44+
let path = cacheBasePath
45+
let basePath = (path as NSString).appendingPathComponent(persistenceId)
46+
47+
let fileManager = FileManager.default
48+
49+
var isDirectory = ObjCBool(false)
50+
let exists = fileManager.fileExists(atPath: basePath, isDirectory: &isDirectory)
51+
if exists && isDirectory.boolValue {
52+
var array = try! fileManager.subpathsOfDirectory(atPath: basePath)
53+
array = array.filter({ (path) -> Bool in
54+
return path.hasSuffix(".realm") && (tag == nil || path.caseInsensitiveCompare(tag! + ".realm") == .orderedSame)
55+
})
56+
for realmFile in array {
57+
var realmConfiguration = Realm.Configuration.defaultConfiguration
58+
realmConfiguration.fileURL = URL(fileURLWithPath: (basePath as NSString).appendingPathComponent(realmFile))
59+
if let encryptionKey = encryptionKey {
60+
realmConfiguration.encryptionKey = encryptionKey
61+
}
62+
if let realm = try? Realm(configuration: realmConfiguration), !realm.isEmpty {
63+
try! realm.write {
64+
realm.deleteAll()
6665
}
6766
}
6867
}

Kinvey/Kinvey/Client.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,7 @@ open class Client: Credential {
315315
}
316316

317317
internal class func fileURL(appKey: String, tag: String = defaultTag) -> URL {
318-
let paths = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)
319-
let path = paths.first! as NSString
318+
let path = cacheBasePath as NSString
320319
var filePath = URL(fileURLWithPath: path.appendingPathComponent(appKey))
321320
filePath.appendPathComponent("\(tag).realm")
322321
return filePath

0 commit comments

Comments
 (0)