Skip to content

Commit c9318e8

Browse files
committed
remove retain_previous_user flag
* No longer accepted by the server when transferring a push subscription. * Server checks anonymous user for whether it has any aliases set. If so, we’ll keep the user. If there aren’t aliases, we’ll remove it. Done behind the scenes in Perseus.
1 parent d956810 commit c9318e8

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

iOS_SDK/OneSignalSDK/OneSignalCore/Source/OneSignalCommonDefines.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,6 @@ typedef enum {GET, POST, HEAD, PUT, DELETE, OPTIONS, CONNECT, TRACE, PATCH} HTTP
278278
#define OS_ONESIGNAL_ID @"onesignal_id"
279279
#define OS_EXTERNAL_ID @"external_id"
280280

281-
#define OS_RETAIN_PREVIOUS_USER @"retain_previous_user"
282281
#define OS_ON_USER_WILL_CHANGE @"OS_ON_USER_WILL_CHANGE"
283282

284283
// Models and Model Stores

iOS_SDK/OneSignalSDK/OneSignalUser/Source/OSUserRequests.swift

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -382,13 +382,12 @@ class OSUserExecutor {
382382
}
383383
}
384384

385-
static func transferPushSubscriptionTo(aliasLabel: String, aliasId: String, retainPreviousUser: Bool?) {
385+
static func transferPushSubscriptionTo(aliasLabel: String, aliasId: String) {
386386
// TODO: Where to get pushSubscriptionModel for this request
387387
let request = OSRequestTransferSubscription(
388388
subscriptionModel: OneSignalUserManagerImpl.sharedInstance.user.pushSubscriptionModel,
389389
aliasLabel: aliasLabel,
390-
aliasId: aliasId,
391-
retainPreviousUser: retainPreviousUser // Need to update logic to determine this, for now, default to true
390+
aliasId: aliasId
392391
)
393392

394393
appendToQueue(request)
@@ -1036,9 +1035,6 @@ class OSRequestTransferSubscription: OneSignalRequest, OSUserRequest {
10361035
func prepareForExecution() -> Bool {
10371036
if let subscriptionId = subscriptionModel.subscriptionId, let appId = OneSignalConfigManager.getAppId() {
10381037
self.path = "apps/\(appId)/subscriptions/\(subscriptionId)/owner"
1039-
// Check alias pair
1040-
// parameters should be set in init(), so not optional
1041-
self.parameters?["identity"] = [aliasLabel: aliasId]
10421038
// TODO: self.addJWTHeader(identityModel: identityModel) ??
10431039
return true
10441040
} else {
@@ -1049,20 +1045,18 @@ class OSRequestTransferSubscription: OneSignalRequest, OSUserRequest {
10491045

10501046
/**
10511047
Must pass an Alias pair to identify the User.
1052-
If `retainPreviousUser` flag is not passed in, it defaults to `true`.
10531048
*/
10541049
init(
10551050
subscriptionModel: OSSubscriptionModel,
10561051
aliasLabel: String,
1057-
aliasId: String,
1058-
retainPreviousUser: Bool?
1052+
aliasId: String
10591053
) {
10601054
self.subscriptionModel = subscriptionModel
10611055
self.aliasLabel = aliasLabel
10621056
self.aliasId = aliasId
10631057
self.stringDescription = "OSRequestTransferSubscription"
10641058
super.init()
1065-
self.parameters = [OS_RETAIN_PREVIOUS_USER: retainPreviousUser ?? true]
1059+
self.parameters = ["identity": [aliasLabel: aliasId]]
10661060
self.method = PATCH
10671061
_ = prepareForExecution() // sets the path property
10681062
}

0 commit comments

Comments
 (0)