Skip to content

Commit

Permalink
[nits]
Browse files Browse the repository at this point in the history
* Use the existing `isCurrentUser` method
* remove extraneous logging that make the logs messy
  • Loading branch information
nan-li committed Oct 30, 2023
1 parent 7162c88 commit 2a3e32f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public class OSEventProducer<THandler>: NSObject {
var subscriber: THandler?

public func subscribe(_ handler: THandler) {
OneSignalLog.onesignalLog(.LL_VERBOSE, message: "OSEventProducer.subscribe() called with handler: \(handler)")
// TODO: UM do we want to synchronize on subscribers
subscriber = handler // TODO: UM style, implicit or explicit self?
}
Expand Down
10 changes: 4 additions & 6 deletions iOS_SDK/OneSignalSDK/OneSignalUser/Source/OSUserRequests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,6 @@ class OSUserExecutor {
identityModel.hydrate(identityObject)
}

// On success, check if the current user is the same as the one in the request
// If user has changed, don't hydrate, except for push subscription
let modelInStore = OneSignalUserManagerImpl.sharedInstance.identityModelStore.getModel(key: OS_IDENTITY_MODEL_KEY)

// TODO: Determine how to hydrate the push subscription, which is still faulty.
// Hydrate by token if sub_id exists?
// Problem: a user can have multiple iOS push subscription, and perhaps missing token
Expand All @@ -214,8 +210,10 @@ class OSUserExecutor {
}
}
}

guard modelInStore?.modelId == identityModel.modelId else {

// Check if the current user is the same as the one in the request
// If user has changed, don't hydrate, except for push subscription above
guard OneSignalUserManagerImpl.sharedInstance.isCurrentUser(identityModel) else {
return
}

Expand Down

0 comments on commit 2a3e32f

Please sign in to comment.