kopia lustrzana https://github.com/ryukoposting/Signal-Android
Add HTTPS scheme when user enters a web address.
rodzic
32d1cc7d54
commit
af1701e6fa
|
@ -43,7 +43,14 @@ class TextStoryPostLinkEntryFragment : KeyboardEntryDialogFragment(
|
||||||
|
|
||||||
input.addTextChangedListener(
|
input.addTextChangedListener(
|
||||||
afterTextChanged = {
|
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)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue