Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[user model] fix bug in identify user: need to fetch #1210

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -293,13 +293,13 @@ extension OSSubscriptionModel {
// Calculates if the device is opted in to push notification.
// Must have permission and not be opted out.
func calculateIsOptedIn(accepted: Bool, isDisabled: Bool) -> Bool {
return _accepted && !_isDisabled
return accepted && !isDisabled
}

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

func updateNotificationTypes() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,9 @@ class OSUserExecutor {

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