Skip to content

Commit

Permalink
Remove previous from user state changed
Browse files Browse the repository at this point in the history
* We are removing the previous user state from the public user state changed state. We will consider adding this in the future.
  • Loading branch information
nan-li committed Dec 6, 2023
1 parent d3bae81 commit 813933c
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 @@ -123,9 +123,8 @@ class OSIdentityModel: OSModel {
OneSignalUserDefaults.initShared().saveString(forKey: OS_SNAPSHOT_ONESIGNAL_ID, withValue: newOnesignalId)
OneSignalUserDefaults.initShared().saveString(forKey: OS_SNAPSHOT_EXTERNAL_ID, withValue: newExternalId)

let prevUserState = OSUserState(onesignalId: prevOnesignalId, externalId: prevExternalId)
let curUserState = OSUserState(onesignalId: newOnesignalId, externalId: newExternalId)
let changedState = OSUserChangedState(previous: prevUserState, current: curUserState)
let changedState = OSUserChangedState(current: curUserState)

OneSignalUserManagerImpl.sharedInstance.userStateChangesObserver.notifyChange(changedState)
}
Expand Down
8 changes: 3 additions & 5 deletions iOS_SDK/OneSignalSDK/OneSignalUser/Source/OSUserState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,18 @@ public class OSUserState: NSObject {

@objc
public class OSUserChangedState: NSObject {
@objc public let previous: OSUserState
@objc public let current: OSUserState

@objc public override var description: String {
return "<OSUserState:\nprevious: \(self.previous),\ncurrent: \(self.current)\n>"
return "<OSUserState:\ncurrent: \(self.current)\n>"
}

init(previous: OSUserState, current: OSUserState) {
self.previous = previous
init(current: OSUserState) {
self.current = current
}

@objc public func jsonRepresentation() -> NSDictionary {
return ["previous": previous.jsonRepresentation(), "current": current.jsonRepresentation()]
return ["current": current.jsonRepresentation()]
}
}

Expand Down

0 comments on commit 813933c

Please sign in to comment.