Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: incoming call screen is not shown on second account #2956

Merged
merged 4 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/kotlin/com/wire/android/ui/WireActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,9 @@ 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 {
putExtra(CallActivity.EXTRA_USER_ID, userId)
putExtra(CallActivity.EXTRA_CONVERSATION_ID, conversationId)
putExtra(CallActivity.EXTRA_SCREEN_TYPE, CallScreenType.Incoming.name)
}
Expand Down
Loading