When a plaintext share contains EXTRA_TEXT and a distinct EXTRA_SUBJECT, use EXTRA_SUBJECT as the content warning for the shared status (#1712)

main
Levi Bard 5 years ago committed by GitHub
parent 9144484994
commit 903d2154bf
  1. 13
      app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt

@ -207,15 +207,14 @@ class ComposeActivity : BaseActivity(),
if (action != null && action == Intent.ACTION_SEND) {
val subject = intent.getStringExtra(Intent.EXTRA_SUBJECT)
val text = intent.getStringExtra(Intent.EXTRA_TEXT)
val shareBody = if (subject != null && text != null) {
if (subject != text && !text.contains(subject)) {
String.format("%s\n%s", subject, text)
} else {
text
}
} else text ?: subject
val shareBody = text ?: subject
if (shareBody != null) {
if (!subject.isNullOrBlank() && subject !in shareBody) {
composeContentWarningField.setText(subject)
viewModel.showContentWarning.value = true
}
val start = composeEditField.selectionStart.coerceAtLeast(0)
val end = composeEditField.selectionEnd.coerceAtLeast(0)
val left = min(start, end)

Loading…
Cancel
Save