Skip to content

Commit

Permalink
Merge pull request #52 from IBM-Swift/push
Browse files Browse the repository at this point in the history
Update Push Notifications credentials
  • Loading branch information
Christian Compton authored Aug 31, 2018
2 parents 25fe51e + 5687501 commit 541344c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions Sources/CloudEnvironment/PushSDKCredentials.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ import Foundation
public class PushSDKCredentials {

public let appGuid : String
public let appSecret : String
public let apiKey : String
public let region : String

public init(appGuid: String, appSecret: String, region: String) {
public init(appGuid: String, apiKey: String, region: String) {
self.appGuid = appGuid
self.appSecret = appSecret
self.apiKey = apiKey
self.region = region
}

Expand All @@ -42,15 +42,15 @@ extension CloudEnv {

guard let credentials = getDictionary(name: name),
let appGuid = credentials["appGuid"] as? String ?? credentials["app_guid"] as? String,
let appSecret = credentials["appSecret"] as? String ?? credentials["app_secret"] as? String,
let apiKey = credentials["apikey"] as? String,
let pushURL = credentials["url"] as? String,
let url = URL(string: pushURL),
let region = getRegion(from: url)
else {
return nil
}

return PushSDKCredentials(appGuid: appGuid, appSecret: appSecret, region: region)
return PushSDKCredentials(appGuid: appGuid, apiKey: apiKey, region: region)
}

private func getRegion(from url: URL) -> String? {
Expand Down
2 changes: 1 addition & 1 deletion Tests/CloudEnvironmentTests/PushSDKTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class PushSDKTests: XCTestCase {
return
}
XCTAssertEqual(credentials.appGuid, "push-appGuid", "PushSDK service appGuid should match.")
XCTAssertEqual(credentials.appSecret, "push-secret", "PushSDK service appSecret should match.")
XCTAssertEqual(credentials.apiKey, "push-apikey", "PushSDK service apiKey should match.")
XCTAssertEqual(credentials.region, "ng.bluemix.net", "PushSDK service region should match.")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"appGuid": "push-appGuid",
"url": "http://imfpush.ng.bluemix.net/imfpush/v1",
"admin_url": "//mobile.ng.bluemix.net/imfpushdashboard",
"appSecret": "push-secret",
"apikey": "push-apikey",
"clientSecret": "push-clientSecret"
},
"label": "imfpush",
Expand Down

0 comments on commit 541344c

Please sign in to comment.