mirror of
https://github.com/element-hq/element-android
synced 2024-11-25 02:45:37 +03:00
Merge pull request #1067 from vector-im/feature/roomId
Display internal id of a room section in room profile
This commit is contained in:
commit
ec0cba2b23
2 changed files with 22 additions and 0 deletions
|
@ -25,10 +25,12 @@ import im.vector.riotx.core.epoxy.profiles.buildProfileSection
|
||||||
import im.vector.riotx.core.resources.ColorProvider
|
import im.vector.riotx.core.resources.ColorProvider
|
||||||
import im.vector.riotx.core.resources.StringProvider
|
import im.vector.riotx.core.resources.StringProvider
|
||||||
import im.vector.riotx.core.ui.list.genericFooterItem
|
import im.vector.riotx.core.ui.list.genericFooterItem
|
||||||
|
import im.vector.riotx.features.settings.VectorPreferences
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class RoomProfileController @Inject constructor(
|
class RoomProfileController @Inject constructor(
|
||||||
private val stringProvider: StringProvider,
|
private val stringProvider: StringProvider,
|
||||||
|
private val vectorPreferences: VectorPreferences,
|
||||||
colorProvider: ColorProvider
|
colorProvider: ColorProvider
|
||||||
) : TypedEpoxyController<RoomProfileViewState>() {
|
) : TypedEpoxyController<RoomProfileViewState>() {
|
||||||
|
|
||||||
|
@ -43,6 +45,7 @@ class RoomProfileController @Inject constructor(
|
||||||
fun onUploadsClicked()
|
fun onUploadsClicked()
|
||||||
fun onSettingsClicked()
|
fun onSettingsClicked()
|
||||||
fun onLeaveRoomClicked()
|
fun onLeaveRoomClicked()
|
||||||
|
fun onRoomIdClicked()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun buildModels(data: RoomProfileViewState?) {
|
override fun buildModels(data: RoomProfileViewState?) {
|
||||||
|
@ -105,5 +108,19 @@ class RoomProfileController @Inject constructor(
|
||||||
editable = false,
|
editable = false,
|
||||||
action = { callback?.onLeaveRoomClicked() }
|
action = { callback?.onLeaveRoomClicked() }
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Advanced
|
||||||
|
if (vectorPreferences.developerMode()) {
|
||||||
|
buildProfileSection(stringProvider.getString(R.string.room_settings_category_advanced_title))
|
||||||
|
buildProfileAction(
|
||||||
|
id = "roomId",
|
||||||
|
title = stringProvider.getString(R.string.room_settings_room_internal_id),
|
||||||
|
subtitle = roomSummary.roomId,
|
||||||
|
dividerColor = dividerColor,
|
||||||
|
divider = false,
|
||||||
|
editable = false,
|
||||||
|
action = { callback?.onRoomIdClicked() }
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@ import im.vector.riotx.core.extensions.configureWith
|
||||||
import im.vector.riotx.core.extensions.exhaustive
|
import im.vector.riotx.core.extensions.exhaustive
|
||||||
import im.vector.riotx.core.extensions.setTextOrHide
|
import im.vector.riotx.core.extensions.setTextOrHide
|
||||||
import im.vector.riotx.core.platform.VectorBaseFragment
|
import im.vector.riotx.core.platform.VectorBaseFragment
|
||||||
|
import im.vector.riotx.core.utils.copyToClipboard
|
||||||
import im.vector.riotx.core.utils.startSharePlainTextIntent
|
import im.vector.riotx.core.utils.startSharePlainTextIntent
|
||||||
import im.vector.riotx.features.crypto.util.toImageRes
|
import im.vector.riotx.features.crypto.util.toImageRes
|
||||||
import im.vector.riotx.features.home.AvatarRenderer
|
import im.vector.riotx.features.home.AvatarRenderer
|
||||||
|
@ -203,6 +204,10 @@ class RoomProfileFragment @Inject constructor(
|
||||||
.show()
|
.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onRoomIdClicked() {
|
||||||
|
copyToClipboard(requireContext(), roomProfileArgs.roomId)
|
||||||
|
}
|
||||||
|
|
||||||
private fun onShareRoomProfile(permalink: String) {
|
private fun onShareRoomProfile(permalink: String) {
|
||||||
startSharePlainTextIntent(fragment = this, chooserTitle = null, text = permalink)
|
startSharePlainTextIntent(fragment = this, chooserTitle = null, text = permalink)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue