Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update protocol version to 1.1 #777

Merged
merged 5 commits into from
Aug 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion Source/ARTDefault.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ @implementation ARTDefault

NSString *const ARTDefault_restHost = @"rest.ably.io";
NSString *const ARTDefault_realtimeHost = @"realtime.ably.io";
NSString *const ARTDefault_version = @"1.0";
NSString *const ARTDefault_version = @"1.1";
NSString *const ARTDefault_libraryVersion = @"1.0.14";
NSString *const ARTDefault_ablyBundleId = @"io.ably.Ably";
NSString *const ARTDefault_bundleVersionKey = @"CFBundleShortVersionString";
Expand Down
19 changes: 11 additions & 8 deletions Spec/PushAdmin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,14 @@ class PushAdmin : QuickSpec {
}
}

pending("should work as expected") {
let realtime = ARTRealtime(options: AblyTests.commonAppSetup())
it("should publish successfully") {
let options = AblyTests.commonAppSetup()
let realtime = ARTRealtime(options: options)
let channel = realtime.channels.get("pushenabled:push_admin_publish-ok")
let publishObject = ["transportType": "ablyChannel",
"channel": channel.name,
"ablyKey": options.key!,
"ablyUrl": "https://\(options.restHost)"]

waitUntil(timeout: testTimeout) { done in
channel.attach() { error in
Expand All @@ -242,16 +247,14 @@ class PushAdmin : QuickSpec {

waitUntil(timeout: testTimeout) { done in
let partialDone = AblyTests.splitDone(2, done: done)
// FIXME: waiting a response
// https://github.com/ably/ably-ios/issues/669
channel.subscribe("__ably_push__") { message in
guard let data = message.data as? NSDictionary else {
fail("Data is not a JSON Object"); partialDone(); return
guard let data = message.data as? String else {
fail("Failure in reading returned data"); partialDone(); return
}
expect(data).to(equal(["data": ["foo": "bar"]] as NSDictionary))
expect(data).to(contain("foo"))
partialDone()
}
realtime.push.admin.publish(["ablyChannel": channel.name], data: ["data": ["foo": "bar"]]) { error in
realtime.push.admin.publish(publishObject, data: ["data": ["foo": "bar"]]) { error in
expect(error).to(beNil())
partialDone()
}
Expand Down
2 changes: 1 addition & 1 deletion Spec/RealtimeClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class RealtimeClient: QuickSpec {
channel.publish(nil, data: "message") { error in
expect(error).to(beNil())
let transport = client.transport as! TestProxyTransport
expect(transport.lastUrl!.query).to(haveParam("v", withValue: "1.0"))
expect(transport.lastUrl!.query).to(haveParam("v", withValue: ARTDefault.version()))
done()
}
}
Expand Down
2 changes: 1 addition & 1 deletion Spec/RestClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class RestClient: QuickSpec {
channel.publish(nil, data: "message") { error in
expect(error).to(beNil())
let version = testHTTPExecutor.requests.first!.allHTTPHeaderFields?["X-Ably-Version"]
expect(version).to(equal("1.0"))
expect(version).to(equal(ARTDefault.version()))
done()
}
}
Expand Down
10 changes: 6 additions & 4 deletions Spec/RestClientChannel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -327,15 +327,17 @@ class RestClientChannel: QuickSpec {
}

// RSL1h, RSL6a2
pending("should provide an optional argument that allows the extras value to be specified") {
// TODO: pushenabled doesn't appear to be working.
it("should provide an optional argument that allows the extras value to be specified") {
let client = ARTRest(options: AblyTests.commonAppSetup())
let originalARTChannels_getChannelNamePrefix = ARTChannels_getChannelNamePrefix
defer { ARTChannels_getChannelNamePrefix = originalARTChannels_getChannelNamePrefix }
ARTChannels_getChannelNamePrefix = nil // Force that channel name is not changed.
let channel = client.channels.get("pushenabled:test")
let extras = ["push": ["key": "value"]] as ARTJsonCompatible
let extras = ["notification": ["title": "Hello from Ably!"]] as ARTJsonCompatible

expect((client.encoders["application/json"] as! ARTJsonLikeEncoder).message(from: [
"data": "foo",
"extras": ["push": ["key": "value"]]
"extras": ["notification": ["title": "Hello from Ably!"]]
]).extras == extras).to(beTrue())

waitUntil(timeout: testTimeout) { done in
Expand Down