@@ -232,11 +232,12 @@ extension OSUserExecutor {
232232
233233 // If this user already exists and we logged into an external_id, fetch the user data
234234 // TODO: Only do this if response code is 200 or 202
235- // Fetch the user only if its the current user
235+ // Fetch the user only if its the current user and non-anonymous
236236 if OneSignalUserManagerImpl . sharedInstance. isCurrentUser ( request. identityModel) ,
237237 let identity = request. parameters ? [ " identity " ] as? [ String : String ] ,
238- let externalId = identity [ OS_EXTERNAL_ID] {
239- fetchUser ( aliasLabel: OS_EXTERNAL_ID, aliasId: externalId, identityModel: request. identityModel)
238+ let onesignalId = identity [ OS_ONESIGNAL_ID] ,
239+ identity [ OS_EXTERNAL_ID] != nil {
240+ fetchUser ( aliasLabel: OS_ONESIGNAL_ID, aliasId: onesignalId, identityModel: request. identityModel)
240241 } else {
241242 executePendingRequests ( )
242243 }
@@ -337,12 +338,8 @@ extension OSUserExecutor {
337338 // the anonymous user has been identified, still need to Fetch User as we cleared local data
338339 // Fetch the user only if its the current user
339340 if OneSignalUserManagerImpl . sharedInstance. isCurrentUser ( request. identityModelToUpdate) {
340- fetchUser ( aliasLabel: OS_EXTERNAL_ID , aliasId: request . aliasId , identityModel: request. identityModelToUpdate)
341+ fetchUser ( aliasLabel: OS_ONESIGNAL_ID , aliasId: onesignalId , identityModel: request. identityModelToUpdate)
341342 } else {
342- // Need to hydrate the identity model for any pending requests
343- if let osid = request. identityModelToIdentify. onesignalId {
344- request. identityModelToUpdate. hydrate ( [ OS_ONESIGNAL_ID: osid] )
345- }
346343 executePendingRequests ( )
347344 }
348345 } onFailure: { error in
0 commit comments