mirror of
https://github.com/element-hq/element-android
synced 2024-11-27 20:06:51 +03:00
Merge pull request #4044 from vector-im/feature/bca/fix_show_invitebottomsheet_on_notif_intent
Show mxto bottom sheet when tapping invite notification
This commit is contained in:
commit
6bf8202e65
3 changed files with 25 additions and 5 deletions
1
changelog.d/4043.bugfix
Normal file
1
changelog.d/4043.bugfix
Normal file
|
@ -0,0 +1 @@
|
|||
Spaces invitation system notifications don't take me to the join space toast
|
|
@ -81,7 +81,8 @@ import javax.inject.Inject
|
|||
@Parcelize
|
||||
data class HomeActivityArgs(
|
||||
val clearNotification: Boolean,
|
||||
val accountCreation: Boolean
|
||||
val accountCreation: Boolean,
|
||||
val inviteNotificationRoomId: String? = null
|
||||
) : Parcelable
|
||||
|
||||
class HomeActivity :
|
||||
|
@ -229,6 +230,11 @@ class HomeActivity :
|
|||
if (args?.clearNotification == true) {
|
||||
notificationDrawerManager.clearAllEvents()
|
||||
}
|
||||
if (args?.inviteNotificationRoomId != null) {
|
||||
activeSessionHolder.getSafeActiveSession()?.permalinkService()?.createPermalink(args.inviteNotificationRoomId)?.let {
|
||||
navigator.openMatrixToBottomSheet(this, it)
|
||||
}
|
||||
}
|
||||
|
||||
homeActivityViewModel.observeViewEvents {
|
||||
when (it) {
|
||||
|
@ -422,9 +428,17 @@ class HomeActivity :
|
|||
|
||||
override fun onNewIntent(intent: Intent?) {
|
||||
super.onNewIntent(intent)
|
||||
if (intent?.getParcelableExtra<HomeActivityArgs>(MvRx.KEY_ARG)?.clearNotification == true) {
|
||||
val parcelableExtra = intent?.getParcelableExtra<HomeActivityArgs>(MvRx.KEY_ARG)
|
||||
if (parcelableExtra?.clearNotification == true) {
|
||||
notificationDrawerManager.clearAllEvents()
|
||||
}
|
||||
if (parcelableExtra?.inviteNotificationRoomId != null) {
|
||||
activeSessionHolder.getSafeActiveSession()
|
||||
?.permalinkService()
|
||||
?.createPermalink(parcelableExtra.inviteNotificationRoomId)?.let {
|
||||
navigator.openMatrixToBottomSheet(this, it)
|
||||
}
|
||||
}
|
||||
handleIntent(intent)
|
||||
}
|
||||
|
||||
|
@ -548,10 +562,15 @@ class HomeActivity :
|
|||
}
|
||||
|
||||
companion object {
|
||||
fun newIntent(context: Context, clearNotification: Boolean = false, accountCreation: Boolean = false): Intent {
|
||||
fun newIntent(context: Context,
|
||||
clearNotification: Boolean = false,
|
||||
accountCreation: Boolean = false,
|
||||
inviteNotificationRoomId: String? = null
|
||||
): Intent {
|
||||
val args = HomeActivityArgs(
|
||||
clearNotification = clearNotification,
|
||||
accountCreation = accountCreation
|
||||
accountCreation = accountCreation,
|
||||
inviteNotificationRoomId = inviteNotificationRoomId
|
||||
)
|
||||
|
||||
return Intent(context, HomeActivity::class.java)
|
||||
|
|
|
@ -679,7 +679,7 @@ class NotificationUtils @Inject constructor(private val context: Context,
|
|||
stringProvider.getString(R.string.join),
|
||||
joinIntentPendingIntent)
|
||||
|
||||
val contentIntent = HomeActivity.newIntent(context)
|
||||
val contentIntent = HomeActivity.newIntent(context, inviteNotificationRoomId = inviteNotifiableEvent.roomId)
|
||||
contentIntent.flags = Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP
|
||||
// pending intent get reused by system, this will mess up the extra params, so put unique info to avoid that
|
||||
contentIntent.data = Uri.parse("foobar://" + inviteNotifiableEvent.eventId)
|
||||
|
|
Loading…
Reference in a new issue