mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-22 14:18:15 +00:00
Fixed missed call(s) indicator not visible or not hidden in drawer menu
This commit is contained in:
parent
701117474e
commit
458f817142
5 changed files with 21 additions and 3 deletions
|
|
@ -78,6 +78,10 @@ abstract class AbstractMainFragment : GenericMainFragment() {
|
|||
viewModel.applyFilter(filter.trim())
|
||||
}
|
||||
|
||||
viewModel.missedCallsCount.observe(viewLifecycleOwner) {
|
||||
sharedViewModel.refreshDrawerMenuAccountsListEvent.value = Event(false)
|
||||
}
|
||||
|
||||
viewModel.navigateToContactsEvent.observe(viewLifecycleOwner) {
|
||||
it.consume {
|
||||
if (currentFragmentId != R.id.contactsListFragment) {
|
||||
|
|
|
|||
|
|
@ -129,8 +129,12 @@ class DrawerMenuFragment : GenericMainFragment() {
|
|||
}
|
||||
|
||||
sharedViewModel.refreshDrawerMenuAccountsListEvent.observe(viewLifecycleOwner) {
|
||||
it.consume {
|
||||
viewModel.updateAccountsList()
|
||||
it.consume { recreate ->
|
||||
if (recreate) {
|
||||
viewModel.updateAccountsList()
|
||||
} else {
|
||||
viewModel.refreshAccountsNotificationsCount()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -261,6 +261,7 @@ class HistoryListFragment : AbstractMainFragment() {
|
|||
|
||||
Log.i("$TAG Fragment is resumed, resetting missed calls count")
|
||||
sharedViewModel.resetMissedCallsCountEvent.value = Event(true)
|
||||
sharedViewModel.refreshDrawerMenuAccountsListEvent.value = Event(false)
|
||||
|
||||
// Scroll to top to display latest call logs
|
||||
binding.historyList.scrollToPosition(0)
|
||||
|
|
|
|||
|
|
@ -230,7 +230,7 @@ class AccountModel @WorkerThread constructor(
|
|||
}
|
||||
|
||||
@WorkerThread
|
||||
private fun computeNotificationsCount() {
|
||||
fun computeNotificationsCount() {
|
||||
notificationsCount.postValue(account.unreadChatMessageCount + account.missedCallsCount)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -148,6 +148,15 @@ class DrawerMenuViewModel @UiThread constructor() : GenericViewModel() {
|
|||
}
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun refreshAccountsNotificationsCount() {
|
||||
coreContext.postOnCoreThread {
|
||||
for (model in accounts.value.orEmpty()) {
|
||||
model.computeNotificationsCount()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
private fun computeAccountsList() {
|
||||
accounts.value.orEmpty().forEach(AccountModel::destroy)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue