Skip to content

Commit b1ec345

Browse files
committed
address PR comments
* token can be null * remove commented out code and replace with better comment addressing the TODO * There will be a future PR to fix all the Swift `print` statements to `onesignalLog`
1 parent 12eee69 commit b1ec345

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

iOS_SDK/OneSignalSDK/OneSignalUser/Source/OSUserRequests.swift

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class OSUserExecutor {
117117
}
118118
executePendingRequests()
119119
} onFailure: { error in
120-
print("ECM test + \(error.debugDescription)")
120+
OneSignalLog.onesignalLog(.LL_DEBUG, message: "OSUserExecutor create user request failed with error: \(error.debugDescription)")
121121
// Depending on error, Client is responsible for retrying.
122122
// executePendingRequests() ?
123123
}
@@ -254,7 +254,7 @@ class OSRequestCreateUser: OneSignalRequest, OSUserRequest {
254254
var pushSubscriptionObject: [String: Any] = [:]
255255
pushSubscriptionObject["id"] = pushSubscriptionModel.subscriptionId
256256
pushSubscriptionObject["type"] = pushSubscriptionModel.type.rawValue
257-
pushSubscriptionObject["token"] = pushSubscriptionModel.address ?? "test" + String(arc4random())
257+
pushSubscriptionObject["token"] = pushSubscriptionModel.address
258258
pushSubscriptionObject["enabled"] = pushSubscriptionModel.enabled
259259
pushSubscriptionObject["notification_types"] = pushSubscriptionModel.notificationTypes
260260

@@ -268,7 +268,6 @@ class OSRequestCreateUser: OneSignalRequest, OSUserRequest {
268268

269269
self.parameters = params
270270
self.method = POST
271-
272271
}
273272

274273
func encode(with coder: NSCoder) {
@@ -868,9 +867,8 @@ class OSRequestUpdateSubscription: OneSignalRequest, OSUserRequest {
868867
subscriptionParams["notification_types"] = subscriptionModel.notificationTypes
869868
subscriptionParams["enabled"] = subscriptionModel.enabled
870869
// TODO: The above is not quite right. If we hydrate, we will over-write any pending updates
871-
// subscriptionParams["token"] = subscriptionObject["address"]
872-
// subscriptionParams["notification_types"] = subscriptionObject["notificationTypes"]
873-
// subscriptionParams["enabled"] = subscriptionObject["enabled"]
870+
// May use subscriptionObject, but enabled and notification_types should be sent together...
871+
874872
self.parameters = ["subscription": subscriptionParams]
875873
self.method = PATCH
876874
_ = prepareForExecution() // sets the path property

0 commit comments

Comments
 (0)