Missed call: make some changes on notification
This commit is contained in:
parent
f7e2e741c0
commit
c59967fb6c
|
@ -200,6 +200,10 @@ class CallService : VectorService() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
knownCalls.remove(terminatedCall)
|
knownCalls.remove(terminatedCall)
|
||||||
|
if (knownCalls.isEmpty()) {
|
||||||
|
mediaSession?.isActive = false
|
||||||
|
myStopSelf()
|
||||||
|
}
|
||||||
val wasOngoing = ongoingCallIds.remove(callId)
|
val wasOngoing = ongoingCallIds.remove(callId)
|
||||||
if (wasOngoing || isRejected) {
|
if (wasOngoing || isRejected) {
|
||||||
val notification = notificationUtils.buildCallEndedNotification()
|
val notification = notificationUtils.buildCallEndedNotification()
|
||||||
|
@ -207,15 +211,10 @@ class CallService : VectorService() {
|
||||||
} else {
|
} else {
|
||||||
val notification = notificationUtils.buildCallMissedNotification(
|
val notification = notificationUtils.buildCallMissedNotification(
|
||||||
roomId = terminatedCall.nativeRoomId,
|
roomId = terminatedCall.nativeRoomId,
|
||||||
caller = terminatedCall.matrixItem?.getBestName() ?: terminatedCall.opponentUserId
|
title = terminatedCall.matrixItem?.getBestName() ?: terminatedCall.opponentUserId
|
||||||
)
|
)
|
||||||
notificationManager.cancel(callId.hashCode())
|
notificationManager.cancel(callId.hashCode())
|
||||||
notificationManager.notify(MISSED_CALL_TAG, callId.hashCode(), notification)
|
notificationManager.notify(MISSED_CALL_TAG, terminatedCall.nativeRoomId.hashCode(), notification)
|
||||||
}
|
|
||||||
|
|
||||||
if (knownCalls.isEmpty()) {
|
|
||||||
mediaSession?.isActive = false
|
|
||||||
myStopSelf()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -462,10 +462,10 @@ class NotificationUtils @Inject constructor(private val context: Context,
|
||||||
/**
|
/**
|
||||||
* Build notification for the CallService, when a call is missed
|
* Build notification for the CallService, when a call is missed
|
||||||
*/
|
*/
|
||||||
fun buildCallMissedNotification(roomId: String, caller: String): Notification {
|
fun buildCallMissedNotification(roomId: String, title: String): Notification {
|
||||||
val builder = NotificationCompat.Builder(context, SILENT_NOTIFICATION_CHANNEL_ID)
|
val builder = NotificationCompat.Builder(context, NOISY_NOTIFICATION_CHANNEL_ID)
|
||||||
.setContentTitle(caller)
|
.setContentTitle(title)
|
||||||
.setContentText(stringProvider.getString(R.string.call_missed, caller))
|
.setContentText(stringProvider.getString(R.string.call_missed))
|
||||||
.setSmallIcon(R.drawable.ic_material_call_end_grey)
|
.setSmallIcon(R.drawable.ic_material_call_end_grey)
|
||||||
.setAutoCancel(true)
|
.setAutoCancel(true)
|
||||||
.setCategory(NotificationCompat.CATEGORY_CALL)
|
.setCategory(NotificationCompat.CATEGORY_CALL)
|
||||||
|
|
|
@ -727,7 +727,7 @@
|
||||||
<string name="call_connected">Call connected</string>
|
<string name="call_connected">Call connected</string>
|
||||||
<string name="call_connecting">Call connecting…</string>
|
<string name="call_connecting">Call connecting…</string>
|
||||||
<string name="call_ended">Call ended</string>
|
<string name="call_ended">Call ended</string>
|
||||||
<string name="call_missed">You missed a call from %s</string>
|
<string name="call_missed">Missed call</string>
|
||||||
<string name="call_ring">Calling…</string>
|
<string name="call_ring">Calling…</string>
|
||||||
<string name="incoming_call">Incoming Call</string>
|
<string name="incoming_call">Incoming Call</string>
|
||||||
<string name="incoming_video_call">Incoming Video Call</string>
|
<string name="incoming_video_call">Incoming Video Call</string>
|
||||||
|
|
Loading…
Reference in New Issue