LoggedInUser exists as a global static variable
Closed this issue · 3 comments
Describe the problem
struct LoggedInUser {
static let uid = CometChat.getLoggedInUser()?.uid ?? ""
static let name = CometChat.getLoggedInUser()?.name ?? ""
}
LoggedInUser is behaving like a global static variable. After logged out from comet chat, the struct persists and the value of uid and name still refers to the last loggedInUser.
This LoggedInUser is being referred in various UI Screens and components.
What was the expected behavior?
It is supposed to be properly referring to the loggedIn user and when its logged out, it should be cleared.
Reproduction
- Calling CometChat.Logout
- LoggedInUser still refers to the previous user
- Calling CometChat.login
- LoggedInUser still refers to the previous user
- Killing the app resets the reference
Environment
Please provide the following:
- 2.1.0
- CometChatPro
Hello @JohnKuan,
Thanks for reporting. We will fix this in the next release. You can override and set the new user's uid after login method.
Hello @JohnKuan,
I hope your issue is resolved with the solution mentioned above. Closing this issue, if you're still facing the same then let us know.
Thanks, it was resolved.