Skip to content

Commit

Permalink
fix: Crash after fresh install (#2965)
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed May 3, 2024
1 parent b1b3f71 commit 4237a5f
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
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 @@ -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)
}
Expand Down

0 comments on commit 4237a5f

Please sign in to comment.