Skip to content
This repository was archived by the owner on Jul 21, 2020. It is now read-only.

Commit 0cb8eca

Browse files
committed
Updated notification implementation
1 parent 253b738 commit 0cb8eca

File tree

5 files changed

+11
-8
lines changed

5 files changed

+11
-8
lines changed

BeamAPI.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
Pod::Spec.new do |s|
22
s.name = "BeamAPI"
3-
s.version = "1.5.2"
3+
s.version = "1.5.3"
44
s.summary = "An interface to communicate with Beam's backend."
55
s.homepage = "https://github.com/WatchBeam/beam-client-swift"
66
s.license = "MIT"
77
s.author = { "Jack Cook" => "[email protected]" }
88

99
s.requires_arc = true
1010
s.ios.deployment_target = "8.2"
11-
s.source = { :git => "https://github.com/WatchBeam/beam-client-swift.git", :tag => "1.5.2" }
11+
s.source = { :git => "https://github.com/WatchBeam/beam-client-swift.git", :tag => "1.5.3" }
1212
s.source_files = "Pod/Classes/**/*"
1313

1414
s.dependency "Starscream", "~> 2.0"

Example/BeamAPI.xcodeproj/project.pbxproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@
194194
TargetAttributes = {
195195
607FACE41AFB9204008FA782 = {
196196
CreatedOnToolsVersion = 6.3.1;
197+
DevelopmentTeam = XTRYGN7EA5;
197198
LastSwiftMigration = 0800;
198199
};
199200
};
@@ -387,6 +388,7 @@
387388
isa = XCBuildConfiguration;
388389
baseConfigurationReference = E85179B6D5D6B487B946E6B4 /* Pods-BeamAPI_Tests.debug.xcconfig */;
389390
buildSettings = {
391+
DEVELOPMENT_TEAM = XTRYGN7EA5;
390392
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
391393
GCC_PREPROCESSOR_DEFINITIONS = (
392394
"DEBUG=1",
@@ -404,6 +406,7 @@
404406
isa = XCBuildConfiguration;
405407
baseConfigurationReference = A0C967F7D78FD680D95ABA9C /* Pods-BeamAPI_Tests.release.xcconfig */;
406408
buildSettings = {
409+
DEVELOPMENT_TEAM = XTRYGN7EA5;
407410
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
408411
INFOPLIST_FILE = Tests/Info.plist;
409412
LD_RUNPATH_SEARCH_PATHS = "$(inherited)";

Pod/Classes/Clients/BeamSession.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public class BeamSession {
6464
body["code"] = String(code)
6565
}
6666

67-
BeamRequest.request("/users/login", requestType: "POST", body: body as AnyObject, options: .storeCookies) { (json, error) in
67+
BeamRequest.request("/users/login", requestType: "POST", body: body as AnyObject, options: [.noAuth, .storeCookies]) { (json, error) in
6868
guard let json = json , error == nil else {
6969
completion?(nil, error)
7070
return

Pod/Classes/Models/BeamNotificationPreferences.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public struct BeamNotificationPreferences {
127127
"liveOnByDefault": liveOnByDefault,
128128
"notifyFollower": notifyFollower,
129129
"notifySubscriber": notifySubscriber,
130-
"transports": (transports ?? [[String: Any]]()) as Any
130+
"transports": transports ?? [[String: Any]]()
131131
]
132132
}
133133
}

Pod/Classes/Routes/NotificationsRoutes.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ public class NotificationsRoutes {
2020
:param: completion An optional completion block with response data.
2121
*/
2222
public func updateNotificationPreferences(preferences: BeamNotificationPreferences, completion: ((_ preferences: BeamNotificationPreferences?, _ error: BeamRequestError?) -> Void)?) {
23-
guard let _ = BeamSession.sharedSession else {
23+
guard let id = BeamSession.sharedSession?.user.id else {
2424
completion?(nil, .notAuthenticated)
2525
return
2626
}
2727

28-
BeamRequest.request("/notifications/preferences", requestType: "PATCH", body: preferences.dictionary as AnyObject) { (json, error) in
28+
BeamRequest.request("/users/\(id)/notifications/preferences", requestType: "PATCH", body: preferences.dictionary as AnyObject) { (json, error) in
2929
guard let json = json else {
3030
completion?(nil, error)
3131
return
@@ -44,12 +44,12 @@ public class NotificationsRoutes {
4444
:param: completion An optional completion block with response data.
4545
*/
4646
public func getNotificationPreferences(completion: ((_ preferences: BeamNotificationPreferences?, _ error: BeamRequestError?) -> Void)?) {
47-
guard let _ = BeamSession.sharedSession else {
47+
guard let id = BeamSession.sharedSession?.user.id else {
4848
completion?(nil, .notAuthenticated)
4949
return
5050
}
5151

52-
BeamRequest.request("/notifications/preferences") { (json, error) in
52+
BeamRequest.request("/users/\(id)/notifications/preferences") { (json, error) in
5353
guard let json = json else {
5454
completion?(nil, error)
5555
return

0 commit comments

Comments
 (0)