chat-sdk / chat-sdk-android

Chat SDK Android - Open Source Mobile Messenger

Home Page:https://chatsdk.co

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ChatSDK.core().getUserForEntityID(user.getUid()) is removing Custom Meta Values from firebase

awaisabbasaa11 opened this issue · comments

  1. Is the bug present in the demo Chat SDK project?
    No idea

  2. What modifications have you made to the Chat SDK?
    a lot but not in the affected module or its related functions

  3. Android Version:
    android 7, 8, 9, 10

  4. Steps taken to reproduce the problem:
    a) User A login from a device A, and update his Meta Values and add some Custom Values in his Meta Values i.e user_type, destination
    b) Meta Values update successfully verified from firebase console
    c) Then User A, try to get his User object from the device B, which don't have any cache data, when the data object is being fetched all of my custom meta values gets removed from the real-time database only the default chatsdk meta values remain

I am using
ChatSDK.core().getUserForEntityID(user.getUid()).doOnSuccess(user1 -> {....}).doOnError().doFinally().subscribe();
5. Expected result:
Return all meta values and don't delete the meta values when I try to fetch a user that is not cached in the device

  1. Actual result:
    if the user object is cached in local db then it doesn't remove my meta values but if it's not cached then custom meta values are being removed

  2. Comments:

I can't reproduce this issue. I tried:

ChatSDK.hook().addHook(Hook.sync(data -> {
    User user = (User) ChatSDK.core().getUserForEntityID("kIEzhoNyNSSi9mVsneVXFa5BXKh1").subscribe(user1 -> {
        Logger.debug("Ok");
    }, throwable -> {
        Logger.debug("Fail");
    });
}), HookEvent.DidAuthenticate);

This function performed as expected. The user was retrieved and no data was deleted. It's probably related to your custom code.