Opening links from RiotX reuses browser tab (#599)

This commit is contained in:
Benoit Marty 2019-10-09 16:23:35 +02:00
parent 36c5f9af13
commit 3f8ddbe880
3 changed files with 11 additions and 1 deletions

View File

@ -19,6 +19,7 @@ Bugfix:
- after login, the icon in the top left is a green 'A' for (all communities) rather than my avatar (#267)
- Picture uploads are unreliable, pictures are shown in wrong aspect ratio on desktop client (#517)
- Invitation notifications are not dismissed automatically if room is joined from another client (#347)
- Opening links from RiotX reuses browser tab (#599)
Translations:
-

View File

@ -50,6 +50,7 @@ fun openUrlInExternalBrowser(context: Context, uri: Uri?) {
uri?.let {
val browserIntent = Intent(Intent.ACTION_VIEW, it).apply {
putExtra(Browser.EXTRA_APPLICATION_ID, context.packageName)
putExtra(Browser.EXTRA_CREATE_NEW_TAB, true)
}
try {

View File

@ -785,7 +785,7 @@ class RoomDetailFragment :
// TimelineEventController.Callback ************************************************************
override fun onUrlClicked(url: String): Boolean {
return permalinkHandler.launch(requireActivity(), url, object : NavigateToRoomInterceptor {
val managed = permalinkHandler.launch(requireActivity(), url, object : NavigateToRoomInterceptor {
override fun navToRoom(roomId: String, eventId: String?): Boolean {
// Same room?
if (roomId == roomDetailArgs.roomId) {
@ -803,6 +803,14 @@ class RoomDetailFragment :
return false
}
})
if (!managed) {
// Open in external browser, in a new Tab
openUrlInExternalBrowser(requireContext(), url)
}
// In fact it is always managed
return true
}
override fun onUrlLongClicked(url: String): Boolean {