diff --git a/app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt b/app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt index d5d20d3da..6e429ea91 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt @@ -690,7 +690,7 @@ class ComposeActivity : BaseActivity(), private fun onContentWarningChanged() { val showWarning = composeContentWarningBar.isGone - viewModel.showContentWarning.value = showWarning + viewModel.contentWarningChanged(showWarning) updateVisibleCharactersLeft() } diff --git a/app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeViewModel.kt b/app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeViewModel.kt index fa6647984..d38fe94b2 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeViewModel.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeViewModel.kt @@ -62,6 +62,8 @@ class ComposeViewModel private var inReplyToId: String? = null private var startingVisibility: Status.Visibility = Status.Visibility.UNKNOWN + private var contentWarningStateChanged: Boolean = false + private val instance: MutableLiveData = MutableLiveData(null) val instanceParams: LiveData = instance.map { instance -> @@ -198,6 +200,11 @@ class ComposeViewModel return textChanged || contentWarningChanged || mediaChanged || pollChanged } + fun contentWarningChanged(value: Boolean) { + showContentWarning.value = value + contentWarningStateChanged = true + } + fun deleteDraft() { saveTootHelper.deleteDraft(this.savedTootUid) } @@ -368,7 +375,9 @@ class ComposeViewModel if (contentWarning != null) { startingContentWarning = contentWarning } - showContentWarning.value = !contentWarning.isNullOrBlank() + if (!contentWarningStateChanged) { + showContentWarning.value = !contentWarning.isNullOrBlank() + } // recreate media list // when coming from SavedTootActivity