Display name is wrong for individual chats

We are using UIKIT IOS, here we found issue that:
there are 2 users- userA, userB
so when send a message from userA to userB, then in userA account it display name is userB which is correct, but when we see userB account then it display name is also userB which is incorrect it should be userA.

@Raj From the issue you’ve encountered, we request additional information as follows:

  • UIKit Version:
  • Installation Method: SPM, Cocoapods, Carthage, Manual (Optional)

AmityUIKit:

  • Are you using the Open Source UIKit?
  • Have you made modifications to any Open Source UIKit components & integrated them into the app?

Issue Details:

  • Code Implementation / Code Sample:
  • Screenshots / Videos:

Additional Details: Xcode Version (Optional), Realm Version

@SocialPlus_Support we have clone Open source UIKit from git submodule add GitHub - AmityCo/ASC-UIKit-iOS-OpenSource, and we do not change anything regarding this in code

Issue Video Link:
Here first we login with Raj account and send a message to Vikash, in raj account it displays Vikash.
but when we login to Vikash account then it also display name Vikash instead of Raj.

CODE SNAP:

1 Like

@Raj I’ll pass this information to the relevant team and keep you updated.

@Raj Could you kindly confirm if there was an attempt to log in with a new user on our UIKit? We’re inquiring because the chat list appears unchanged, and our logs are showing that the AmitySDK is unable to subscribe to the user deletion event, citing an inability to locate the current user. This issue usually arises when the system fails to identify the current user or their user model. Your assistance in double-checking this would be greatly appreciated.

@SocialPlus_Support
Yes, user is changing in login with differenct numbers, we have another video, in this video you can see first we login into Vibhor;s account then after logout, we logged into Raj,s account. please check link below:

Code Snap:

@Raj Thank you for your information. I’ll pass this to our team and stay in touch with you for updates.

@Raj To better assist you, we need a bit more detail form our developer on how you’re using some features :

  1. Can we see how you utilize the log out function in your implementation?
  2. Do you use the registerDevice and unregisterDevice functions from our UIKit?
  3. Upon logging in as userB, are you able to send messages within the chat?

@SocialPlus_Support

  1. we call AmityUIKitManager.unregisterDevice() on logout.
  2. Yes we use registerDevice and unregisterDevice , we call below code
AmityUIKitManager.registerDevice(withUserId: "\(user?.amityUserId ?? "")", displayName: "\(user?.firstname ?? "") \(user?.lastname ?? "")", authToken: nil, sessionHandler: CrustAmitySessionHandler(), completion: {_,_ in
                
            })
  1. Yes we are able to send message upon logging userB within the chat.

@Raj Our developer kindly requests if you could consider initializing the AmityClient just once and then reuse it for subsequent actions, rather than initializing it anew with every login attempt.

@SocialPlus_Support As you suggest now we are initializing the AmityClient just once but we are facing same issue , see below is our code

Please ensure that your register and unregister functions match our code sample available here: ASC-UIKit-iOS-OpenSource.

Regarding the error, it suggests that it cannot find the current user or the current user model.