Skip to content

Commit 881157a

Browse files
committed
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
1 parent 49c9696 commit 881157a

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

vector/src/main/java/im/vector/app/features/permalink/PermalinkHandler.kt

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,14 @@ class PermalinkHandler @Inject constructor(private val activeSessionHolder: Acti
7979
return when (permalinkData) {
8080
is PermalinkData.RoomLink -> {
8181
val roomId = permalinkData.getRoomId()
82-
if (navigationInterceptor?.navToRoom(roomId, permalinkData.eventId, rawLink) != true) {
83-
openRoom(
84-
context = context,
85-
roomId = roomId,
86-
permalinkData = permalinkData,
87-
rawLink = rawLink,
88-
buildTask = buildTask
89-
)
90-
}
82+
openRoom(
83+
navigationInterceptor,
84+
context = context,
85+
roomId = roomId,
86+
permalinkData = permalinkData,
87+
rawLink = rawLink,
88+
buildTask = buildTask
89+
)
9190
true
9291
}
9392
is PermalinkData.GroupLink -> {
@@ -146,6 +145,7 @@ class PermalinkHandler @Inject constructor(private val activeSessionHolder: Acti
146145
* Open room either joined, or not
147146
*/
148147
private fun openRoom(
148+
navigationInterceptor: NavigationInterceptor?,
149149
context: Context,
150150
roomId: String?,
151151
permalinkData: PermalinkData.RoomLink,
@@ -167,7 +167,7 @@ class PermalinkHandler @Inject constructor(private val activeSessionHolder: Acti
167167
membership?.isActive().orFalse() -> {
168168
if (!isSpace && membership == Membership.JOIN) {
169169
// If it's a room you're in, let's just open it, you can tap back if needed
170-
navigator.openRoom(context, roomId, eventId, buildTask)
170+
navigationInterceptor.openJoinedRoomScreen(buildTask, roomId, eventId, rawLink, context)
171171
} else {
172172
// maybe open space preview navigator.openSpacePreview(context, roomId)? if already joined?
173173
navigator.openMatrixToBottomSheet(context, rawLink.toString())
@@ -180,6 +180,12 @@ class PermalinkHandler @Inject constructor(private val activeSessionHolder: Acti
180180
}
181181
}
182182

183+
private fun NavigationInterceptor?.openJoinedRoomScreen(buildTask: Boolean, roomId: String, eventId: String?, rawLink: Uri, context: Context) {
184+
if (this?.navToRoom(roomId, eventId, rawLink) != true) {
185+
navigator.openRoom(context, roomId, eventId, buildTask)
186+
}
187+
}
188+
183189
companion object {
184190
const val MATRIX_TO_CUSTOM_SCHEME_URL_BASE = "element://"
185191
const val ROOM_LINK_PREFIX = "${MATRIX_TO_CUSTOM_SCHEME_URL_BASE}room/"

0 commit comments

Comments
 (0)