create a loadFromDraft method
This commit is contained in:
@@ -185,6 +185,7 @@ fun NewPostView(
|
|||||||
quote: Note? = null,
|
quote: Note? = null,
|
||||||
fork: Note? = null,
|
fork: Note? = null,
|
||||||
version: Note? = null,
|
version: Note? = null,
|
||||||
|
draft: Note? = null,
|
||||||
enableMessageInterface: Boolean = false,
|
enableMessageInterface: Boolean = false,
|
||||||
accountViewModel: AccountViewModel,
|
accountViewModel: AccountViewModel,
|
||||||
nav: (String) -> Unit,
|
nav: (String) -> Unit,
|
||||||
@@ -201,7 +202,7 @@ fun NewPostView(
|
|||||||
|
|
||||||
LaunchedEffect(Unit) {
|
LaunchedEffect(Unit) {
|
||||||
launch(Dispatchers.IO) {
|
launch(Dispatchers.IO) {
|
||||||
postViewModel.load(accountViewModel, baseReplyTo, quote, fork, version)
|
postViewModel.load(accountViewModel, baseReplyTo, quote, fork, version, draft)
|
||||||
|
|
||||||
postViewModel.imageUploadingError.collect { error ->
|
postViewModel.imageUploadingError.collect { error ->
|
||||||
withContext(Dispatchers.Main) { Toast.makeText(context, error, Toast.LENGTH_SHORT).show() }
|
withContext(Dispatchers.Main) { Toast.makeText(context, error, Toast.LENGTH_SHORT).show() }
|
||||||
|
|||||||
@@ -184,10 +184,14 @@ open class NewPostViewModel() : ViewModel() {
|
|||||||
quote: Note?,
|
quote: Note?,
|
||||||
fork: Note?,
|
fork: Note?,
|
||||||
version: Note?,
|
version: Note?,
|
||||||
|
draft: Note?,
|
||||||
) {
|
) {
|
||||||
this.accountViewModel = accountViewModel
|
this.accountViewModel = accountViewModel
|
||||||
this.account = accountViewModel.account
|
this.account = accountViewModel.account
|
||||||
|
|
||||||
|
if (draft != null) {
|
||||||
|
loadfromDraft(draft)
|
||||||
|
} else {
|
||||||
originalNote = replyingTo
|
originalNote = replyingTo
|
||||||
replyingTo?.let { replyNote ->
|
replyingTo?.let { replyNote ->
|
||||||
if (replyNote.event is BaseTextNoteEvent) {
|
if (replyNote.event is BaseTextNoteEvent) {
|
||||||
@@ -299,6 +303,11 @@ open class NewPostViewModel() : ViewModel() {
|
|||||||
wantsForwardZapTo = true
|
wantsForwardZapTo = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun loadfromDraft(draft: Note?) {
|
||||||
|
// TODO: finish the loadfromDraft method
|
||||||
|
}
|
||||||
|
|
||||||
fun sendPost(
|
fun sendPost(
|
||||||
relayList: List<Relay>? = null,
|
relayList: List<Relay>? = null,
|
||||||
|
|||||||
Reference in New Issue
Block a user