From f048eea4e1130c53792d55e6998093f091697439 Mon Sep 17 00:00:00 2001 From: stom79 Date: Sun, 20 Jan 2019 15:20:07 +0100 Subject: Schedule update remove --- .../etalab/mastodon/asynctasks/PostActionAsyncTask.java | 16 +++++++++++++++- .../mastodon/asynctasks/RetrieveFeedsAsyncTask.java | 2 +- 2 files changed, 16 insertions(+), 2 deletions(-) (limited to 'app/src/main/java/fr/gouv/etalab/mastodon/asynctasks') diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/asynctasks/PostActionAsyncTask.java b/app/src/main/java/fr/gouv/etalab/mastodon/asynctasks/PostActionAsyncTask.java index 727da13b6..35a295b52 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/asynctasks/PostActionAsyncTask.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/asynctasks/PostActionAsyncTask.java @@ -25,6 +25,7 @@ import fr.gouv.etalab.mastodon.client.API; import fr.gouv.etalab.mastodon.client.Entities.Account; import fr.gouv.etalab.mastodon.client.Entities.Error; import fr.gouv.etalab.mastodon.client.Entities.Results; +import fr.gouv.etalab.mastodon.client.Entities.StoredStatus; import fr.gouv.etalab.mastodon.client.PeertubeAPI; import fr.gouv.etalab.mastodon.helper.Helper; import fr.gouv.etalab.mastodon.interfaces.OnPostActionInterface; @@ -48,6 +49,14 @@ public class PostActionAsyncTask extends AsyncTask { private WeakReference contextReference; private boolean muteNotifications; private Error error; + private StoredStatus storedStatus; + + public PostActionAsyncTask(Context context, API.StatusAction apiAction, StoredStatus storedStatus, OnPostActionInterface onPostActionInterface){ + this.contextReference = new WeakReference<>(context); + this.listener = onPostActionInterface; + this.apiAction = apiAction; + this.storedStatus = storedStatus; + } public PostActionAsyncTask(Context context, API.StatusAction apiAction, String targetedId, OnPostActionInterface onPostActionInterface){ this.contextReference = new WeakReference<>(context); @@ -154,7 +163,12 @@ public class PostActionAsyncTask extends AsyncTask { statusCode = api.reportAction(status, comment); else if (apiAction == API.StatusAction.CREATESTATUS) statusCode = api.statusAction(status); - else if (apiAction == API.StatusAction.MUTE_NOTIFICATIONS) + else if(apiAction == API.StatusAction.UPDATESERVERSCHEDULE) { + api.scheduledAction("PUT", storedStatus.getStatus(), null, storedStatus.getScheduledServerdId()); + } + else if(apiAction == API.StatusAction.DELETESCHEDULED) { + api.scheduledAction("DELETE", null, null, storedStatus.getScheduledServerdId()); + }else if (apiAction == API.StatusAction.MUTE_NOTIFICATIONS) statusCode = api.muteNotifications(targetedId, muteNotifications); else statusCode = api.postAction(apiAction, targetedId); diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/asynctasks/RetrieveFeedsAsyncTask.java b/app/src/main/java/fr/gouv/etalab/mastodon/asynctasks/RetrieveFeedsAsyncTask.java index 8855b2b78..5fd4d78cd 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/asynctasks/RetrieveFeedsAsyncTask.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/asynctasks/RetrieveFeedsAsyncTask.java @@ -170,7 +170,7 @@ public class RetrieveFeedsAsyncTask extends AsyncTask { apiResponse = api.getPublicTimeline(false, max_id); break; case SCHEDULED_TOOTS: - apiResponse = api.scheduledAction("GET", null, max_id); + apiResponse = api.scheduledAction("GET", null, max_id, null); break; case DIRECT: apiResponse = api.getDirectTimeline(max_id); -- cgit v1.2.3