Fixed no missed call notification if app was on call history fragment when it happened
This commit is contained in:
parent
2e36f1aa86
commit
1a998f4bde
2 changed files with 8 additions and 8 deletions
|
@ -237,14 +237,14 @@ class MasterCallLogsFragment : MasterFragment<HistoryMasterFragmentBinding, Call
|
||||||
binding.setMissedCallLogsToggleClickListener {
|
binding.setMissedCallLogsToggleClickListener {
|
||||||
listViewModel.missedCallLogsSelected.value = true
|
listViewModel.missedCallLogsSelected.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
coreContext.core.resetMissedCallsCount()
|
||||||
|
coreContext.notificationsManager.dismissMissedCallNotification()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
|
|
||||||
coreContext.core.resetMissedCallsCount()
|
|
||||||
coreContext.notificationsManager.dismissMissedCallNotification()
|
|
||||||
|
|
||||||
val tabsViewModel = requireActivity().run {
|
val tabsViewModel = requireActivity().run {
|
||||||
ViewModelProvider(this).get(TabsViewModel::class.java)
|
ViewModelProvider(this).get(TabsViewModel::class.java)
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,7 +123,7 @@ class NotificationsManager(private val context: Context) {
|
||||||
Call.State.End, Call.State.Error -> dismissCallNotification(call)
|
Call.State.End, Call.State.Error -> dismissCallNotification(call)
|
||||||
Call.State.Released -> {
|
Call.State.Released -> {
|
||||||
if (LinphoneUtils.isCallLogMissed(call.callLog)) {
|
if (LinphoneUtils.isCallLogMissed(call.callLog)) {
|
||||||
displayMissedCallNotification(call)
|
displayMissedCallNotification(call.remoteAddress)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else -> displayCallNotification(call)
|
else -> displayCallNotification(call)
|
||||||
|
@ -435,17 +435,17 @@ class NotificationsManager(private val context: Context) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun displayMissedCallNotification(call: Call) {
|
private fun displayMissedCallNotification(remoteAddress: Address) {
|
||||||
val missedCallCount: Int = call.core.missedCallsCount
|
val missedCallCount: Int = coreContext.core.missedCallsCount
|
||||||
val body: String
|
val body: String
|
||||||
if (missedCallCount > 1) {
|
if (missedCallCount > 1) {
|
||||||
body = context.getString(R.string.missed_calls_notification_body)
|
body = context.getString(R.string.missed_calls_notification_body)
|
||||||
.format(missedCallCount)
|
.format(missedCallCount)
|
||||||
Log.i("[Notifications Manager] Updating missed calls notification count to $missedCallCount")
|
Log.i("[Notifications Manager] Updating missed calls notification count to $missedCallCount")
|
||||||
} else {
|
} else {
|
||||||
val contact: Contact? = coreContext.contactsManager.findContactByAddress(call.remoteAddress)
|
val contact: Contact? = coreContext.contactsManager.findContactByAddress(remoteAddress)
|
||||||
body = context.getString(R.string.missed_call_notification_body)
|
body = context.getString(R.string.missed_call_notification_body)
|
||||||
.format(contact?.fullName ?: LinphoneUtils.getDisplayName(call.remoteAddress))
|
.format(contact?.fullName ?: LinphoneUtils.getDisplayName(remoteAddress))
|
||||||
Log.i("[Notifications Manager] Creating missed call notification")
|
Log.i("[Notifications Manager] Creating missed call notification")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue