- SelectFromGallery and SelectFromFiles now accept an enabled param separate from isUploading

- All ViewModels track isUploadingFile alongside isUploadingImage, set via hasNonMedia()
  - All screen call sites pass source-specific flags so only the initiating button spins
  - canPost() methods block posting during file uploads too
  - ChatNewMessageViewModel delegates to ChatFileUploadState (fixes pre-existing dead state)
  - cancel() methods reset both flags in all ViewModels
This commit is contained in:
davotoula
2026-03-14 12:58:18 +01:00
parent 42574f302c
commit c290a1c779
17 changed files with 104 additions and 22 deletions
@@ -372,6 +372,7 @@ private fun BottomRowActions(postViewModel: EditPostViewModel) {
) { ) {
SelectFromGallery( SelectFromGallery(
isUploading = postViewModel.isUploadingImage, isUploading = postViewModel.isUploadingImage,
enabled = !postViewModel.isUploadingFile,
tint = MaterialTheme.colorScheme.onBackground, tint = MaterialTheme.colorScheme.onBackground,
modifier = Modifier, modifier = Modifier,
) { ) {
@@ -379,7 +380,8 @@ private fun BottomRowActions(postViewModel: EditPostViewModel) {
} }
SelectFromFiles( SelectFromFiles(
isUploading = postViewModel.isUploadingImage, isUploading = postViewModel.isUploadingFile,
enabled = !postViewModel.isUploadingImage,
tint = MaterialTheme.colorScheme.onBackground, tint = MaterialTheme.colorScheme.onBackground,
modifier = Modifier, modifier = Modifier,
) { ) {
@@ -80,6 +80,7 @@ open class EditPostViewModel : ViewModel() {
var message by mutableStateOf(TextFieldValue("")) var message by mutableStateOf(TextFieldValue(""))
var urlPreview by mutableStateOf<String?>(null) var urlPreview by mutableStateOf<String?>(null)
var isUploadingImage by mutableStateOf(false) var isUploadingImage by mutableStateOf(false)
var isUploadingFile by mutableStateOf(false)
var userSuggestions: UserSuggestionState? = null var userSuggestions: UserSuggestionState? = null
var userSuggestionsMainMessage: UserSuggestionAnchor? = null var userSuggestionsMainMessage: UserSuggestionAnchor? = null
@@ -180,7 +181,11 @@ open class EditPostViewModel : ViewModel() {
val myAccount = account val myAccount = account
val myMultiOrchestrator = multiOrchestrator ?: return@launch val myMultiOrchestrator = multiOrchestrator ?: return@launch
isUploadingImage = true if (myMultiOrchestrator.hasNonMedia()) {
isUploadingFile = true
} else {
isUploadingImage = true
}
val results = val results =
myMultiOrchestrator.upload( myMultiOrchestrator.upload(
@@ -244,6 +249,7 @@ open class EditPostViewModel : ViewModel() {
} }
isUploadingImage = false isUploadingImage = false
isUploadingFile = false
} }
} }
@@ -256,6 +262,7 @@ open class EditPostViewModel : ViewModel() {
multiOrchestrator = null multiOrchestrator = null
urlPreview = null urlPreview = null
isUploadingImage = false isUploadingImage = false
isUploadingFile = false
wantsInvoice = false wantsInvoice = false
@@ -296,7 +303,7 @@ open class EditPostViewModel : ViewModel() {
} }
} }
fun canPost() = message.text.isNotBlank() && !isUploadingImage && !wantsInvoice && multiOrchestrator == null fun canPost() = message.text.isNotBlank() && !isUploadingImage && !isUploadingFile && !wantsInvoice && multiOrchestrator == null
fun selectImage(uris: ImmutableList<SelectedMedia>) { fun selectImage(uris: ImmutableList<SelectedMedia>) {
multiOrchestrator = MultiOrchestrator(uris) multiOrchestrator = MultiOrchestrator(uris)
@@ -48,6 +48,7 @@ import java.util.concurrent.atomic.AtomicBoolean
@Composable @Composable
fun SelectFromFiles( fun SelectFromFiles(
isUploading: Boolean, isUploading: Boolean,
enabled: Boolean = true,
tint: Color, tint: Color,
modifier: Modifier, modifier: Modifier,
onFilesChosen: (ImmutableList<SelectedMedia>) -> Unit, onFilesChosen: (ImmutableList<SelectedMedia>) -> Unit,
@@ -64,19 +65,20 @@ fun SelectFromFiles(
) )
} }
FileSelectButton(isUploading, tint, modifier) { showFileSelect = true } FileSelectButton(isUploading, enabled, tint, modifier) { showFileSelect = true }
} }
@Composable @Composable
private fun FileSelectButton( private fun FileSelectButton(
isUploading: Boolean, isUploading: Boolean,
enabled: Boolean,
tint: Color, tint: Color,
modifier: Modifier, modifier: Modifier,
onClick: () -> Unit, onClick: () -> Unit,
) { ) {
IconButton( IconButton(
modifier = modifier, modifier = modifier,
enabled = !isUploading, enabled = enabled && !isUploading,
onClick = { onClick() }, onClick = { onClick() },
) { ) {
if (!isUploading) { if (!isUploading) {
@@ -69,6 +69,7 @@ class SelectedMedia(
@Composable @Composable
fun SelectFromGallery( fun SelectFromGallery(
isUploading: Boolean, isUploading: Boolean,
enabled: Boolean = true,
tint: Color, tint: Color,
modifier: Modifier, modifier: Modifier,
onImageChosen: (ImmutableList<SelectedMedia>) -> Unit, onImageChosen: (ImmutableList<SelectedMedia>) -> Unit,
@@ -85,12 +86,13 @@ fun SelectFromGallery(
) )
} }
GallerySelectButton(isUploading, tint, modifier) { showGallerySelect = true } GallerySelectButton(isUploading, enabled, tint, modifier) { showGallerySelect = true }
} }
@Composable @Composable
fun SelectSingleFromGallery( fun SelectSingleFromGallery(
isUploading: Boolean, isUploading: Boolean,
enabled: Boolean = true,
tint: Color, tint: Color,
modifier: Modifier, modifier: Modifier,
onImageChosen: (SelectedMedia) -> Unit, onImageChosen: (SelectedMedia) -> Unit,
@@ -107,19 +109,20 @@ fun SelectSingleFromGallery(
) )
} }
GallerySelectButton(isUploading, tint, modifier) { showGallerySelect = true } GallerySelectButton(isUploading, enabled, tint, modifier) { showGallerySelect = true }
} }
@Composable @Composable
private fun GallerySelectButton( private fun GallerySelectButton(
isUploading: Boolean, isUploading: Boolean,
enabled: Boolean,
tint: Color, tint: Color,
modifier: Modifier, modifier: Modifier,
onClick: () -> Unit, onClick: () -> Unit,
) { ) {
IconButton( IconButton(
modifier = modifier, modifier = modifier,
enabled = !isUploading, enabled = enabled && !isUploading,
onClick = { onClick() }, onClick = { onClick() },
) { ) {
if (!isUploading) { if (!isUploading) {
@@ -150,6 +150,7 @@ open class CommentPostViewModel :
val urlPreviews = PreviewState() val urlPreviews = PreviewState()
var isUploadingImage by mutableStateOf(false) var isUploadingImage by mutableStateOf(false)
var isUploadingFile by mutableStateOf(false)
var userSuggestions: UserSuggestionState? = null var userSuggestions: UserSuggestionState? = null
var userSuggestionsMainMessage: UserSuggestionAnchor? = null var userSuggestionsMainMessage: UserSuggestionAnchor? = null
@@ -487,7 +488,11 @@ open class CommentPostViewModel :
viewModelScope.launch(Dispatchers.IO) { viewModelScope.launch(Dispatchers.IO) {
val myMultiOrchestrator = multiOrchestrator ?: return@launch val myMultiOrchestrator = multiOrchestrator ?: return@launch
isUploadingImage = true if (myMultiOrchestrator.hasNonMedia()) {
isUploadingFile = true
} else {
isUploadingImage = true
}
val results = val results =
myMultiOrchestrator.upload( myMultiOrchestrator.upload(
@@ -552,6 +557,7 @@ open class CommentPostViewModel :
} }
isUploadingImage = false isUploadingImage = false
isUploadingFile = false
} }
} }
@@ -565,6 +571,7 @@ open class CommentPostViewModel :
multiOrchestrator = null multiOrchestrator = null
isUploadingImage = false isUploadingImage = false
isUploadingFile = false
notifying = null notifying = null
@@ -677,6 +684,7 @@ open class CommentPostViewModel :
fun canPost(): Boolean = fun canPost(): Boolean =
message.text.isNotBlank() && message.text.isNotBlank() &&
!isUploadingImage && !isUploadingImage &&
!isUploadingFile &&
!wantsInvoice && !wantsInvoice &&
(!wantsZapraiser || zapRaiserAmount.value != null) && (!wantsZapraiser || zapRaiserAmount.value != null) &&
multiOrchestrator == null multiOrchestrator == null
@@ -391,6 +391,7 @@ private fun BottomRowActions(postViewModel: CommentPostViewModel) {
) { ) {
SelectFromGallery( SelectFromGallery(
isUploading = postViewModel.isUploadingImage, isUploading = postViewModel.isUploadingImage,
enabled = !postViewModel.isUploadingFile,
tint = MaterialTheme.colorScheme.onBackground, tint = MaterialTheme.colorScheme.onBackground,
modifier = Modifier, modifier = Modifier,
) { ) {
@@ -398,7 +399,8 @@ private fun BottomRowActions(postViewModel: CommentPostViewModel) {
} }
SelectFromFiles( SelectFromFiles(
isUploading = postViewModel.isUploadingImage, isUploading = postViewModel.isUploadingFile,
enabled = !postViewModel.isUploadingImage,
tint = MaterialTheme.colorScheme.onBackground, tint = MaterialTheme.colorScheme.onBackground,
modifier = Modifier, modifier = Modifier,
) { ) {
@@ -141,7 +141,8 @@ class ChatNewMessageViewModel :
val urlPreviews = PreviewState() val urlPreviews = PreviewState()
var isUploadingImage by mutableStateOf(false) val isUploadingImage: Boolean get() = uploadState?.isUploadingImage ?: false
val isUploadingFile: Boolean get() = uploadState?.isUploadingFile ?: false
var userSuggestions: UserSuggestionState? = null var userSuggestions: UserSuggestionState? = null
var userSuggestionsMainMessage: UserSuggestionAnchor? = null var userSuggestionsMainMessage: UserSuggestionAnchor? = null
@@ -692,6 +693,7 @@ class ChatNewMessageViewModel :
fun canPost(): Boolean = fun canPost(): Boolean =
message.text.isNotBlank() && message.text.isNotBlank() &&
uploadState?.isUploadingImage != true && uploadState?.isUploadingImage != true &&
uploadState?.isUploadingFile != true &&
!wantsInvoice && !wantsInvoice &&
(!wantsZapraiser || zapRaiserAmount.value != null) && (!wantsZapraiser || zapRaiserAmount.value != null) &&
(toUsers.text.isNotBlank()) && (toUsers.text.isNotBlank()) &&
@@ -386,6 +386,7 @@ private fun BottomRowActions(
if (postViewModel.room != null) { if (postViewModel.room != null) {
SelectFromGallery( SelectFromGallery(
isUploading = postViewModel.isUploadingImage, isUploading = postViewModel.isUploadingImage,
enabled = !postViewModel.isUploadingFile,
tint = MaterialTheme.colorScheme.onBackground, tint = MaterialTheme.colorScheme.onBackground,
modifier = Modifier, modifier = Modifier,
) { ) {
@@ -393,7 +394,8 @@ private fun BottomRowActions(
} }
SelectFromFiles( SelectFromFiles(
isUploading = postViewModel.isUploadingImage, isUploading = postViewModel.isUploadingFile,
enabled = !postViewModel.isUploadingImage,
tint = MaterialTheme.colorScheme.onBackground, tint = MaterialTheme.colorScheme.onBackground,
modifier = Modifier, modifier = Modifier,
) { ) {
@@ -43,7 +43,11 @@ class ChatFileUploader(
onceUploaded: suspend (List<SuccessfulUploads>) -> Unit, onceUploaded: suspend (List<SuccessfulUploads>) -> Unit,
) { ) {
val orchestrator = viewState.multiOrchestrator ?: return val orchestrator = viewState.multiOrchestrator ?: return
viewState.isUploadingImage = true if (orchestrator.hasNonMedia()) {
viewState.isUploadingFile = true
} else {
viewState.isUploadingImage = true
}
val cipher = AESGCM() val cipher = AESGCM()
@@ -77,6 +81,7 @@ class ChatFileUploader(
} }
viewState.isUploadingImage = false viewState.isUploadingImage = false
viewState.isUploadingFile = false
} }
// ------ // ------
@@ -90,7 +95,11 @@ class ChatFileUploader(
onceUploaded: suspend (List<SuccessfulUploads>) -> Unit, onceUploaded: suspend (List<SuccessfulUploads>) -> Unit,
) { ) {
val orchestrator = viewState.multiOrchestrator ?: return val orchestrator = viewState.multiOrchestrator ?: return
viewState.isUploadingImage = true if (orchestrator.hasNonMedia()) {
viewState.isUploadingFile = true
} else {
viewState.isUploadingImage = true
}
val results = val results =
orchestrator.upload( orchestrator.upload(
@@ -121,5 +130,6 @@ class ChatFileUploader(
} }
viewState.isUploadingImage = false viewState.isUploadingImage = false
viewState.isUploadingFile = false
} }
} }
@@ -135,6 +135,7 @@ open class ChannelNewMessageViewModel :
var message by mutableStateOf(TextFieldValue("")) var message by mutableStateOf(TextFieldValue(""))
var urlPreview by mutableStateOf<String?>(null) var urlPreview by mutableStateOf<String?>(null)
var isUploadingImage by mutableStateOf(false) var isUploadingImage by mutableStateOf(false)
var isUploadingFile by mutableStateOf(false)
var userSuggestions: UserSuggestionState? = null var userSuggestions: UserSuggestionState? = null
var userSuggestionsMainMessage: UserSuggestionAnchor? = null var userSuggestionsMainMessage: UserSuggestionAnchor? = null
@@ -337,7 +338,11 @@ open class ChannelNewMessageViewModel :
val myMultiOrchestrator = uploadState.multiOrchestrator ?: return@launch val myMultiOrchestrator = uploadState.multiOrchestrator ?: return@launch
isUploadingImage = true if (myMultiOrchestrator.hasNonMedia()) {
isUploadingFile = true
} else {
isUploadingImage = true
}
val results = val results =
myMultiOrchestrator.upload( myMultiOrchestrator.upload(
@@ -379,6 +384,7 @@ open class ChannelNewMessageViewModel :
} }
isUploadingImage = false isUploadingImage = false
isUploadingFile = false
} }
} }
@@ -546,6 +552,9 @@ open class ChannelNewMessageViewModel :
userSuggestions?.reset() userSuggestions?.reset()
userSuggestionsMainMessage = null userSuggestionsMainMessage = null
isUploadingImage = false
isUploadingFile = false
iMetaAttachments.reset() iMetaAttachments.reset()
emojiSuggestions?.reset() emojiSuggestions?.reset()
@@ -633,6 +642,7 @@ open class ChannelNewMessageViewModel :
fun canPost(): Boolean = fun canPost(): Boolean =
message.text.isNotBlank() && message.text.isNotBlank() &&
uploadState?.isUploadingImage != true && uploadState?.isUploadingImage != true &&
uploadState?.isUploadingFile != true &&
!wantsInvoice && !wantsInvoice &&
(!wantsZapraiser || zapRaiserAmount != null) && (!wantsZapraiser || zapRaiserAmount != null) &&
uploadState?.multiOrchestrator == null uploadState?.multiOrchestrator == null
@@ -37,6 +37,7 @@ class ChatFileUploadState(
val defaultServer: ServerName, val defaultServer: ServerName,
) { ) {
var isUploadingImage by mutableStateOf(false) var isUploadingImage by mutableStateOf(false)
var isUploadingFile by mutableStateOf(false)
var selectedServer by mutableStateOf(defaultServer) var selectedServer by mutableStateOf(defaultServer)
var caption by mutableStateOf("") var caption by mutableStateOf("")
@@ -65,6 +66,7 @@ class ChatFileUploadState(
fun reset() { fun reset() {
multiOrchestrator = null multiOrchestrator = null
isUploadingImage = false isUploadingImage = false
isUploadingFile = false
caption = "" caption = ""
selectedServer = defaultServer selectedServer = defaultServer
} }
@@ -359,6 +359,7 @@ private fun BottomRowActions(postViewModel: NewProductViewModel) {
) { ) {
SelectFromGallery( SelectFromGallery(
isUploading = postViewModel.isUploadingImage, isUploading = postViewModel.isUploadingImage,
enabled = !postViewModel.isUploadingFile,
tint = MaterialTheme.colorScheme.onBackground, tint = MaterialTheme.colorScheme.onBackground,
modifier = Modifier, modifier = Modifier,
) { ) {
@@ -366,7 +367,8 @@ private fun BottomRowActions(postViewModel: NewProductViewModel) {
} }
SelectFromFiles( SelectFromFiles(
isUploading = postViewModel.isUploadingImage, isUploading = postViewModel.isUploadingFile,
enabled = !postViewModel.isUploadingImage,
tint = MaterialTheme.colorScheme.onBackground, tint = MaterialTheme.colorScheme.onBackground,
modifier = Modifier, modifier = Modifier,
) { ) {
@@ -134,6 +134,7 @@ open class NewProductViewModel :
val urlPreviews = PreviewState() val urlPreviews = PreviewState()
var isUploadingImage by mutableStateOf(false) var isUploadingImage by mutableStateOf(false)
var isUploadingFile by mutableStateOf(false)
var userSuggestions: UserSuggestionState? = null var userSuggestions: UserSuggestionState? = null
var userSuggestionsMainMessage: UserSuggestionAnchor? = null var userSuggestionsMainMessage: UserSuggestionAnchor? = null
@@ -399,7 +400,11 @@ open class NewProductViewModel :
val myAccount = account ?: return@launch val myAccount = account ?: return@launch
val myMultiOrchestrator = multiOrchestrator ?: return@launch val myMultiOrchestrator = multiOrchestrator ?: return@launch
isUploadingImage = true if (myMultiOrchestrator.hasNonMedia()) {
isUploadingFile = true
} else {
isUploadingImage = true
}
val results = val results =
myMultiOrchestrator.upload( myMultiOrchestrator.upload(
@@ -445,6 +450,7 @@ open class NewProductViewModel :
} }
isUploadingImage = false isUploadingImage = false
isUploadingFile = false
} }
} }
@@ -455,6 +461,7 @@ open class NewProductViewModel :
multiOrchestrator = null multiOrchestrator = null
isUploadingImage = false isUploadingImage = false
isUploadingFile = false
wantsInvoice = false wantsInvoice = false
wantsZapraiser = false wantsZapraiser = false
@@ -576,6 +583,7 @@ open class NewProductViewModel :
fun canPost(): Boolean = fun canPost(): Boolean =
message.text.isNotBlank() && message.text.isNotBlank() &&
!isUploadingImage && !isUploadingImage &&
!isUploadingFile &&
!wantsInvoice && !wantsInvoice &&
(!wantsZapraiser || zapRaiserAmount.value != null) && (!wantsZapraiser || zapRaiserAmount.value != null) &&
title.text.isNotBlank() && title.text.isNotBlank() &&
@@ -494,6 +494,7 @@ private fun BottomRowActions(postViewModel: ShortNotePostViewModel) {
) { ) {
SelectFromGallery( SelectFromGallery(
isUploading = postViewModel.isUploadingImage, isUploading = postViewModel.isUploadingImage,
enabled = !postViewModel.isUploadingFile,
tint = MaterialTheme.colorScheme.onBackground, tint = MaterialTheme.colorScheme.onBackground,
modifier = Modifier, modifier = Modifier,
) { ) {
@@ -501,7 +502,8 @@ private fun BottomRowActions(postViewModel: ShortNotePostViewModel) {
} }
SelectFromFiles( SelectFromFiles(
isUploading = postViewModel.isUploadingImage, isUploading = postViewModel.isUploadingFile,
enabled = !postViewModel.isUploadingImage,
tint = MaterialTheme.colorScheme.onBackground, tint = MaterialTheme.colorScheme.onBackground,
modifier = Modifier, modifier = Modifier,
) { ) {
@@ -179,6 +179,7 @@ open class ShortNotePostViewModel :
val urlPreviews = PreviewState() val urlPreviews = PreviewState()
var isUploadingImage by mutableStateOf(false) var isUploadingImage by mutableStateOf(false)
var isUploadingFile by mutableStateOf(false)
var userSuggestions: UserSuggestionState? = null var userSuggestions: UserSuggestionState? = null
var userSuggestionsMainMessage: UserSuggestionAnchor? = null var userSuggestionsMainMessage: UserSuggestionAnchor? = null
@@ -829,7 +830,11 @@ open class ShortNotePostViewModel :
viewModelScope.launch(Dispatchers.IO) { viewModelScope.launch(Dispatchers.IO) {
val myMultiOrchestrator = multiOrchestrator ?: return@launch val myMultiOrchestrator = multiOrchestrator ?: return@launch
isUploadingImage = true if (myMultiOrchestrator.hasNonMedia()) {
isUploadingFile = true
} else {
isUploadingImage = true
}
val results = val results =
myMultiOrchestrator.upload( myMultiOrchestrator.upload(
@@ -886,6 +891,7 @@ open class ShortNotePostViewModel :
} }
isUploadingImage = false isUploadingImage = false
isUploadingFile = false
} }
} }
@@ -898,6 +904,7 @@ open class ShortNotePostViewModel :
multiOrchestrator = null multiOrchestrator = null
isUploadingImage = false isUploadingImage = false
isUploadingFile = false
voiceAnonymization.clear() voiceAnonymization.clear()
deleteVoiceLocalFile() deleteVoiceLocalFile()
voiceRecording = null voiceRecording = null
@@ -1032,12 +1039,13 @@ open class ShortNotePostViewModel :
fun canPost(): Boolean { fun canPost(): Boolean {
// Voice messages can be posted without text (with either uploaded or pending recording) // Voice messages can be posted without text (with either uploaded or pending recording)
if (voiceMetadata != null || voiceRecording != null) { if (voiceMetadata != null || voiceRecording != null) {
return !isUploadingVoice && !isUploadingImage && processingPreset == null return !isUploadingVoice && !isUploadingImage && !isUploadingFile && processingPreset == null
} }
// Regular text/media posts require text // Regular text/media posts require text
return message.text.isNotBlank() && return message.text.isNotBlank() &&
!isUploadingImage && !isUploadingImage &&
!isUploadingFile &&
!isUploadingVoice && !isUploadingVoice &&
!wantsInvoice && !wantsInvoice &&
(!wantsZapRaiser || zapRaiserAmount.value != null) && (!wantsZapRaiser || zapRaiserAmount.value != null) &&
@@ -321,6 +321,7 @@ private fun BottomRowActions(
) { ) {
SelectFromGallery( SelectFromGallery(
isUploading = postViewModel.isUploadingImage, isUploading = postViewModel.isUploadingImage,
enabled = !postViewModel.isUploadingFile,
tint = MaterialTheme.colorScheme.onBackground, tint = MaterialTheme.colorScheme.onBackground,
modifier = Modifier, modifier = Modifier,
) { ) {
@@ -328,7 +329,8 @@ private fun BottomRowActions(
} }
SelectFromFiles( SelectFromFiles(
isUploading = postViewModel.isUploadingImage, isUploading = postViewModel.isUploadingFile,
enabled = !postViewModel.isUploadingImage,
tint = MaterialTheme.colorScheme.onBackground, tint = MaterialTheme.colorScheme.onBackground,
modifier = Modifier, modifier = Modifier,
) { ) {
@@ -150,6 +150,7 @@ class NewPublicMessageViewModel :
val urlPreviews = PreviewState() val urlPreviews = PreviewState()
var isUploadingImage by mutableStateOf(false) var isUploadingImage by mutableStateOf(false)
var isUploadingFile by mutableStateOf(false)
var userSuggestions: UserSuggestionState? = null var userSuggestions: UserSuggestionState? = null
var userSuggestionsMainMessage: UserSuggestionAnchor? = null var userSuggestionsMainMessage: UserSuggestionAnchor? = null
@@ -439,7 +440,11 @@ class NewPublicMessageViewModel :
viewModelScope.launch(Dispatchers.IO) { viewModelScope.launch(Dispatchers.IO) {
val myMultiOrchestrator = multiOrchestrator ?: return@launch val myMultiOrchestrator = multiOrchestrator ?: return@launch
isUploadingImage = true if (myMultiOrchestrator.hasNonMedia()) {
isUploadingFile = true
} else {
isUploadingImage = true
}
val results = val results =
myMultiOrchestrator.upload( myMultiOrchestrator.upload(
@@ -495,6 +500,7 @@ class NewPublicMessageViewModel :
} }
isUploadingImage = false isUploadingImage = false
isUploadingFile = false
} }
} }
@@ -523,6 +529,9 @@ class NewPublicMessageViewModel :
userSuggestions?.reset() userSuggestions?.reset()
userSuggestionsMainMessage = null userSuggestionsMainMessage = null
isUploadingImage = false
isUploadingFile = false
iMetaAttachments.reset() iMetaAttachments.reset()
emojiSuggestions?.reset() emojiSuggestions?.reset()
@@ -629,6 +638,7 @@ class NewPublicMessageViewModel :
fun canPost(): Boolean = fun canPost(): Boolean =
message.text.isNotBlank() && message.text.isNotBlank() &&
!isUploadingImage && !isUploadingImage &&
!isUploadingFile &&
!wantsInvoice && !wantsInvoice &&
(!wantsZapraiser || zapRaiserAmount.value != null) && (!wantsZapraiser || zapRaiserAmount.value != null) &&
(toUsers.text.isNotBlank()) && (toUsers.text.isNotBlank()) &&