Skip to content

Commit

Permalink
Merge pull request #136 from groovelab/fix/apns-topic
Browse files Browse the repository at this point in the history
 if need be, set apns-topic value to request header

Former-commit-id: 92ca42a
  • Loading branch information
kjessup committed Mar 21, 2016
2 parents fcf97e0 + 42a6683 commit 325a30d
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions PerfectLib/NotificationPusher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,10 @@ public class NotificationPusher {

/// Toggle development or production on a global basis.
public static var development = false


/// apns-topic
public var apnsTopic: String?

var responses = [NotificationResponse]()

static var idCounter = 0
Expand Down Expand Up @@ -243,7 +246,11 @@ public class NotificationPusher {
public init() {

}


public init(apnsTopic: String) {
self.apnsTopic = apnsTopic
}

func resetResponses() {
self.responses.removeAll()
}
Expand Down Expand Up @@ -311,7 +318,9 @@ public class NotificationPusher {
request.headers["content-type"] = "application/json; charset=utf-8"
request.headers["apns-expiration"] = "\(expiration)"
request.headers["apns-priority"] = "\(priority)"
request.headers["apns-topic"] = "ca.treefrog.Smirkee"
if let apnsTopic = apnsTopic {
request.headers["apns-topic"] = apnsTopic
}
request.setRequestURI("/3/device/\(deviceToken)")
net.sendRequest(request) {
response, msg in
Expand Down

0 comments on commit 325a30d

Please sign in to comment.