continuing to the originally supplied url when a rtl override character is detected
This commit is contained in:
parent
e6198d7bf6
commit
67f1929784
@ -1927,10 +1927,14 @@ class TimelineFragment @Inject constructor(
|
|||||||
if (!isManaged) {
|
if (!isManaged) {
|
||||||
when {
|
when {
|
||||||
url.containsRtLOverride() -> {
|
url.containsRtLOverride() -> {
|
||||||
displayUrlConfirmationDialog(title.ensureEndsLeftToRight(), url.filterDirectionOverrides())
|
displayUrlConfirmationDialog(
|
||||||
|
seenUrl = title.ensureEndsLeftToRight(),
|
||||||
|
actualUrl = url.filterDirectionOverrides(),
|
||||||
|
continueTo = url
|
||||||
|
)
|
||||||
}
|
}
|
||||||
title.isValidUrl() && url.isValidUrl() && URL(title).host != URL(url).host -> {
|
title.isValidUrl() && url.isValidUrl() && URL(title).host != URL(url).host -> {
|
||||||
displayUrlConfirmationDialog(title.ensureEndsLeftToRight(), url)
|
displayUrlConfirmationDialog(title, url)
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
openUrlInExternalBrowser(requireContext(), url)
|
openUrlInExternalBrowser(requireContext(), url)
|
||||||
@ -1942,17 +1946,17 @@ class TimelineFragment @Inject constructor(
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun displayUrlConfirmationDialog(title: String, url: String) {
|
private fun displayUrlConfirmationDialog(seenUrl: String, actualUrl: String, continueTo: String = actualUrl) {
|
||||||
MaterialAlertDialogBuilder(requireActivity(), R.style.ThemeOverlay_Vector_MaterialAlertDialog_NegativeDestructive)
|
MaterialAlertDialogBuilder(requireActivity(), R.style.ThemeOverlay_Vector_MaterialAlertDialog_NegativeDestructive)
|
||||||
.setTitle(R.string.external_link_confirmation_title)
|
.setTitle(R.string.external_link_confirmation_title)
|
||||||
.setMessage(
|
.setMessage(
|
||||||
getString(R.string.external_link_confirmation_message, title, url)
|
getString(R.string.external_link_confirmation_message, seenUrl, actualUrl)
|
||||||
.toSpannable()
|
.toSpannable()
|
||||||
.colorizeMatchingText(url, colorProvider.getColorFromAttribute(R.attr.vctr_content_tertiary))
|
.colorizeMatchingText(actualUrl, colorProvider.getColorFromAttribute(R.attr.vctr_content_tertiary))
|
||||||
.colorizeMatchingText(title, colorProvider.getColorFromAttribute(R.attr.vctr_content_tertiary))
|
.colorizeMatchingText(seenUrl, colorProvider.getColorFromAttribute(R.attr.vctr_content_tertiary))
|
||||||
)
|
)
|
||||||
.setPositiveButton(R.string._continue) { _, _ ->
|
.setPositiveButton(R.string._continue) { _, _ ->
|
||||||
openUrlInExternalBrowser(requireContext(), url)
|
openUrlInExternalBrowser(requireContext(), continueTo)
|
||||||
}
|
}
|
||||||
.setNegativeButton(R.string.action_cancel, null)
|
.setNegativeButton(R.string.action_cancel, null)
|
||||||
.show()
|
.show()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user