Skip to content

Commit 30f9846

Browse files
authored
Merge pull request #245 from zapcannon87/master
release: 17.1.0
2 parents d616fea + e1662d1 commit 30f9846

23 files changed

+752
-539
lines changed

LeanCloud.podspec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'LeanCloud'
3-
s.version = '17.0.0'
3+
s.version = '17.1.0'
44
s.license = { :type => 'Apache License, Version 2.0', :file => 'LICENSE' }
55
s.summary = 'LeanCloud Swift SDK'
66
s.homepage = 'https://leancloud.cn/'
@@ -14,7 +14,7 @@ Pod::Spec.new do |s|
1414
s.watchos.deployment_target = '3.0'
1515

1616
s.subspec 'Foundation' do |ss|
17-
ss.dependency 'Alamofire', '5.0.0-rc.2'
17+
ss.dependency 'Alamofire', '~> 5.0-rc.2'
1818

1919
ss.source_files = 'Sources/Foundation/**/*.{swift}'
2020
end
@@ -24,7 +24,7 @@ Pod::Spec.new do |s|
2424
ss.dependency 'Starscream', '~> 3.1'
2525
ss.dependency 'GRDB.swift', '~> 4.4'
2626

27-
ss.dependency 'LeanCloud/Foundation'
27+
ss.dependency 'LeanCloud/Foundation', "#{s.version}"
2828

2929
ss.source_files = 'Sources/RTM/**/*.{swift}'
3030
end

LeanCloud.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,8 +1101,8 @@
11011101
isa = XCRemoteSwiftPackageReference;
11021102
repositoryURL = "https://github.com/Alamofire/Alamofire";
11031103
requirement = {
1104-
kind = exactVersion;
1105-
version = "5.0.0-rc.2";
1104+
kind = upToNextMajorVersion;
1105+
minimumVersion = "5.0.0-rc.2";
11061106
};
11071107
};
11081108
/* End XCRemoteSwiftPackageReference section */

LeanCloud.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

LeanCloudTests/BaseTestCase.swift

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ class BaseTestCase: XCTestCase {
2424
)
2525

2626
static let timeout: TimeInterval = 60.0
27-
2827
let timeout: TimeInterval = 60.0
2928

3029
override class func setUp() {
@@ -41,13 +40,15 @@ class BaseTestCase: XCTestCase {
4140
}
4241

4342
override class func tearDown() {
44-
[LCApplication.default.localStorageContext!.applicationSupportDirectoryPath,
45-
LCApplication.default.localStorageContext!.cachesDirectoryPath]
46-
.forEach({ (url) in
43+
[LCApplication.default.applicationSupportDirectoryURL,
44+
LCApplication.default.cachesDirectoryURL]
45+
.forEach { (url) in
4746
if FileManager.default.fileExists(atPath: url.path) {
4847
try! FileManager.default.removeItem(at: url)
4948
}
50-
})
49+
}
50+
LCApplication.default.unregister()
51+
super.tearDown()
5152
}
5253

5354
}
@@ -147,4 +148,34 @@ extension LCApplication {
147148
)
148149
}
149150

151+
var applicationSupportDirectoryURL: URL {
152+
return (
153+
try! FileManager.default.url(
154+
for: .applicationSupportDirectory,
155+
in: .userDomainMask,
156+
appropriateFor: nil,
157+
create: false))
158+
.appendingPathComponent(
159+
LocalStorageContext.domain,
160+
isDirectory: true)
161+
.appendingPathComponent(
162+
self.id.md5.lowercased(),
163+
isDirectory: true)
164+
}
165+
166+
var cachesDirectoryURL: URL {
167+
return (
168+
try! FileManager.default.url(
169+
for: .cachesDirectory,
170+
in: .userDomainMask,
171+
appropriateFor: nil,
172+
create: false))
173+
.appendingPathComponent(
174+
LocalStorageContext.domain,
175+
isDirectory: true)
176+
.appendingPathComponent(
177+
self.id.md5.lowercased(),
178+
isDirectory: true)
179+
}
180+
150181
}

LeanCloudTests/IMClientTestCase.swift

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,23 @@ class IMClientTestCase: RTMBaseTestCase {
1414
func testInit() {
1515
do {
1616
let invalidID: String = Array<String>.init(repeating: "a", count: 65).joined()
17-
let _ = try IMClient(ID: invalidID)
17+
let _ = try IMClient(ID: invalidID, options: [])
1818
XCTFail()
1919
} catch {
2020
XCTAssertTrue(error is LCError)
2121
}
2222

2323
do {
2424
let invalidTag: String = "default"
25-
let _ = try IMClient(ID: "aaaaaa", tag: invalidTag)
25+
let _ = try IMClient(ID: uuid, tag: invalidTag, options: [])
2626
XCTFail()
2727
} catch {
2828
XCTAssertTrue(error is LCError)
2929
}
3030

3131
do {
32-
let _ = try IMClient(ID: uuid)
33-
let _ = try IMClient(ID: uuid, tag: uuid)
32+
let _ = try IMClient(ID: uuid, options: [])
33+
let _ = try IMClient(ID: uuid, tag: uuid, options: [])
3434
} catch {
3535
XCTFail("\(error)")
3636
}
@@ -44,7 +44,7 @@ class IMClientTestCase: RTMBaseTestCase {
4444
XCTAssertTrue(user.signUp().isSuccess)
4545

4646
do {
47-
let client = try IMClient(user: user)
47+
let client = try IMClient(user: user, options: [])
4848
XCTAssertNotNil(client.user)
4949
XCTAssertEqual(client.ID, user.objectId?.stringValue)
5050
} catch {
@@ -53,15 +53,15 @@ class IMClientTestCase: RTMBaseTestCase {
5353
}
5454

5555
func testDeinit() {
56-
var client: IMClient? = try! IMClient(ID: uuid, tag: uuid)
56+
var client: IMClient? = try! IMClient(ID: uuid, tag: uuid, options: [])
5757
weak var wClient: IMClient? = client
5858
client = nil
5959
delay()
6060
XCTAssertNil(wClient)
6161
}
6262

6363
func testOpenAndClose() {
64-
let client: IMClient = try! IMClient(ID: uuid)
64+
let client: IMClient = try! IMClient(ID: uuid, options: [])
6565

6666
expecting { (exp) in
6767
client.open(completion: { (result) in
@@ -111,7 +111,7 @@ class IMClientTestCase: RTMBaseTestCase {
111111

112112
if let objectID = user.objectId?.value, let sessionToken = user.sessionToken?.value {
113113

114-
var clientWithUser: IMClient! = try! IMClient(user: user)
114+
var clientWithUser: IMClient! = try! IMClient(user: user, options: [])
115115
expecting { (exp) in
116116
clientWithUser.open(completion: { (result) in
117117
XCTAssertTrue(result.isSuccess)
@@ -125,7 +125,7 @@ class IMClientTestCase: RTMBaseTestCase {
125125

126126
let signatureDelegator = SignatureDelegator()
127127
signatureDelegator.sessionToken = sessionToken
128-
let clientWithID = try! IMClient(ID: objectID, signatureDelegate: signatureDelegator)
128+
let clientWithID = try! IMClient(ID: objectID, options: [], signatureDelegate: signatureDelegator)
129129
expecting { (exp) in
130130
clientWithID.open(completion: { (result) in
131131
XCTAssertTrue(result.isSuccess)
@@ -137,7 +137,7 @@ class IMClientTestCase: RTMBaseTestCase {
137137
}
138138

139139
func testDelegateEvent() {
140-
let client: IMClient = try! IMClient(ID: uuid)
140+
let client: IMClient = try! IMClient(ID: uuid, options: [])
141141
let delegator: Delegator = Delegator()
142142
client.delegate = delegator
143143

@@ -200,6 +200,7 @@ class IMClientTestCase: RTMBaseTestCase {
200200
let client1: IMClient = try! IMClient(
201201
ID: clientID,
202202
tag: tag,
203+
options: [],
203204
delegate: delegator1)
204205

205206
expecting { (exp) in
@@ -223,6 +224,7 @@ class IMClientTestCase: RTMBaseTestCase {
223224
let client2: IMClient = try! IMClient(
224225
ID: clientID,
225226
tag: tag,
227+
options: [],
226228
delegate: delegator2)
227229

228230
expecting(
@@ -276,7 +278,7 @@ class IMClientTestCase: RTMBaseTestCase {
276278
}
277279

278280
func testSessionTokenExpired() {
279-
let client: IMClient = try! IMClient(ID: uuid)
281+
let client: IMClient = try! IMClient(ID: uuid, options: [])
280282
let delegator: Delegator = Delegator()
281283
client.delegate = delegator
282284

@@ -326,7 +328,7 @@ class IMClientTestCase: RTMBaseTestCase {
326328
func testReportDeviceToken() {
327329
let application = LCApplication.default
328330
let currentDeviceToken = application.currentInstallation.deviceToken?.value
329-
let client: IMClient = try! IMClient(application: application, ID: uuid)
331+
let client: IMClient = try! IMClient(application: application, ID: uuid, options: [])
330332
delay()
331333
XCTAssertEqual(currentDeviceToken, client.currentDeviceToken)
332334

@@ -349,8 +351,8 @@ class IMClientTestCase: RTMBaseTestCase {
349351
}
350352

351353
func testSessionQuery() {
352-
let client1: IMClient = try! IMClient(ID: uuid)
353-
let client2: IMClient = try! IMClient(ID: uuid)
354+
let client1: IMClient = try! IMClient(ID: uuid, options: [])
355+
let client2: IMClient = try! IMClient(ID: uuid, options: [])
354356

355357
let openExp1 = expectation(description: "open")
356358
client1.open { (result) in

0 commit comments

Comments
 (0)