Skip to content

Commit 2263203

Browse files
committed
update click event request path and params
1 parent f55fb93 commit 2263203

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

iOS_SDK/OneSignalSDK/OneSignalLiveActivities/Source/Requests/OSRequestLiveActivityClicked.swift

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,21 @@ class OSRequestLiveActivityClicked: OneSignalRequest, OSLiveActivityRequest {
4949
return false
5050
}
5151

52-
// TODO: ⚠️ What is the path, method, and parameters
53-
// TODO: ⚠️ Need to guard for encoding activity strings if in path
54-
// TODO: ⚠️ Timestamp since we are caching? Same for received event.
55-
self.path = "foo/bar/\(activityId)/click"
56-
self.parameters = [
57-
"app_id": appId,
58-
"player_id": subscriptionId,
52+
guard let activityType = self.key.addingPercentEncoding(withAllowedCharacters: NSCharacterSet.urlUserAllowed) else {
53+
OneSignalLog.onesignalLog(.LL_DEBUG, message: "Cannot translate activity type to url encoded string.")
54+
return false
55+
}
56+
57+
var params: [String: Any] = [
5958
"device_type": 0,
60-
"live_activity_id": activityId,
61-
"live_activity_type": activityType,
62-
"click_id": key
59+
"activity_id": activityId
6360
]
64-
self.method = POST
61+
if let notificationId = notificationId {
62+
params["notification_id"] = notificationId
63+
}
64+
self.parameters = params
65+
self.path = "apps/\(appId)/activities/clicks/track/\(activityType)/subscriptions/\(subscriptionId)"
66+
self.method = PUT
6567

6668
return true
6769
}

0 commit comments

Comments
 (0)