bugfix: remove dead code

bugfix: ChannelNewMessageViewModel canPost checks wrong state
This commit is contained in:
davotoula
2026-03-14 13:06:12 +01:00
parent c290a1c779
commit 42542159d4
2 changed files with 8 additions and 10 deletions
@@ -92,7 +92,6 @@ fun SelectFromGallery(
@Composable
fun SelectSingleFromGallery(
isUploading: Boolean,
enabled: Boolean = true,
tint: Color,
modifier: Modifier,
onImageChosen: (SelectedMedia) -> Unit,
@@ -109,7 +108,7 @@ fun SelectSingleFromGallery(
)
}
GallerySelectButton(isUploading, enabled, tint, modifier) { showGallerySelect = true }
GallerySelectButton(isUploading, true, tint, modifier) { showGallerySelect = true }
}
@Composable
@@ -134,8 +134,8 @@ open class ChannelNewMessageViewModel :
var message by mutableStateOf(TextFieldValue(""))
var urlPreview by mutableStateOf<String?>(null)
var isUploadingImage by mutableStateOf(false)
var isUploadingFile by mutableStateOf(false)
val isUploadingImage: Boolean get() = uploadState?.isUploadingImage ?: false
val isUploadingFile: Boolean get() = uploadState?.isUploadingFile ?: false
var userSuggestions: UserSuggestionState? = null
var userSuggestionsMainMessage: UserSuggestionAnchor? = null
@@ -339,9 +339,9 @@ open class ChannelNewMessageViewModel :
val myMultiOrchestrator = uploadState.multiOrchestrator ?: return@launch
if (myMultiOrchestrator.hasNonMedia()) {
isUploadingFile = true
uploadState.isUploadingFile = true
} else {
isUploadingImage = true
uploadState.isUploadingImage = true
}
val results =
@@ -383,8 +383,8 @@ open class ChannelNewMessageViewModel :
onError(stringRes(context, R.string.failed_to_upload_media_no_details), errorMessages.joinToString(".\n"))
}
isUploadingImage = false
isUploadingFile = false
uploadState.isUploadingImage = false
uploadState.isUploadingFile = false
}
}
@@ -552,8 +552,7 @@ open class ChannelNewMessageViewModel :
userSuggestions?.reset()
userSuggestionsMainMessage = null
isUploadingImage = false
isUploadingFile = false
uploadState?.reset()
iMetaAttachments.reset()