mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-25 21:46:50 +02:00
@@ -271,8 +271,10 @@ fun NewPostView(onClose: () -> Unit, baseReplyTo: Note? = null, quote: Note? = n
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (postViewModel.canUsePoll) {
|
if (postViewModel.canUsePoll) {
|
||||||
|
val hashtag = stringResource(R.string.poll_hashtag)
|
||||||
AddPollButton(postViewModel.wantsPoll) {
|
AddPollButton(postViewModel.wantsPoll) {
|
||||||
postViewModel.wantsPoll = !postViewModel.wantsPoll
|
postViewModel.wantsPoll = !postViewModel.wantsPoll
|
||||||
|
postViewModel.includePollHashtagInMessage(postViewModel.wantsPoll, hashtag)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -195,4 +195,17 @@ open class NewPostViewModel : ViewModel() {
|
|||||||
return message.text.isNotBlank() && !isUploadingImage && !wantsInvoice &&
|
return message.text.isNotBlank() && !isUploadingImage && !wantsInvoice &&
|
||||||
(!wantsPoll || pollOptions.values.all { it.isNotEmpty() })
|
(!wantsPoll || pollOptions.values.all { it.isNotEmpty() })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun includePollHashtagInMessage(include: Boolean, hashtag: String) {
|
||||||
|
if (include) {
|
||||||
|
updateMessage(TextFieldValue(message.text + " $hashtag"))
|
||||||
|
} else {
|
||||||
|
updateMessage(
|
||||||
|
TextFieldValue(
|
||||||
|
message.text.replace(" $hashtag", "")
|
||||||
|
.replace(hashtag, "")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -291,4 +291,5 @@
|
|||||||
|
|
||||||
<string name="lightning_create_and_add_invoice">Create and Add</string>
|
<string name="lightning_create_and_add_invoice">Create and Add</string>
|
||||||
<string name="poll_author_no_vote">Poll authors can\'t vote in their own polls.</string>
|
<string name="poll_author_no_vote">Poll authors can\'t vote in their own polls.</string>
|
||||||
|
<string name="poll_hashtag" translatable="false">#zappoll</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
Reference in New Issue
Block a user