Skip to content

Commit 0fe3a1a

Browse files
authored
Merge pull request #1210 from OneSignal/user_model/fix_identify_user_and_push_observer
[user model] fix bug in identify user: need to fetch
2 parents d11adc2 + 9b6a9af commit 0fe3a1a

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

iOS_SDK/OneSignalSDK/OneSignalUser/Source/OSSubscriptionModel.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,13 +293,13 @@ extension OSSubscriptionModel {
293293
// Calculates if the device is opted in to push notification.
294294
// Must have permission and not be opted out.
295295
func calculateIsOptedIn(accepted: Bool, isDisabled: Bool) -> Bool {
296-
return _accepted && !_isDisabled
296+
return accepted && !isDisabled
297297
}
298298

299299
// Calculates if push notifications are enabled on the device.
300300
// Does not consider the existence of the subscription_id, as we send this in the request to create a push subscription.
301301
func calculateIsEnabled(address: String?, accepted: Bool, isDisabled: Bool) -> Bool {
302-
return (self.address != nil) && _accepted && !_isDisabled
302+
return address != nil && accepted && !isDisabled
303303
}
304304

305305
func updateNotificationTypes() {

iOS_SDK/OneSignalSDK/OneSignalUser/Source/OSUserRequests.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,9 @@ class OSUserExecutor {
216216

217217
static func executeIdentifyUserRequest(_ request: OSRequestIdentifyUser) {
218218
OneSignalClient.shared().execute(request) { _ in
219-
// the anonymous user has been identified, no further action needed, no need to fetch user
220-
executePendingRequests()
219+
// the anonymous user has been identified, still need to Fetch User as we cleared local data
220+
fetchUser(aliasLabel: OS_EXTERNAL_ID, aliasId: request.aliasId, identityModel: request.identityModelToUpdate)
221+
executePendingRequests() // TODO: Here or before fetch?
221222
} onFailure: { error in
222223
// Returns 409 if any provided (label, id) pair exists on another User, so the SDK will switch to this user.
223224
if error?._code == 409 {

0 commit comments

Comments
 (0)