bugfix: remove dead code
bugfix: ChannelNewMessageViewModel canPost checks wrong state
This commit is contained in:
+1
-2
@@ -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
|
||||
|
||||
+7
-8
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user