mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-03-17 19:58:57 +03:00
Minor changes after benoits review
This commit is contained in:
parent
5dda5a107a
commit
8955049110
6 changed files with 27 additions and 16 deletions
|
@ -143,7 +143,7 @@ internal class MxCallImpl(
|
|||
override fun reject() {
|
||||
if (opponentVersion < 1) {
|
||||
Timber.v("Opponent version is less than 1 ($opponentVersion): sending hangup instead of reject")
|
||||
hangUp()
|
||||
hangUp(EndCallReason.USER_HANGUP)
|
||||
return
|
||||
}
|
||||
Timber.v("## VOIP reject $callId")
|
||||
|
@ -162,7 +162,7 @@ internal class MxCallImpl(
|
|||
CallHangupContent(
|
||||
callId = callId,
|
||||
partyId = ourPartyId,
|
||||
reason = reason ?: EndCallReason.USER_HANGUP,
|
||||
reason = reason,
|
||||
version = MxCall.VOIP_PROTO_VERSION.toString()
|
||||
)
|
||||
.let { createEventAndLocalEcho(type = EventType.CALL_HANGUP, roomId = roomId, content = it.toContent()) }
|
||||
|
|
|
@ -167,7 +167,7 @@ class CallService : VectorService() {
|
|||
}
|
||||
).apply {
|
||||
viewBinder = IncomingCallAlert.ViewBinder(
|
||||
matrixItem = callInformation.matrixItem,
|
||||
matrixItem = callInformation.opponentMatrixItem,
|
||||
avatarRenderer = avatarRenderer,
|
||||
isVideoCall = isVideoCall,
|
||||
onAccept = { showCallScreen(call, VectorCallActivity.INCOMING_ACCEPT) },
|
||||
|
@ -179,7 +179,7 @@ class CallService : VectorService() {
|
|||
alertManager.postVectorAlert(incomingCallAlert)
|
||||
val notification = notificationUtils.buildIncomingCallNotification(
|
||||
call = call,
|
||||
title = callInformation.matrixItem?.getBestName() ?: callInformation.opponentUserId,
|
||||
title = callInformation.opponentMatrixItem?.getBestName() ?: callInformation.opponentUserId,
|
||||
fromBg = fromBg
|
||||
)
|
||||
if (knownCalls.isEmpty()) {
|
||||
|
@ -235,7 +235,7 @@ class CallService : VectorService() {
|
|||
Timber.v("displayOutgoingCallNotification : display the dedicated notification")
|
||||
val notification = notificationUtils.buildOutgoingRingingCallNotification(
|
||||
call = call,
|
||||
title = callInformation.matrixItem?.getBestName() ?: callInformation.opponentUserId
|
||||
title = callInformation.opponentMatrixItem?.getBestName() ?: callInformation.opponentUserId
|
||||
)
|
||||
if (knownCalls.isEmpty()) {
|
||||
startForeground(callId.hashCode(), notification)
|
||||
|
@ -259,7 +259,7 @@ class CallService : VectorService() {
|
|||
val callInformation = call.toCallInformation()
|
||||
val notification = notificationUtils.buildPendingCallNotification(
|
||||
call = call,
|
||||
title = callInformation.matrixItem?.getBestName() ?: callInformation.opponentUserId
|
||||
title = callInformation.opponentMatrixItem?.getBestName() ?: callInformation.opponentUserId
|
||||
)
|
||||
if (knownCalls.isEmpty()) {
|
||||
startForeground(callId.hashCode(), notification)
|
||||
|
@ -293,7 +293,7 @@ class CallService : VectorService() {
|
|||
callId = this.callId,
|
||||
nativeRoomId = this.nativeRoomId,
|
||||
opponentUserId = this.mxCall.opponentUserId,
|
||||
matrixItem = vectorComponent().activeSessionHolder().getSafeActiveSession()?.let {
|
||||
opponentMatrixItem = vectorComponent().activeSessionHolder().getSafeActiveSession()?.let {
|
||||
this.getOpponentAsMatrixItem(it)
|
||||
},
|
||||
isVideoCall = this.mxCall.isVideoCall,
|
||||
|
@ -305,7 +305,7 @@ class CallService : VectorService() {
|
|||
val callId: String,
|
||||
val nativeRoomId: String,
|
||||
val opponentUserId: String,
|
||||
val matrixItem: MatrixItem?,
|
||||
val opponentMatrixItem: MatrixItem?,
|
||||
val isVideoCall: Boolean,
|
||||
val isOutgoing: Boolean
|
||||
)
|
||||
|
|
|
@ -798,7 +798,7 @@ class WebRtcCall(
|
|||
}
|
||||
}
|
||||
|
||||
fun endCall(reason: EndCallReason? = null) {
|
||||
fun endCall(reason: EndCallReason = EndCallReason.USER_HANGUP) {
|
||||
sessionScope?.launch(dispatcher) {
|
||||
if (mxCall.state is CallState.Ended) {
|
||||
return@launch
|
||||
|
|
|
@ -21,7 +21,12 @@ import org.matrix.android.sdk.api.util.MatrixItem
|
|||
import org.matrix.android.sdk.api.util.toMatrixItem
|
||||
|
||||
fun WebRtcCall.getOpponentAsMatrixItem(session: Session): MatrixItem? {
|
||||
return session.getRoomSummary(nativeRoomId)?.otherMemberIds?.firstOrNull()?.let {
|
||||
session.getUser(it)?.toMatrixItem()
|
||||
return session.getRoomSummary(nativeRoomId)?.let { roomSummary ->
|
||||
// Fallback to RoomSummary if there is no other member.
|
||||
if (roomSummary.otherMemberIds.isEmpty()) {
|
||||
roomSummary.toMatrixItem()
|
||||
} else {
|
||||
roomSummary.otherMemberIds.first().let { session.getUser(it)?.toMatrixItem() }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -479,13 +479,13 @@ class NotificationUtils @Inject constructor(private val context: Context,
|
|||
*/
|
||||
fun buildCallMissedNotification(callInformation: CallService.CallInformation): Notification {
|
||||
val builder = NotificationCompat.Builder(context, SILENT_NOTIFICATION_CHANNEL_ID)
|
||||
.setContentTitle(callInformation.matrixItem?.getBestName() ?: callInformation.opponentUserId)
|
||||
.setContentTitle(callInformation.opponentMatrixItem?.getBestName() ?: callInformation.opponentUserId)
|
||||
.apply {
|
||||
if (callInformation.isVideoCall) {
|
||||
setContentText(stringProvider.getString(R.string.missed_video_call))
|
||||
setContentText(stringProvider.getQuantityString(R.plurals.missed_video_call, 1, 1))
|
||||
setSmallIcon(R.drawable.ic_missed_video_call)
|
||||
} else {
|
||||
setContentText(stringProvider.getString(R.string.missed_audio_call))
|
||||
setContentText(stringProvider.getQuantityString(R.plurals.missed_audio_call, 1, 1))
|
||||
setSmallIcon(R.drawable.ic_missed_voice_call)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -727,8 +727,14 @@
|
|||
<string name="call_connected">Call connected</string>
|
||||
<string name="call_connecting">Call connecting…</string>
|
||||
<string name="call_ended">Call ended</string>
|
||||
<string name="missed_audio_call">Missed audio call</string>
|
||||
<string name="missed_video_call">Missed video call</string>
|
||||
<plurals name="missed_audio_call">
|
||||
<item quantity="one">Missed audio call</item>
|
||||
<item quantity="other">%d missed audio calls</item>
|
||||
</plurals>
|
||||
<plurals name="missed_video_call">
|
||||
<item quantity="one">Missed video call</item>
|
||||
<item quantity="other">%d missed video calls</item>
|
||||
</plurals>
|
||||
<string name="call_ring">Calling…</string>
|
||||
<string name="incoming_call">Incoming Call</string>
|
||||
<string name="incoming_video_call">Incoming Video Call</string>
|
||||
|
|
Loading…
Add table
Reference in a new issue