summaryrefslogtreecommitdiffstats
path: root/app/src/main/java/fr/gouv/etalab/mastodon/asynctasks
diff options
context:
space:
mode:
authorstom79 <tschneider.ac@gmail.com>2019-01-20 15:20:07 +0100
committerstom79 <tschneider.ac@gmail.com>2019-01-20 15:20:07 +0100
commitf048eea4e1130c53792d55e6998093f091697439 (patch)
treef197a0181a9f79cacd78ef2dee5bea846dd29e61 /app/src/main/java/fr/gouv/etalab/mastodon/asynctasks
parent284c118dafe19fc554de941cc70a8d6f1c40a62d (diff)
Schedule update remove
Diffstat (limited to 'app/src/main/java/fr/gouv/etalab/mastodon/asynctasks')
-rw-r--r--app/src/main/java/fr/gouv/etalab/mastodon/asynctasks/PostActionAsyncTask.java16
-rw-r--r--app/src/main/java/fr/gouv/etalab/mastodon/asynctasks/RetrieveFeedsAsyncTask.java2
2 files changed, 16 insertions, 2 deletions
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<Void, Void, Void> {
private WeakReference<Context> 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<Void, Void, Void> {
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<Void, Void, Void> {
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);