Skip to content

Commit

Permalink
Merge pull request #4345 from vector-im/feature/adm/unable-to-join-by…
Browse files Browse the repository at this point in the history
…-name

Unable to join room by name
  • Loading branch information
bmarty authored Oct 26, 2021
2 parents 31abf44 + 272baa5 commit a19999a
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 11 deletions.
1 change: 1 addition & 0 deletions changelog.d/4255.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixes being unable to join rooms by name
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import android.os.Build
import android.widget.Toast
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
import dagger.hilt.android.AndroidEntryPoint
import im.vector.app.R
import im.vector.app.core.platform.VectorBaseActivity
import im.vector.app.core.utils.checkPermissions
Expand All @@ -31,6 +32,7 @@ import im.vector.app.core.utils.registerForPermissionsResult
import im.vector.app.databinding.ActivityDebugPermissionBinding
import timber.log.Timber

@AndroidEntryPoint
class DebugPermissionActivity : VectorBaseActivity<ActivityDebugPermissionBinding>() {

override fun getBinding() = ActivityDebugPermissionBinding.inflate(layoutInflater)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 -> {
Expand Down Expand Up @@ -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,
Expand All @@ -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())
Expand All @@ -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/"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@ import android.content.Context
import android.content.Intent
import com.airbnb.mvrx.Mavericks
import com.google.android.material.appbar.MaterialToolbar
import dagger.hilt.android.AndroidEntryPoint
import im.vector.app.R
import im.vector.app.core.extensions.addFragment
import im.vector.app.core.platform.ToolbarConfigurable
import im.vector.app.core.platform.VectorBaseActivity
import im.vector.app.databinding.ActivitySimpleBinding

@AndroidEntryPoint
class PinActivity : VectorBaseActivity<ActivitySimpleBinding>(), ToolbarConfigurable, UnlockedActivity {

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@ import im.vector.app.core.extensions.addFragmentToBackstack
import im.vector.app.core.extensions.popBackstack
import im.vector.app.core.platform.VectorBaseActivity
import im.vector.app.databinding.ActivitySimpleBinding
import im.vector.app.features.matrixto.MatrixToBottomSheet
import im.vector.app.features.navigation.Navigator
import im.vector.app.features.roomdirectory.createroom.CreateRoomArgs
import im.vector.app.features.roomdirectory.createroom.CreateRoomFragment
import im.vector.app.features.roomdirectory.picker.RoomDirectoryPickerFragment
import javax.inject.Inject

@AndroidEntryPoint
class RoomDirectoryActivity : VectorBaseActivity<ActivitySimpleBinding>() {
class RoomDirectoryActivity : VectorBaseActivity<ActivitySimpleBinding>(), MatrixToBottomSheet.InteractionListener {

@Inject lateinit var roomDirectoryViewModelFactory: RoomDirectoryViewModel.Factory
private val roomDirectoryViewModel: RoomDirectoryViewModel by viewModel()
Expand Down Expand Up @@ -81,6 +83,14 @@ class RoomDirectoryActivity : VectorBaseActivity<ActivitySimpleBinding>() {
}
}

override fun mxToBottomSheetNavigateToRoom(roomId: String) {
navigator.openRoom(this, roomId)
}

override fun mxToBottomSheetSwitchToSpace(spaceId: String) {
navigator.switchToSpace(this, spaceId, Navigator.PostSwitchSpaceAction.None)
}

companion object {
private const val INITIAL_FILTER = "INITIAL_FILTER"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import android.content.Context
import android.content.Intent
import android.os.Parcelable
import com.google.android.material.appbar.MaterialToolbar
import dagger.hilt.android.AndroidEntryPoint
import im.vector.app.R
import im.vector.app.core.extensions.addFragment
import im.vector.app.core.platform.ToolbarConfigurable
Expand Down Expand Up @@ -51,6 +52,7 @@ data class RoomPreviewData(
get() = MatrixItem.RoomItem(roomId, roomName ?: roomAlias, avatarUrl)
}

@AndroidEntryPoint
class RoomPreviewActivity : VectorBaseActivity<ActivitySimpleBinding>(), ToolbarConfigurable {

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package im.vector.app.features.signout.hard
import android.content.Context
import android.content.Intent
import android.os.Bundle
import dagger.hilt.android.AndroidEntryPoint
import im.vector.app.core.platform.VectorBaseActivity
import im.vector.app.databinding.ActivitySignedOutBinding
import im.vector.app.features.MainActivity
Expand All @@ -29,6 +30,7 @@ import timber.log.Timber
/**
* In this screen, the user is viewing a message informing that he has been logged out
*/
@AndroidEntryPoint
class SignedOutActivity : VectorBaseActivity<ActivitySignedOutBinding>() {

override fun getBinding() = ActivitySignedOutBinding.inflate(layoutInflater)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ import android.content.Context
import android.content.Intent
import android.os.Bundle
import com.airbnb.mvrx.Mavericks
import dagger.hilt.android.AndroidEntryPoint
import im.vector.app.R
import im.vector.app.core.extensions.commitTransaction
import im.vector.app.core.platform.VectorBaseActivity
import im.vector.app.databinding.ActivitySimpleBinding
import im.vector.app.features.spaces.preview.SpacePreviewArgs
import im.vector.app.features.spaces.preview.SpacePreviewFragment

@AndroidEntryPoint
class SpacePreviewActivity : VectorBaseActivity<ActivitySimpleBinding>() {

lateinit var sharedActionViewModel: SpacePreviewSharedActionViewModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import android.os.Bundle
import androidx.core.view.isGone
import androidx.core.view.isVisible
import com.airbnb.mvrx.Mavericks
import dagger.hilt.android.AndroidEntryPoint
import im.vector.app.R
import im.vector.app.core.extensions.commitTransaction
import im.vector.app.core.extensions.hideKeyboard
Expand All @@ -30,6 +31,7 @@ import im.vector.app.core.platform.VectorBaseActivity
import im.vector.app.databinding.ActivitySimpleLoadingBinding
import im.vector.app.features.spaces.share.ShareSpaceBottomSheet

@AndroidEntryPoint
class SpacePeopleActivity : VectorBaseActivity<ActivitySimpleLoadingBinding>() {

override fun getBinding() = ActivitySimpleLoadingBinding.inflate(layoutInflater)
Expand Down

0 comments on commit a19999a

Please sign in to comment.