diff --git a/app/src/acad/res/values/strings.xml b/app/src/acad/res/values/strings.xml
index 00fc2e0..4e38387 100644
--- a/app/src/acad/res/values/strings.xml
+++ b/app/src/acad/res/values/strings.xml
@@ -8,7 +8,8 @@
set_video_cache_choice
set_theme_choice
-
+ Supprimer tous les commentaires
+ Etes-vous sûr de vouloir supprimer tous les commentaires de ce compte pour vos vidéos ?
- Clair
- Sombre
diff --git a/app/src/fdroid_acad/play/release-notes/en-US/default.txt b/app/src/fdroid_acad/play/release-notes/en-US/default.txt
index 68b543d..7c23d7c 100644
--- a/app/src/fdroid_acad/play/release-notes/en-US/default.txt
+++ b/app/src/fdroid_acad/play/release-notes/en-US/default.txt
@@ -1 +1,3 @@
-- Corrige un bug lors de la connexion
\ No newline at end of file
+- Theme: Clair, Sombre et automatique
+- Supprimer tous les commentaires d'un compte sur vos vidéos
+- Mettre en sourdine un compte depuis les commentaires.
\ No newline at end of file
diff --git a/app/src/fdroid_full/play/release-notes/en-US/default.txt b/app/src/fdroid_full/play/release-notes/en-US/default.txt
index 1902cc9..e2a6ea8 100644
--- a/app/src/fdroid_full/play/release-notes/en-US/default.txt
+++ b/app/src/fdroid_full/play/release-notes/en-US/default.txt
@@ -1 +1,6 @@
-- Fix an issue with the authentication of some accounts
\ No newline at end of file
+- Theme: Light, Dark and auto
+- Remove all comments of an account on your videos
+- Sepia search: Allow interactions when the video is federated
+- Mute accounts from comments
+- Fix all comments not displayed
+- Fix some minor other bugs
\ No newline at end of file
diff --git a/app/src/full/res/values/strings.xml b/app/src/full/res/values/strings.xml
index 2da3caa..e518607 100644
--- a/app/src/full/res/values/strings.xml
+++ b/app/src/full/res/values/strings.xml
@@ -193,6 +193,8 @@
None
Allows to change mode for playing videos (default, streaming or via a browser).
+ Delete account comments
+ Are you sure you want to remove all the comments of this account?
Delete video
Are you sure to delete this video?
diff --git a/app/src/main/java/app/fedilab/fedilabtube/PeertubeActivity.java b/app/src/main/java/app/fedilab/fedilabtube/PeertubeActivity.java
index 71407e8..2096c3f 100644
--- a/app/src/main/java/app/fedilab/fedilabtube/PeertubeActivity.java
+++ b/app/src/main/java/app/fedilab/fedilabtube/PeertubeActivity.java
@@ -32,7 +32,6 @@ import android.os.Handler;
import android.support.v4.media.session.MediaSessionCompat;
import android.text.Html;
import android.view.LayoutInflater;
-import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
@@ -46,7 +45,6 @@ import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
-import android.widget.ScrollView;
import android.widget.TextView;
import android.widget.Toast;
@@ -59,6 +57,7 @@ import androidx.appcompat.widget.PopupMenu;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.core.graphics.drawable.DrawableCompat;
+import androidx.core.widget.NestedScrollView;
import androidx.lifecycle.ViewModelProvider;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
@@ -137,7 +136,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
private FullScreenMediaController.fullscreen fullscreen;
private RelativeLayout loader;
private TextView peertube_view_count, peertube_playlist, peertube_bookmark, peertube_like_count, peertube_dislike_count, peertube_description, peertube_title, more_actions;
- private ScrollView peertube_information_container;
+ private NestedScrollView peertube_information_container;
private VideoData.Video peertube;
private PlayerView playerView;
private SimpleExoPlayer player;
@@ -288,7 +287,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
flag_loading = true;
comments = new ArrayList<>();
lv_comments = findViewById(R.id.peertube_comments);
- commentListAdapter = new CommentListAdapter(comments);
+ commentListAdapter = new CommentListAdapter(comments, Helper.isVideoOwner(PeertubeActivity.this, peertube));
commentListAdapter.allCommentRemoved = PeertubeActivity.this;
LinearLayoutManager mLayoutManager = new LinearLayoutManager(PeertubeActivity.this);
lv_comments.setLayoutManager(mLayoutManager);
@@ -419,11 +418,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
return super.dispatchTouchEvent(ev);
}
- @Override
- public boolean onCreateOptionsMenu(@NotNull Menu menu) {
- getMenuInflater().inflate(R.menu.main_peertube, menu);
- return true;
- }
@Override
public boolean onOptionsItemSelected(MenuItem item) {
@@ -434,19 +428,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
finish();
}
return true;
- } else if (item.getItemId() == R.id.action_report) {
- androidx.appcompat.app.AlertDialog.Builder dialogBuilder = new androidx.appcompat.app.AlertDialog.Builder(PeertubeActivity.this);
- LayoutInflater inflater1 = getLayoutInflater();
- View dialogView = inflater1.inflate(R.layout.popup_report_choice, new LinearLayout(PeertubeActivity.this), false);
- dialogBuilder.setView(dialogView);
- Button report_video = dialogView.findViewById(R.id.report_video);
- Button report_account = dialogView.findViewById(R.id.report_account);
- dialogBuilder.setNeutralButton(R.string.cancel, (dialog, id) -> dialog.dismiss());
- androidx.appcompat.app.AlertDialog alertDialog = dialogBuilder.create();
- alertDialog.show();
- report_video.setOnClickListener(v -> reportAlert(REPORT_VIDEO, alertDialog));
- report_account.setOnClickListener(v -> reportAlert(REPORT_ACCOUNT, alertDialog));
- return true;
}
return super.onOptionsItemSelected(item);
}
@@ -815,6 +796,20 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
alertDialog.show();
break;
+
+ case R.id.action_report:
+ dialogBuilder = new androidx.appcompat.app.AlertDialog.Builder(PeertubeActivity.this);
+ LayoutInflater inflater1 = getLayoutInflater();
+ View dialogView = inflater1.inflate(R.layout.popup_report_choice, new LinearLayout(PeertubeActivity.this), false);
+ dialogBuilder.setView(dialogView);
+ Button report_video = dialogView.findViewById(R.id.report_video);
+ Button report_account = dialogView.findViewById(R.id.report_account);
+ dialogBuilder.setNeutralButton(R.string.cancel, (dialog, id) -> dialog.dismiss());
+ alertDialog = dialogBuilder.create();
+ alertDialog.show();
+ report_video.setOnClickListener(v -> reportAlert(REPORT_VIDEO, alertDialog));
+ report_account.setOnClickListener(v -> reportAlert(REPORT_ACCOUNT, alertDialog));
+ break;
}
return true;
});
diff --git a/app/src/main/java/app/fedilab/fedilabtube/client/PeertubeService.java b/app/src/main/java/app/fedilab/fedilabtube/client/PeertubeService.java
index 0802c1d..bcffbe5 100644
--- a/app/src/main/java/app/fedilab/fedilabtube/client/PeertubeService.java
+++ b/app/src/main/java/app/fedilab/fedilabtube/client/PeertubeService.java
@@ -341,9 +341,12 @@ public interface PeertubeService {
@DELETE("videos/{id}/comments/{commentId}")
Call deleteComment(@Header("Authorization") String credentials, @Path("id") String id, @Path("commentId") String commentId);
+ @POST("bulk/remove-comments-of")
+ Call deleteAllCommentForAccount(@Header("Authorization") String credentials, @Field("accountName") String accountName, @Field("scope") String scope);
+
@Headers({"Content-Type: application/json", "Cache-Control: max-age=640000"})
@POST("abuses")
- Call report(
+ Call report(
@Header("Authorization") String credentials,
@Body Report report);
diff --git a/app/src/main/java/app/fedilab/fedilabtube/client/RetrofitPeertubeAPI.java b/app/src/main/java/app/fedilab/fedilabtube/client/RetrofitPeertubeAPI.java
index afa1d30..a05342f 100644
--- a/app/src/main/java/app/fedilab/fedilabtube/client/RetrofitPeertubeAPI.java
+++ b/app/src/main/java/app/fedilab/fedilabtube/client/RetrofitPeertubeAPI.java
@@ -692,12 +692,12 @@ public class RetrofitPeertubeAPI {
public APIResponse report(Report report) {
PeertubeService peertubeService = init();
- Call report1 = peertubeService.report(getToken(), report);
+ Call report1 = peertubeService.report(getToken(), report);
APIResponse apiResponse = new APIResponse();
try {
- Response response = report1.execute();
- if (response.isSuccessful()) {
- apiResponse.setActionReturn(response.body());
+ Response response = report1.execute();
+ if (response.isSuccessful() && response.body() != null) {
+ apiResponse.setActionReturn(response.body().getItemStr().getLabel());
} else {
setError(apiResponse, response.code(), response.errorBody());
}
@@ -816,6 +816,9 @@ public class RetrofitPeertubeAPI {
case PEERTUBEDELETECOMMENT:
postCall = peertubeService.deleteComment(getToken(), id, element);
break;
+ case PEERTUBE_DELETE_ALL_COMMENT_FOR_ACCOUNT:
+ postCall = peertubeService.deleteAllCommentForAccount(getToken(), id, element);
+ break;
case DELETE_CHANNEL:
postCall = peertubeService.deleteChannel(getToken(), id);
break;
@@ -1384,6 +1387,7 @@ public class RetrofitPeertubeAPI {
UNMUTE,
RATEVIDEO,
PEERTUBEDELETECOMMENT,
+ PEERTUBE_DELETE_ALL_COMMENT_FOR_ACCOUNT,
PEERTUBEDELETEVIDEO,
REPORT_VIDEO,
REPORT_ACCOUNT,
diff --git a/app/src/main/java/app/fedilab/fedilabtube/client/entities/Report.java b/app/src/main/java/app/fedilab/fedilabtube/client/entities/Report.java
index 5b7968a..e708f1c 100644
--- a/app/src/main/java/app/fedilab/fedilabtube/client/entities/Report.java
+++ b/app/src/main/java/app/fedilab/fedilabtube/client/entities/Report.java
@@ -131,4 +131,17 @@ public class Report {
this.id = id;
}
}
+
+ public static class ReportReturn {
+ @SerializedName("abuse")
+ private ItemStr reply;
+
+ public ItemStr getItemStr() {
+ return reply;
+ }
+
+ public void setItemStr(ItemStr itemStr) {
+ this.reply = itemStr;
+ }
+ }
}
diff --git a/app/src/main/java/app/fedilab/fedilabtube/drawer/CommentListAdapter.java b/app/src/main/java/app/fedilab/fedilabtube/drawer/CommentListAdapter.java
index 2f7f1c1..431ece9 100644
--- a/app/src/main/java/app/fedilab/fedilabtube/drawer/CommentListAdapter.java
+++ b/app/src/main/java/app/fedilab/fedilabtube/drawer/CommentListAdapter.java
@@ -49,6 +49,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import app.fedilab.fedilabtube.R;
+import app.fedilab.fedilabtube.ShowAccountActivity;
import app.fedilab.fedilabtube.client.APIResponse;
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
import app.fedilab.fedilabtube.client.data.CommentData.Comment;
@@ -57,6 +58,8 @@ import app.fedilab.fedilabtube.helper.Helper;
import app.fedilab.fedilabtube.viewmodel.PostActionsVM;
import es.dmoral.toasty.Toasty;
+import static app.fedilab.fedilabtube.client.RetrofitPeertubeAPI.ActionType.MUTE;
+
public class CommentListAdapter extends RecyclerView.Adapter {
@@ -65,10 +68,12 @@ public class CommentListAdapter extends RecyclerView.Adapter comments;
private CommentListAdapter commentListAdapter;
+ boolean isVideoOwner;
- public CommentListAdapter(List comments) {
+ public CommentListAdapter(List comments, boolean isVideoOwner) {
this.comments = comments;
commentListAdapter = this;
+ this.isVideoOwner = isVideoOwner;
}
@Override
@@ -112,6 +117,18 @@ public class CommentListAdapter extends RecyclerView.Adapter {
switch (item.getItemId()) {
@@ -142,6 +159,39 @@ public class CommentListAdapter extends RecyclerView.Adapter manageVIewPostActions(MUTE, apiResponse));
+ comments.remove(comment);
+ notifyDataSetChanged();
+ if (comments.size() == 0) {
+ allCommentRemoved.onAllCommentRemoved();
+ }
+ break;
+ case R.id.action_remove_comments:
+ builder = new android.app.AlertDialog.Builder(context);
+ builder.setTitle(R.string.delete_account_comment);
+ builder.setMessage(R.string.delete_account_comment_confirm);
+ builder.setIcon(android.R.drawable.ic_dialog_alert)
+ .setPositiveButton(R.string.delete, (dialog, which) -> {
+ new Thread(() -> {
+ new RetrofitPeertubeAPI(context).post(RetrofitPeertubeAPI.ActionType.PEERTUBE_DELETE_ALL_COMMENT_FOR_ACCOUNT, comment.getAccount().getAcct(), "my-videos");
+ Handler mainHandler = new Handler(Looper.getMainLooper());
+ Runnable myRunnable = () -> {
+ comments.remove(comment);
+ notifyDataSetChanged();
+ if (comments.size() == 0) {
+ allCommentRemoved.onAllCommentRemoved();
+ }
+ };
+ mainHandler.post(myRunnable);
+ }).start();
+
+ dialog.dismiss();
+ })
+ .setNegativeButton(R.string.no, (dialog, which) -> dialog.dismiss())
+ .show();
+ break;
}
return true;
});
@@ -208,6 +258,8 @@ public class CommentListAdapter extends RecyclerView.Adapter
-
-
+
+
+
-
-
diff --git a/app/src/main/res/menu/main_video.xml b/app/src/main/res/menu/main_video.xml
index c25b682..93a8377 100644
--- a/app/src/main/res/menu/main_video.xml
+++ b/app/src/main/res/menu/main_video.xml
@@ -16,4 +16,9 @@
android:icon="@drawable/ic_baseline_subtitles_24"
android:title="@string/captions"
app:showAsAction="ifRoom" />
+