Censor videos having youtube + download in their title (Google Play release only).

This commit is contained in:
Thomas 2020-10-10 15:21:46 +02:00
parent 8dddfc5497
commit 0127b9bffa
2 changed files with 24 additions and 2 deletions

View File

@ -39,6 +39,7 @@ import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
import app.fedilab.fedilabtube.BuildConfig;
import app.fedilab.fedilabtube.R;
import app.fedilab.fedilabtube.client.data.VideoData;
import app.fedilab.fedilabtube.client.entities.SepiaSearch;
@ -215,7 +216,17 @@ public class DisplaySepiaSearchFragment extends Fragment implements AccountsHori
int previousPosition = this.peertubes.size();
int videoPerPage = sharedpreferences.getInt(Helper.SET_VIDEOS_PER_PAGE, Helper.VIDEOS_PER_PAGE);
sepiaSearchVideo.setStart(String.valueOf(Integer.parseInt(sepiaSearchVideo.getStart())+ videoPerPage));
this.peertubes.addAll(videoData.data);
if(!BuildConfig.google_restriction) {
this.peertubes.addAll(videoData.data);
}else{
for(VideoData.Video video: videoData.data) {
if ( video.getName() == null || !video.getName().toLowerCase().contains("youtube") || !video.getName().toLowerCase().contains("download")) {
this.peertubes.add(video);
}
}
}
//If no item were inserted previously the adapter is created
if (previousPosition == 0) {
peertubeAdapater = new PeertubeAdapter(this.peertubes, SEPIA_SEARCH, true);

View File

@ -46,6 +46,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import app.fedilab.fedilabtube.BuildConfig;
import app.fedilab.fedilabtube.MainActivity;
import app.fedilab.fedilabtube.R;
import app.fedilab.fedilabtube.client.APIResponse;
@ -334,7 +335,17 @@ public class DisplayVideosFragment extends Fragment implements AccountsHorizonta
apiResponse.getPeertubes().add(v.getVideo());
}
}
this.peertubes.addAll(apiResponse.getPeertubes());
if(!BuildConfig.google_restriction) {
this.peertubes.addAll(apiResponse.getPeertubes());
}else{
for(VideoData.Video video: apiResponse.getPeertubes()) {
if ( video.getName() == null || !video.getName().toLowerCase().contains("youtube") || !video.getName().toLowerCase().contains("download")) {
this.peertubes.add(video);
}
}
}
//If no item were inserted previously the adapter is created
if (previousPosition == 0) {
peertubeAdapater = new PeertubeAdapter(this.peertubes, type, sepiaSearch);