Skip to content

Commit

Permalink
修复首次登录时,联系人页面可能不更新问题
Browse files Browse the repository at this point in the history
  • Loading branch information
imndx committed Oct 22, 2024
1 parent faec1ee commit f3aeaa3
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import cn.wildfire.chat.kit.organization.OrganizationMemberListActivity;
import cn.wildfire.chat.kit.organization.model.Organization;
import cn.wildfire.chat.kit.user.UserInfoActivity;
import cn.wildfire.chat.kit.user.UserViewModel;
import cn.wildfire.chat.kit.widget.QuickIndexBar;
import cn.wildfirechat.model.ChannelInfo;
import cn.wildfirechat.model.UserOnlineState;
Expand All @@ -58,6 +59,7 @@ public class ContactListFragment extends BaseUserListFragment implements QuickIn
private OrganizationServiceViewModel organizationServiceViewModel;

private ContactViewModel contactViewModel;
private UserViewModel userViewModel;


@Override
Expand All @@ -71,6 +73,7 @@ public void onCreate(@Nullable Bundle savedInstanceState) {
}
organizationServiceViewModel = new ViewModelProvider(this).get(OrganizationServiceViewModel.class);
contactViewModel = new ViewModelProvider(this).get(ContactViewModel.class);
userViewModel = new ViewModelProvider(this).get(UserViewModel.class);
}

@Override
Expand Down Expand Up @@ -103,6 +106,10 @@ protected void afterViews(View view) {
userListAdapter.setFavUsers(uiUserInfos);
});

userViewModel.userInfoLiveData().observe(this, userInfos -> {
contactViewModel.reloadContact();
contactViewModel.reloadFavContact();
});
}

private void patchUserOnlineState(List<UIUserInfo> userInfos) {
Expand Down

0 comments on commit f3aeaa3

Please sign in to comment.