Show participants action: use upstream impl to reduce conflicts

Change-Id: I3136fa37ddbf2575881b7f5c447c022d1130f411
This commit is contained in:
SpiritCroc 2021-12-24 11:17:00 +01:00
parent 98f05b25e2
commit 88c1833c45
4 changed files with 13 additions and 46 deletions

View file

@ -270,8 +270,6 @@
<activity android:name=".features.roomprofile.RoomProfileActivity" />
<activity android:name=".features.roomprofile.settings.joinrule.RoomJoinRuleActivity" />
<activity android:name=".features.roomprofile.members.RoomMemberListActivity" />
<activity android:name=".features.signout.hard.SignedOutActivity" />
<activity
android:name=".features.signout.soft.SoftLogoutActivity"

View file

@ -173,7 +173,6 @@ import im.vector.app.features.notifications.NotificationUtils
import im.vector.app.features.permalink.NavigationInterceptor
import im.vector.app.features.permalink.PermalinkHandler
import im.vector.app.features.reactions.EmojiReactionPickerActivity
import im.vector.app.features.roomprofile.members.RoomMemberListActivity
import im.vector.app.features.roomprofile.RoomProfileActivity
import im.vector.app.features.session.coroutineScope
import im.vector.app.features.settings.VectorPreferences
@ -1047,7 +1046,7 @@ class RoomDetailFragment @Inject constructor(
true
}
R.id.show_participants -> {
startActivity(RoomMemberListActivity.newIntent(requireContext(), roomDetailArgs.roomId))
navigator.openRoomProfile(requireContext(), roomDetailArgs.roomId, RoomProfileActivity.EXTRA_DIRECT_ACCESS_ROOM_MEMBERS)
true
}
R.id.show_room_info -> {

View file

@ -46,7 +46,7 @@ import kotlinx.coroutines.flow.onEach
import javax.inject.Inject
@AndroidEntryPoint
open class RoomProfileActivity :
class RoomProfileActivity :
VectorBaseActivity<ActivitySimpleBinding>(),
ToolbarConfigurable {
@ -68,7 +68,7 @@ open class RoomProfileActivity :
}
private lateinit var sharedActionViewModel: RoomProfileSharedActionViewModel
protected lateinit var roomProfileArgs: RoomProfileArgs
private lateinit var roomProfileArgs: RoomProfileArgs
private val requireActiveMembershipViewModel: RequireActiveMembershipViewModel by viewModel()
@ -83,7 +83,16 @@ open class RoomProfileActivity :
sharedActionViewModel = viewModelProvider.get(RoomProfileSharedActionViewModel::class.java)
roomProfileArgs = intent?.extras?.getParcelable(Mavericks.KEY_ARG) ?: return
if (isFirstCreation()) {
addInitialFragment()
when (intent?.extras?.getInt(EXTRA_DIRECT_ACCESS, EXTRA_DIRECT_ACCESS_ROOM_ROOT)) {
EXTRA_DIRECT_ACCESS_ROOM_SETTINGS -> {
addFragment(views.simpleFragmentContainer, RoomProfileFragment::class.java, roomProfileArgs)
addFragmentToBackstack(views.simpleFragmentContainer, RoomSettingsFragment::class.java, roomProfileArgs)
}
EXTRA_DIRECT_ACCESS_ROOM_MEMBERS -> {
addFragment(views.simpleFragmentContainer, RoomMemberListFragment::class.java, roomProfileArgs)
}
else -> addFragment(views.simpleFragmentContainer, RoomProfileFragment::class.java, roomProfileArgs)
}
}
sharedActionViewModel
.stream()
@ -107,19 +116,6 @@ open class RoomProfileActivity :
}
}
open fun addInitialFragment() {
when (intent?.extras?.getInt(EXTRA_DIRECT_ACCESS, EXTRA_DIRECT_ACCESS_ROOM_ROOT)) {
EXTRA_DIRECT_ACCESS_ROOM_SETTINGS -> {
addFragment(views.simpleFragmentContainer, RoomProfileFragment::class.java, roomProfileArgs)
addFragmentToBackstack(views.simpleFragmentContainer, RoomSettingsFragment::class.java, roomProfileArgs)
}
EXTRA_DIRECT_ACCESS_ROOM_MEMBERS -> {
addFragment(views.simpleFragmentContainer, RoomMemberListFragment::class.java, roomProfileArgs)
}
else -> addFragment(views.simpleFragmentContainer, RoomProfileFragment::class.java, roomProfileArgs)
}
}
override fun onResume() {
super.onResume()
if (roomDetailPendingActionStore.data != null) {

View file

@ -1,26 +0,0 @@
package im.vector.app.features.roomprofile.members
import android.content.Context
import android.content.Intent
import com.airbnb.mvrx.Mavericks
import im.vector.app.core.extensions.addFragment
import im.vector.app.features.roomprofile.RoomProfileActivity
import im.vector.app.features.roomprofile.RoomProfileArgs
class RoomMemberListActivity :
RoomProfileActivity() {
companion object {
fun newIntent(context: Context, roomId: String): Intent {
val roomProfileArgs = RoomProfileArgs(roomId)
return Intent(context, RoomMemberListActivity::class.java).apply {
putExtra(Mavericks.KEY_ARG, roomProfileArgs)
}
}
}
override fun addInitialFragment() {
addFragment(views.simpleFragmentContainer, RoomMemberListFragment::class.java, roomProfileArgs)
}
}