Save draft when redrafting a post (#1744)
This commit is contained in:
parent
26a051220b
commit
e237639adc
|
@ -178,7 +178,8 @@ public final class SavedTootActivity extends BaseActivity implements SavedTootAd
|
||||||
/*mediaAttachments*/null,
|
/*mediaAttachments*/null,
|
||||||
/*scheduledAt*/null,
|
/*scheduledAt*/null,
|
||||||
/*sensitive*/null,
|
/*sensitive*/null,
|
||||||
/*poll*/null
|
/*poll*/null,
|
||||||
|
/* modifiedInitialState */ true
|
||||||
);
|
);
|
||||||
Intent intent = ComposeActivity.startIntent(this, composeOptions);
|
Intent intent = ComposeActivity.startIntent(this, composeOptions);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
|
|
@ -1008,7 +1008,8 @@ class ComposeActivity : BaseActivity(),
|
||||||
var mediaAttachments: List<Attachment>? = null,
|
var mediaAttachments: List<Attachment>? = null,
|
||||||
var scheduledAt: String? = null,
|
var scheduledAt: String? = null,
|
||||||
var sensitive: Boolean? = null,
|
var sensitive: Boolean? = null,
|
||||||
var poll: NewPoll? = null
|
var poll: NewPoll? = null,
|
||||||
|
var modifiedInitialState: Boolean? = null
|
||||||
) : Parcelable
|
) : Parcelable
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
|
@ -63,6 +63,7 @@ class ComposeViewModel
|
||||||
private var startingVisibility: Status.Visibility = Status.Visibility.UNKNOWN
|
private var startingVisibility: Status.Visibility = Status.Visibility.UNKNOWN
|
||||||
|
|
||||||
private var contentWarningStateChanged: Boolean = false
|
private var contentWarningStateChanged: Boolean = false
|
||||||
|
private var modifiedInitialState: Boolean = false
|
||||||
|
|
||||||
private val instance: MutableLiveData<InstanceEntity?> = MutableLiveData(null)
|
private val instance: MutableLiveData<InstanceEntity?> = MutableLiveData(null)
|
||||||
|
|
||||||
|
@ -197,7 +198,7 @@ class ComposeViewModel
|
||||||
val mediaChanged = !media.value.isNullOrEmpty()
|
val mediaChanged = !media.value.isNullOrEmpty()
|
||||||
val pollChanged = poll.value != null
|
val pollChanged = poll.value != null
|
||||||
|
|
||||||
return textChanged || contentWarningChanged || mediaChanged || pollChanged
|
return modifiedInitialState || textChanged || contentWarningChanged || mediaChanged || pollChanged
|
||||||
}
|
}
|
||||||
|
|
||||||
fun contentWarningChanged(value: Boolean) {
|
fun contentWarningChanged(value: Boolean) {
|
||||||
|
@ -369,7 +370,7 @@ class ComposeViewModel
|
||||||
preferredVisibility.num.coerceAtLeast(replyVisibility.num))
|
preferredVisibility.num.coerceAtLeast(replyVisibility.num))
|
||||||
|
|
||||||
inReplyToId = composeOptions?.inReplyToId
|
inReplyToId = composeOptions?.inReplyToId
|
||||||
|
modifiedInitialState = composeOptions?.modifiedInitialState == true
|
||||||
|
|
||||||
val contentWarning = composeOptions?.contentWarning
|
val contentWarning = composeOptions?.contentWarning
|
||||||
if (contentWarning != null) {
|
if (contentWarning != null) {
|
||||||
|
|
|
@ -457,6 +457,7 @@ public abstract class SFragment extends BaseFragment implements Injectable {
|
||||||
composeOptions.setContentWarning(deletedStatus.getSpoilerText());
|
composeOptions.setContentWarning(deletedStatus.getSpoilerText());
|
||||||
composeOptions.setMediaAttachments(deletedStatus.getAttachments());
|
composeOptions.setMediaAttachments(deletedStatus.getAttachments());
|
||||||
composeOptions.setSensitive(deletedStatus.getSensitive());
|
composeOptions.setSensitive(deletedStatus.getSensitive());
|
||||||
|
composeOptions.setModifiedInitialState(true);
|
||||||
if (deletedStatus.getPoll() != null) {
|
if (deletedStatus.getPoll() != null) {
|
||||||
composeOptions.setPoll(deletedStatus.getPoll().toNewPoll(deletedStatus.getCreatedAt()));
|
composeOptions.setPoll(deletedStatus.getPoll().toNewPoll(deletedStatus.getCreatedAt()));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue