mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-20 08:39:22 +01:00
Add HTTPS scheme when user enters a web address.
This commit is contained in:
committed by
Greyson Parrelli
parent
32d1cc7d54
commit
af1701e6fa
@@ -43,7 +43,14 @@ class TextStoryPostLinkEntryFragment : KeyboardEntryDialogFragment(
|
||||
|
||||
input.addTextChangedListener(
|
||||
afterTextChanged = {
|
||||
linkPreviewViewModel.onTextChanged(requireContext(), it!!.toString(), input.selectionStart, input.selectionEnd)
|
||||
val scheme = "https://"
|
||||
val (uriString, selectionStart, selectionEnd) = if (it!!.startsWith(scheme)) {
|
||||
Triple(it, input.selectionStart, input.selectionEnd)
|
||||
} else {
|
||||
Triple("$scheme$it", input.selectionStart + scheme.length, input.selectionEnd + scheme.length)
|
||||
}
|
||||
|
||||
linkPreviewViewModel.onTextChanged(requireContext(), uriString.toString(), selectionStart, selectionEnd)
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user