applying the room navigation interceptor to only the room activity navigation, not the bottomsheets

- the bottomsheets require the activity to stay around as they host the sheet instance, fixes missing join sheets
This commit is contained in:
Adam Brown 2021-10-26 17:15:19 +01:00
parent 49c969601d
commit 881157a725

View file

@ -79,15 +79,14 @@ class PermalinkHandler @Inject constructor(private val activeSessionHolder: Acti
return when (permalinkData) {
is PermalinkData.RoomLink -> {
val roomId = permalinkData.getRoomId()
if (navigationInterceptor?.navToRoom(roomId, permalinkData.eventId, rawLink) != true) {
openRoom(
context = context,
roomId = roomId,
permalinkData = permalinkData,
rawLink = rawLink,
buildTask = buildTask
)
}
openRoom(
navigationInterceptor,
context = context,
roomId = roomId,
permalinkData = permalinkData,
rawLink = rawLink,
buildTask = buildTask
)
true
}
is PermalinkData.GroupLink -> {
@ -146,6 +145,7 @@ class PermalinkHandler @Inject constructor(private val activeSessionHolder: Acti
* Open room either joined, or not
*/
private fun openRoom(
navigationInterceptor: NavigationInterceptor?,
context: Context,
roomId: String?,
permalinkData: PermalinkData.RoomLink,
@ -167,7 +167,7 @@ class PermalinkHandler @Inject constructor(private val activeSessionHolder: Acti
membership?.isActive().orFalse() -> {
if (!isSpace && membership == Membership.JOIN) {
// If it's a room you're in, let's just open it, you can tap back if needed
navigator.openRoom(context, roomId, eventId, buildTask)
navigationInterceptor.openJoinedRoomScreen(buildTask, roomId, eventId, rawLink, context)
} else {
// maybe open space preview navigator.openSpacePreview(context, roomId)? if already joined?
navigator.openMatrixToBottomSheet(context, rawLink.toString())
@ -180,6 +180,12 @@ class PermalinkHandler @Inject constructor(private val activeSessionHolder: Acti
}
}
private fun NavigationInterceptor?.openJoinedRoomScreen(buildTask: Boolean, roomId: String, eventId: String?, rawLink: Uri, context: Context) {
if (this?.navToRoom(roomId, eventId, rawLink) != true) {
navigator.openRoom(context, roomId, eventId, buildTask)
}
}
companion object {
const val MATRIX_TO_CUSTOM_SCHEME_URL_BASE = "element://"
const val ROOM_LINK_PREFIX = "${MATRIX_TO_CUSTOM_SCHEME_URL_BASE}room/"