diff options
Diffstat (limited to 'app/src/main/java/fr/gouv/etalab/mastodon/asynctasks/RetrieveAccountsAsyncTask.java')
-rw-r--r-- | app/src/main/java/fr/gouv/etalab/mastodon/asynctasks/RetrieveAccountsAsyncTask.java | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/asynctasks/RetrieveAccountsAsyncTask.java b/app/src/main/java/fr/gouv/etalab/mastodon/asynctasks/RetrieveAccountsAsyncTask.java index 8b88e0784..2a20d533c 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/asynctasks/RetrieveAccountsAsyncTask.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/asynctasks/RetrieveAccountsAsyncTask.java @@ -37,12 +37,24 @@ public class RetrieveAccountsAsyncTask extends AsyncTask<Void, Void, Void> { private OnRetrieveAccountsInterface listener; private String targetedId; private WeakReference<Context> contextReference; + private String instance, name; public enum Type{ BLOCKED, MUTED, FOLLOWING, - FOLLOWERS + FOLLOWERS, + CHANNELS, + REBLOGGED, + FAVOURITED + } + + public RetrieveAccountsAsyncTask(Context context, String instance, String name, OnRetrieveAccountsInterface onRetrieveAccountsInterface){ + this.contextReference = new WeakReference<>(context); + this.instance = instance; + this.name = name; + this.listener = onRetrieveAccountsInterface; + this.action = Type.CHANNELS; } public RetrieveAccountsAsyncTask(Context context, Type action, String targetedId, String max_id, OnRetrieveAccountsInterface onRetrieveAccountsInterface){ @@ -65,6 +77,12 @@ public class RetrieveAccountsAsyncTask extends AsyncTask<Void, Void, Void> { API api = new API(this.contextReference.get()); switch (action){ + case REBLOGGED: + apiResponse = api.getRebloggedBy(targetedId, max_id); + break; + case FAVOURITED: + apiResponse = api.getFavouritedBy(targetedId, max_id); + break; case BLOCKED: apiResponse = api.getBlocks(max_id); break; @@ -77,6 +95,9 @@ public class RetrieveAccountsAsyncTask extends AsyncTask<Void, Void, Void> { case FOLLOWERS: apiResponse = api.getFollowers(targetedId, max_id); break; + case CHANNELS: + apiResponse = api.getPeertubeChannel(instance, name); + break; } return null; } |