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
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
|
@Parcelize
|
||||||
data class HomeActivityArgs(
|
data class HomeActivityArgs(
|
||||||
val clearNotification: Boolean,
|
val clearNotification: Boolean,
|
||||||
val accountCreation: Boolean
|
val accountCreation: Boolean,
|
||||||
|
val inviteNotificationRoomId: String? = null
|
||||||
) : Parcelable
|
) : Parcelable
|
||||||
|
|
||||||
class HomeActivity :
|
class HomeActivity :
|
||||||
@ -229,6 +230,11 @@ class HomeActivity :
|
|||||||
if (args?.clearNotification == true) {
|
if (args?.clearNotification == true) {
|
||||||
notificationDrawerManager.clearAllEvents()
|
notificationDrawerManager.clearAllEvents()
|
||||||
}
|
}
|
||||||
|
if (args?.inviteNotificationRoomId != null) {
|
||||||
|
activeSessionHolder.getSafeActiveSession()?.permalinkService()?.createPermalink(args.inviteNotificationRoomId)?.let {
|
||||||
|
navigator.openMatrixToBottomSheet(this, it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
homeActivityViewModel.observeViewEvents {
|
homeActivityViewModel.observeViewEvents {
|
||||||
when (it) {
|
when (it) {
|
||||||
@ -422,9 +428,17 @@ class HomeActivity :
|
|||||||
|
|
||||||
override fun onNewIntent(intent: Intent?) {
|
override fun onNewIntent(intent: Intent?) {
|
||||||
super.onNewIntent(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()
|
notificationDrawerManager.clearAllEvents()
|
||||||
}
|
}
|
||||||
|
if (parcelableExtra?.inviteNotificationRoomId != null) {
|
||||||
|
activeSessionHolder.getSafeActiveSession()
|
||||||
|
?.permalinkService()
|
||||||
|
?.createPermalink(parcelableExtra.inviteNotificationRoomId)?.let {
|
||||||
|
navigator.openMatrixToBottomSheet(this, it)
|
||||||
|
}
|
||||||
|
}
|
||||||
handleIntent(intent)
|
handleIntent(intent)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -548,10 +562,15 @@ class HomeActivity :
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
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(
|
val args = HomeActivityArgs(
|
||||||
clearNotification = clearNotification,
|
clearNotification = clearNotification,
|
||||||
accountCreation = accountCreation
|
accountCreation = accountCreation,
|
||||||
|
inviteNotificationRoomId = inviteNotificationRoomId
|
||||||
)
|
)
|
||||||
|
|
||||||
return Intent(context, HomeActivity::class.java)
|
return Intent(context, HomeActivity::class.java)
|
||||||
|
@ -679,7 +679,7 @@ class NotificationUtils @Inject constructor(private val context: Context,
|
|||||||
stringProvider.getString(R.string.join),
|
stringProvider.getString(R.string.join),
|
||||||
joinIntentPendingIntent)
|
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
|
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
|
// 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)
|
contentIntent.data = Uri.parse("foobar://" + inviteNotifiableEvent.eventId)
|
||||||
|
Loading…
Reference in New Issue
Block a user