Hi, guys!
I suggest you a change which will likely improve your ChannelListFragment behaviour.
I don’t understand why ChannelListViewModel is fragment scoped?
It can be activity scoped as you do inside ChannelFragment
I suggest following:
viewModel = new ViewModelProvider(getActivity(), new ViewModelFactory()).get(ChannelListViewModel.class);
Instead of this inside ChannelListFragment, method initChannelList()
If you want to retrieve all channels total unread count, you can refer to our sample implementation.
If you want to retrieve unread count of the specific channel, you can retrieve channel instance and observe event by our Chat SDK.
I am not sure what you want to do.
Plus, Why getActivity() can resolve observing unread count? If view model is all the time load, unread count is also all the time load.
@Vladislav_Karpman We changed our logic for a single activity. ViewModels that fragments use are owned by fragment ViewModelStore. Please update v2.2.3! Thank you!