From 0be6b1a86d98fd47c944dd174a2de718f1cd1d9d Mon Sep 17 00:00:00 2001 From: FineFindus Date: Tue, 27 Aug 2024 20:24:11 +0200 Subject: [PATCH] fix(ComposeFragment): allow pixelfed replies with no attachements Pixelfed only allows posting posts with a text and atleast one attachements, but repliesn can be text only. Closing https://github.com/LucasGGamerM/moshidon/issues/519 --- .../joinmastodon/android/fragments/ComposeFragment.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java index 0c87e48e99..add10ffa30 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/ComposeFragment.java @@ -1051,13 +1051,16 @@ private void resetPublishButtonText() { public void updatePublishButtonState(){ uuid=null; + // pixelfed only allows posts with images, but replies can be text-only + boolean isValidPixelfedPost=!isInstancePixelfed() || (replyTo==null || !mediaViewController.isEmpty()); + boolean isValidPost= isValidPixelfedPost && (trimmedCharCount>0 || !mediaViewController.isEmpty()) && charCount<=charLimit && mediaViewController.getNonDoneAttachmentCount()==0 && (pollViewController.isEmpty() || pollViewController.getNonEmptyOptionsCount()>1); if(GlobalUserPreferences.relocatePublishButton && publishButtonRelocated != null){ - publishButtonRelocated.setEnabled((!isInstancePixelfed() || !mediaViewController.isEmpty()) && (trimmedCharCount>0 || !mediaViewController.isEmpty()) && charCount<=charLimit && mediaViewController.getNonDoneAttachmentCount()==0 && (pollViewController.isEmpty() || pollViewController.getNonEmptyOptionsCount()>1)); + publishButtonRelocated.setEnabled(isValidPost); } if(publishButton==null) return; - publishButton.setEnabled((!isInstancePixelfed() || !mediaViewController.isEmpty()) && (trimmedCharCount>0 || !mediaViewController.isEmpty()) && charCount<=charLimit && mediaViewController.getNonDoneAttachmentCount()==0 && (pollViewController.isEmpty() || pollViewController.getNonEmptyOptionsCount()>1)); + publishButton.setEnabled(isValidPost); } private void onCustomEmojiClick(Emoji emoji){