Add menu entry for dev tools (to complete existing /devtools command)

This commit is contained in:
Benoit Marty 2021-02-19 21:26:01 +01:00 committed by Benoit Marty
parent 8580f46ec1
commit e511e7e02e
2 changed files with 16 additions and 2 deletions

View file

@ -57,6 +57,7 @@ class RoomProfileController @Inject constructor(
fun onRoomAliasesClicked() fun onRoomAliasesClicked()
fun onRoomPermissionsClicked() fun onRoomPermissionsClicked()
fun onRoomIdClicked() fun onRoomIdClicked()
fun onRoomDevToolsClicked()
fun onUrlInTopicLongClicked(url: String) fun onUrlInTopicLongClicked(url: String)
} }
@ -193,7 +194,7 @@ class RoomProfileController @Inject constructor(
title = stringProvider.getString(R.string.room_settings_permissions_title), title = stringProvider.getString(R.string.room_settings_permissions_title),
subtitle = stringProvider.getString(R.string.room_settings_permissions_subtitle), subtitle = stringProvider.getString(R.string.room_settings_permissions_subtitle),
dividerColor = dividerColor, dividerColor = dividerColor,
divider = true, divider = false,
editable = true, editable = true,
action = { callback?.onRoomPermissionsClicked() } action = { callback?.onRoomPermissionsClicked() }
) )
@ -204,10 +205,19 @@ class RoomProfileController @Inject constructor(
title = stringProvider.getString(R.string.room_settings_room_internal_id), title = stringProvider.getString(R.string.room_settings_room_internal_id),
subtitle = roomSummary.roomId, subtitle = roomSummary.roomId,
dividerColor = dividerColor, dividerColor = dividerColor,
divider = false, divider = true,
editable = false, editable = false,
action = { callback?.onRoomIdClicked() } action = { callback?.onRoomIdClicked() }
) )
buildProfileAction(
id = "devTools",
title = stringProvider.getString(R.string.dev_tools_menu_name),
subtitle = roomSummary.roomId,
dividerColor = dividerColor,
divider = false,
editable = true,
action = { callback?.onRoomDevToolsClicked() }
)
} }
} }

View file

@ -295,6 +295,10 @@ class RoomProfileFragment @Inject constructor(
copyToClipboard(requireContext(), roomProfileArgs.roomId) copyToClipboard(requireContext(), roomProfileArgs.roomId)
} }
override fun onRoomDevToolsClicked() {
navigator.openDevTools(requireContext(), roomProfileArgs.roomId)
}
override fun onUrlInTopicLongClicked(url: String) { override fun onUrlInTopicLongClicked(url: String) {
copyToClipboard(requireContext(), url, true) copyToClipboard(requireContext(), url, true)
} }