Merge pull request #4345 from vector-im/feature/adm/unable-to-join-by-name

Unable to join room by name
This commit is contained in:
Benoit Marty 2021-10-26 19:35:44 +02:00 committed by GitHub
commit a19999a717
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 40 additions and 11 deletions

1
changelog.d/4255.bugfix Normal file
View File

@ -0,0 +1 @@
Fixes being unable to join rooms by name

View File

@ -22,6 +22,7 @@ import android.os.Build
import android.widget.Toast import android.widget.Toast
import androidx.core.app.ActivityCompat import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import dagger.hilt.android.AndroidEntryPoint
import im.vector.app.R import im.vector.app.R
import im.vector.app.core.platform.VectorBaseActivity import im.vector.app.core.platform.VectorBaseActivity
import im.vector.app.core.utils.checkPermissions import im.vector.app.core.utils.checkPermissions
@ -31,6 +32,7 @@ import im.vector.app.core.utils.registerForPermissionsResult
import im.vector.app.databinding.ActivityDebugPermissionBinding import im.vector.app.databinding.ActivityDebugPermissionBinding
import timber.log.Timber import timber.log.Timber
@AndroidEntryPoint
class DebugPermissionActivity : VectorBaseActivity<ActivityDebugPermissionBinding>() { class DebugPermissionActivity : VectorBaseActivity<ActivityDebugPermissionBinding>() {
override fun getBinding() = ActivityDebugPermissionBinding.inflate(layoutInflater) override fun getBinding() = ActivityDebugPermissionBinding.inflate(layoutInflater)

View File

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

View File

@ -20,12 +20,14 @@ import android.content.Context
import android.content.Intent import android.content.Intent
import com.airbnb.mvrx.Mavericks import com.airbnb.mvrx.Mavericks
import com.google.android.material.appbar.MaterialToolbar import com.google.android.material.appbar.MaterialToolbar
import dagger.hilt.android.AndroidEntryPoint
import im.vector.app.R import im.vector.app.R
import im.vector.app.core.extensions.addFragment import im.vector.app.core.extensions.addFragment
import im.vector.app.core.platform.ToolbarConfigurable import im.vector.app.core.platform.ToolbarConfigurable
import im.vector.app.core.platform.VectorBaseActivity import im.vector.app.core.platform.VectorBaseActivity
import im.vector.app.databinding.ActivitySimpleBinding import im.vector.app.databinding.ActivitySimpleBinding
@AndroidEntryPoint
class PinActivity : VectorBaseActivity<ActivitySimpleBinding>(), ToolbarConfigurable, UnlockedActivity { class PinActivity : VectorBaseActivity<ActivitySimpleBinding>(), ToolbarConfigurable, UnlockedActivity {
companion object { companion object {

View File

@ -28,13 +28,15 @@ import im.vector.app.core.extensions.addFragmentToBackstack
import im.vector.app.core.extensions.popBackstack import im.vector.app.core.extensions.popBackstack
import im.vector.app.core.platform.VectorBaseActivity import im.vector.app.core.platform.VectorBaseActivity
import im.vector.app.databinding.ActivitySimpleBinding 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.CreateRoomArgs
import im.vector.app.features.roomdirectory.createroom.CreateRoomFragment import im.vector.app.features.roomdirectory.createroom.CreateRoomFragment
import im.vector.app.features.roomdirectory.picker.RoomDirectoryPickerFragment import im.vector.app.features.roomdirectory.picker.RoomDirectoryPickerFragment
import javax.inject.Inject import javax.inject.Inject
@AndroidEntryPoint @AndroidEntryPoint
class RoomDirectoryActivity : VectorBaseActivity<ActivitySimpleBinding>() { class RoomDirectoryActivity : VectorBaseActivity<ActivitySimpleBinding>(), MatrixToBottomSheet.InteractionListener {
@Inject lateinit var roomDirectoryViewModelFactory: RoomDirectoryViewModel.Factory @Inject lateinit var roomDirectoryViewModelFactory: RoomDirectoryViewModel.Factory
private val roomDirectoryViewModel: RoomDirectoryViewModel by viewModel() private val roomDirectoryViewModel: RoomDirectoryViewModel by viewModel()
@ -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 { companion object {
private const val INITIAL_FILTER = "INITIAL_FILTER" private const val INITIAL_FILTER = "INITIAL_FILTER"

View File

@ -20,6 +20,7 @@ import android.content.Context
import android.content.Intent import android.content.Intent
import android.os.Parcelable import android.os.Parcelable
import com.google.android.material.appbar.MaterialToolbar import com.google.android.material.appbar.MaterialToolbar
import dagger.hilt.android.AndroidEntryPoint
import im.vector.app.R import im.vector.app.R
import im.vector.app.core.extensions.addFragment import im.vector.app.core.extensions.addFragment
import im.vector.app.core.platform.ToolbarConfigurable import im.vector.app.core.platform.ToolbarConfigurable
@ -51,6 +52,7 @@ data class RoomPreviewData(
get() = MatrixItem.RoomItem(roomId, roomName ?: roomAlias, avatarUrl) get() = MatrixItem.RoomItem(roomId, roomName ?: roomAlias, avatarUrl)
} }
@AndroidEntryPoint
class RoomPreviewActivity : VectorBaseActivity<ActivitySimpleBinding>(), ToolbarConfigurable { class RoomPreviewActivity : VectorBaseActivity<ActivitySimpleBinding>(), ToolbarConfigurable {
companion object { companion object {

View File

@ -19,6 +19,7 @@ package im.vector.app.features.signout.hard
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.os.Bundle import android.os.Bundle
import dagger.hilt.android.AndroidEntryPoint
import im.vector.app.core.platform.VectorBaseActivity import im.vector.app.core.platform.VectorBaseActivity
import im.vector.app.databinding.ActivitySignedOutBinding import im.vector.app.databinding.ActivitySignedOutBinding
import im.vector.app.features.MainActivity import im.vector.app.features.MainActivity
@ -29,6 +30,7 @@ import timber.log.Timber
/** /**
* In this screen, the user is viewing a message informing that he has been logged out * In this screen, the user is viewing a message informing that he has been logged out
*/ */
@AndroidEntryPoint
class SignedOutActivity : VectorBaseActivity<ActivitySignedOutBinding>() { class SignedOutActivity : VectorBaseActivity<ActivitySignedOutBinding>() {
override fun getBinding() = ActivitySignedOutBinding.inflate(layoutInflater) override fun getBinding() = ActivitySignedOutBinding.inflate(layoutInflater)

View File

@ -20,6 +20,7 @@ import android.content.Context
import android.content.Intent import android.content.Intent
import android.os.Bundle import android.os.Bundle
import com.airbnb.mvrx.Mavericks import com.airbnb.mvrx.Mavericks
import dagger.hilt.android.AndroidEntryPoint
import im.vector.app.R import im.vector.app.R
import im.vector.app.core.extensions.commitTransaction import im.vector.app.core.extensions.commitTransaction
import im.vector.app.core.platform.VectorBaseActivity import im.vector.app.core.platform.VectorBaseActivity
@ -27,6 +28,7 @@ import im.vector.app.databinding.ActivitySimpleBinding
import im.vector.app.features.spaces.preview.SpacePreviewArgs import im.vector.app.features.spaces.preview.SpacePreviewArgs
import im.vector.app.features.spaces.preview.SpacePreviewFragment import im.vector.app.features.spaces.preview.SpacePreviewFragment
@AndroidEntryPoint
class SpacePreviewActivity : VectorBaseActivity<ActivitySimpleBinding>() { class SpacePreviewActivity : VectorBaseActivity<ActivitySimpleBinding>() {
lateinit var sharedActionViewModel: SpacePreviewSharedActionViewModel lateinit var sharedActionViewModel: SpacePreviewSharedActionViewModel

View File

@ -22,6 +22,7 @@ import android.os.Bundle
import androidx.core.view.isGone import androidx.core.view.isGone
import androidx.core.view.isVisible import androidx.core.view.isVisible
import com.airbnb.mvrx.Mavericks import com.airbnb.mvrx.Mavericks
import dagger.hilt.android.AndroidEntryPoint
import im.vector.app.R import im.vector.app.R
import im.vector.app.core.extensions.commitTransaction import im.vector.app.core.extensions.commitTransaction
import im.vector.app.core.extensions.hideKeyboard import im.vector.app.core.extensions.hideKeyboard
@ -30,6 +31,7 @@ import im.vector.app.core.platform.VectorBaseActivity
import im.vector.app.databinding.ActivitySimpleLoadingBinding import im.vector.app.databinding.ActivitySimpleLoadingBinding
import im.vector.app.features.spaces.share.ShareSpaceBottomSheet import im.vector.app.features.spaces.share.ShareSpaceBottomSheet
@AndroidEntryPoint
class SpacePeopleActivity : VectorBaseActivity<ActivitySimpleLoadingBinding>() { class SpacePeopleActivity : VectorBaseActivity<ActivitySimpleLoadingBinding>() {
override fun getBinding() = ActivitySimpleLoadingBinding.inflate(layoutInflater) override fun getBinding() = ActivitySimpleLoadingBinding.inflate(layoutInflater)