Skip to content

Commit 051f29b

Browse files
committed
Identify User success will hydrate OSID + EUID
* On Identify User successful, the SDK was only hydrating the OneSignal ID for past users (not the current user) and fetching the current user (which means OneSignal ID will be missing locally until that response) * Let's hydrate both OneSignal ID and External ID for all cases so that the local state can be up to date (instead of relying on the Fetch User to hydrate back the OneSignal and External IDs)
1 parent 20e9bb9 commit 051f29b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

iOS_SDK/OneSignalSDK/OneSignalUser/Source/Executors/OSUserExecutor.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,19 @@ extension OSUserExecutor {
335335
OneSignalCoreImpl.sharedClient().execute(request) { _ in
336336
removeFromQueue(request)
337337

338+
guard let onesignalId = request.identityModelToIdentify.onesignalId else {
339+
OneSignalLog.onesignalLog(.LL_ERROR, message: "executeIdentifyUserRequest succeeded but is now missing OneSignal ID!")
340+
executePendingRequests()
341+
return
342+
}
343+
344+
// Need to hydrate the identity model for current user or past user with pending requests
345+
let aliases = [
346+
OS_ONESIGNAL_ID: onesignalId,
347+
request.aliasLabel: request.aliasId
348+
]
349+
request.identityModelToUpdate.hydrate(aliases)
350+
338351
// the anonymous user has been identified, still need to Fetch User as we cleared local data
339352
// Fetch the user only if its the current user
340353
if OneSignalUserManagerImpl.sharedInstance.isCurrentUser(request.identityModelToUpdate) {

0 commit comments

Comments
 (0)