diff --git a/app/src/main/kotlin/com/wire/android/notification/CallNotificationManager.kt b/app/src/main/kotlin/com/wire/android/notification/CallNotificationManager.kt index cf7e8e553a1..c52c291d8c1 100644 --- a/app/src/main/kotlin/com/wire/android/notification/CallNotificationManager.kt +++ b/app/src/main/kotlin/com/wire/android/notification/CallNotificationManager.kt @@ -218,11 +218,11 @@ class CallNotificationBuilder @Inject constructor( .setAutoCancel(false) .setOngoing(true) .setVibrate(VIBRATE_PATTERN) - .setFullScreenIntent(fullScreenIncomingCallPendingIntent(context, conversationIdString), true) + .setFullScreenIntent(fullScreenIncomingCallPendingIntent(context, conversationIdString, userIdString), true) .addAction(getDeclineCallAction(context, conversationIdString, userIdString)) - .addAction(getOpenIncomingCallAction(context, conversationIdString)) + .addAction(getOpenIncomingCallAction(context, conversationIdString, userIdString)) .setVisibility(NotificationCompat.VISIBILITY_PUBLIC) - .setContentIntent(fullScreenIncomingCallPendingIntent(context, conversationIdString)) + .setContentIntent(fullScreenIncomingCallPendingIntent(context, conversationIdString, userIdString)) .build() // Added FLAG_INSISTENT so the ringing sound repeats itself until an action is done. diff --git a/app/src/main/kotlin/com/wire/android/notification/NotificationActions.kt b/app/src/main/kotlin/com/wire/android/notification/NotificationActions.kt index 427acfcd664..c187e94eeac 100644 --- a/app/src/main/kotlin/com/wire/android/notification/NotificationActions.kt +++ b/app/src/main/kotlin/com/wire/android/notification/NotificationActions.kt @@ -49,9 +49,9 @@ fun getActionReply( } } -fun getOpenIncomingCallAction(context: Context, conversationId: String) = getAction( +fun getOpenIncomingCallAction(context: Context, conversationId: String, userId: String) = getAction( context.getString(R.string.notification_action_open_call), - fullScreenIncomingCallPendingIntent(context, conversationId) + fullScreenIncomingCallPendingIntent(context, conversationId, userId) ) fun getDeclineCallAction(context: Context, conversationId: String, userId: String) = getAction( diff --git a/app/src/main/kotlin/com/wire/android/notification/PendingIntents.kt b/app/src/main/kotlin/com/wire/android/notification/PendingIntents.kt index f8eca9ef80e..7daeb80247d 100644 --- a/app/src/main/kotlin/com/wire/android/notification/PendingIntents.kt +++ b/app/src/main/kotlin/com/wire/android/notification/PendingIntents.kt @@ -128,8 +128,8 @@ fun outgoingCallPendingIntent(context: Context, conversationId: String): Pending ) } -fun fullScreenIncomingCallPendingIntent(context: Context, conversationId: String): PendingIntent { - val intent = getIncomingCallIntent(context, conversationId) +fun fullScreenIncomingCallPendingIntent(context: Context, conversationId: String, userId: String): PendingIntent { + val intent = getIncomingCallIntent(context, conversationId, userId) return PendingIntent.getActivity( context, diff --git a/app/src/main/kotlin/com/wire/android/ui/WireActivity.kt b/app/src/main/kotlin/com/wire/android/ui/WireActivity.kt index 9990a1673fe..9878749fc2e 100644 --- a/app/src/main/kotlin/com/wire/android/ui/WireActivity.kt +++ b/app/src/main/kotlin/com/wire/android/ui/WireActivity.kt @@ -219,7 +219,7 @@ class WireActivity : AppCompatActivity() { } }, onReturnToIncomingCallClick = { - getIncomingCallIntent(this@WireActivity, it.conversationId.toString()).run { + getIncomingCallIntent(this@WireActivity, it.conversationId.toString(), null).run { startActivity(this) } }, diff --git a/app/src/main/kotlin/com/wire/android/ui/calling/CallActivity.kt b/app/src/main/kotlin/com/wire/android/ui/calling/CallActivity.kt index 0ea3549fde2..290df43855d 100644 --- a/app/src/main/kotlin/com/wire/android/ui/calling/CallActivity.kt +++ b/app/src/main/kotlin/com/wire/android/ui/calling/CallActivity.kt @@ -195,9 +195,10 @@ fun getOutgoingCallIntent( putExtra(CallActivity.EXTRA_SCREEN_TYPE, CallScreenType.Outgoing.name) } -fun getIncomingCallIntent(context: Context, conversationId: String) = +fun getIncomingCallIntent(context: Context, conversationId: String, userId: String?) = Intent(context.applicationContext, CallActivity::class.java).apply { addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) + putExtra(CallActivity.EXTRA_USER_ID, userId) putExtra(CallActivity.EXTRA_CONVERSATION_ID, conversationId) putExtra(CallActivity.EXTRA_SCREEN_TYPE, CallScreenType.Incoming.name) }