From 3f12ad0f2d475880b2152ff44b1e2e614116febd Mon Sep 17 00:00:00 2001 From: Thomas Date: Fri, 28 Mar 2025 16:42:59 +0100 Subject: [PATCH] #1122 - Support instance only for GoToSocial --- .../mastodon/client/endpoints/MastodonStatusesService.java | 3 ++- .../app/fedilab/android/mastodon/jobs/ComposeWorker.java | 2 +- .../android/mastodon/viewmodel/mastodon/StatusesVM.java | 5 +++-- .../android/peertube/activities/PeertubeActivity.java | 4 ++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/app/fedilab/android/mastodon/client/endpoints/MastodonStatusesService.java b/app/src/main/java/app/fedilab/android/mastodon/client/endpoints/MastodonStatusesService.java index 3c43dc9b..0095aea5 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/client/endpoints/MastodonStatusesService.java +++ b/app/src/main/java/app/fedilab/android/mastodon/client/endpoints/MastodonStatusesService.java @@ -65,7 +65,8 @@ public interface MastodonStatusesService { @Field("visibility") String visibility, @Field("language") String language, @Field("quote_id") String quote_id, - @Field("content_type") String content_type + @Field("content_type") String content_type, + @Field("local_only") Boolean local_only ); @GET("statuses/{id}/source") diff --git a/app/src/main/java/app/fedilab/android/mastodon/jobs/ComposeWorker.java b/app/src/main/java/app/fedilab/android/mastodon/jobs/ComposeWorker.java index 34eb74b1..42e1d8e0 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/jobs/ComposeWorker.java +++ b/app/src/main/java/app/fedilab/android/mastodon/jobs/ComposeWorker.java @@ -272,7 +272,7 @@ public class ComposeWorker extends Worker { if (dataPost.scheduledDate == null) { if (dataPost.statusEditId == null) { statusCall = mastodonStatusesService.createStatus(null, dataPost.token, statuses.get(i).text, attachmentIds, poll_options, poll_expire_in, - poll_multiple, poll_hide_totals, statuses.get(i).quote_id == null ? in_reply_to_status : null, statuses.get(i).sensitive, statuses.get(i).spoilerChecked ? statuses.get(i).spoiler_text : null, statuses.get(i).visibility.toLowerCase(), statuses.get(i).language, statuses.get(i).quote_id, statuses.get(i).content_type); + poll_multiple, poll_hide_totals, statuses.get(i).quote_id == null ? in_reply_to_status : null, statuses.get(i).sensitive, statuses.get(i).spoilerChecked ? statuses.get(i).spoiler_text : null, statuses.get(i).visibility.toLowerCase(), statuses.get(i).language, statuses.get(i).quote_id, statuses.get(i).content_type, statuses.get(i).local_only); } else { //Status is edited StatusParams statusParams = new StatusParams(); statusParams.status = statuses.get(i).text; diff --git a/app/src/main/java/app/fedilab/android/mastodon/viewmodel/mastodon/StatusesVM.java b/app/src/main/java/app/fedilab/android/mastodon/viewmodel/mastodon/StatusesVM.java index 77f13ecc..29e81627 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/viewmodel/mastodon/StatusesVM.java +++ b/app/src/main/java/app/fedilab/android/mastodon/viewmodel/mastodon/StatusesVM.java @@ -189,12 +189,13 @@ public class StatusesVM extends AndroidViewModel { String visibility, String language, String quote_id, - String content_type) { + String content_type, + Boolean local_only) { MastodonStatusesService mastodonStatusesService = init(instance); statusMutableLiveData = new MutableLiveData<>(); new Thread(() -> { Call statusCall = mastodonStatusesService.createStatus(idempotency_Key, token, text, media_ids, poll_options, poll_expire_in, - poll_multiple, poll_hide_totals, in_reply_to_id, sensitive, spoiler_text, visibility, language, quote_id, content_type); + poll_multiple, poll_hide_totals, in_reply_to_id, sensitive, spoiler_text, visibility, language, quote_id, content_type, local_only); Status status = null; if (statusCall != null) { try { diff --git a/app/src/main/java/app/fedilab/android/peertube/activities/PeertubeActivity.java b/app/src/main/java/app/fedilab/android/peertube/activities/PeertubeActivity.java index 802f87d2..8ee0d0f5 100644 --- a/app/src/main/java/app/fedilab/android/peertube/activities/PeertubeActivity.java +++ b/app/src/main/java/app/fedilab/android/peertube/activities/PeertubeActivity.java @@ -2046,7 +2046,7 @@ public class PeertubeActivity extends BasePeertubeActivity implements CommentLis viewModelComment.comment(ADD_COMMENT, peertube.getId(), null, commentStr).observe(PeertubeActivity.this, apiResponse1 -> manageVIewPostActions(ADD_COMMENT, 0, apiResponse1)); } else {//Remote account is posting a message StatusesVM statusesVM = new ViewModelProvider(PeertubeActivity.this).get(StatusesVM.class); - statusesVM.postStatus(currentInstance, currentToken, null, commentStr, null, null, null, null, null, status.id, false, null, "public", null, null, null).observe(PeertubeActivity.this, this::manageVIewPostActionsMastodon); + statusesVM.postStatus(currentInstance, currentToken, null, commentStr, null, null, null, null, null, status.id, false, null, "public", null, null, null, null).observe(PeertubeActivity.this, this::manageVIewPostActionsMastodon); } binding.addCommentWrite.setText(""); } @@ -2058,7 +2058,7 @@ public class PeertubeActivity extends BasePeertubeActivity implements CommentLis viewModelComment.comment(REPLY, peertube.getId(), comment.getId(), commentView).observe(PeertubeActivity.this, apiResponse1 -> manageVIewPostActions(REPLY, position, apiResponse1)); } else {//Remote account is posting a message StatusesVM statusesVM = new ViewModelProvider(PeertubeActivity.this).get(StatusesVM.class); - statusesVM.postStatus(currentInstance, currentToken, null, commentView, null, null, null, null, null, status.id, false, null, "public", null, null, null).observe(PeertubeActivity.this, this::manageVIewPostActionsMastodon); + statusesVM.postStatus(currentInstance, currentToken, null, commentView, null, null, null, null, null, status.id, false, null, "public", null, null, null, null).observe(PeertubeActivity.this, this::manageVIewPostActionsMastodon); } binding.addCommentWrite.setText(""); }