style: naming for ReturnYouTubeDislike patch

This commit is contained in:
oSumAtrIX 2022-07-16 17:42:51 +02:00
parent 7e236b01fb
commit fb102cfafe
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4
9 changed files with 65 additions and 65 deletions

View File

@ -2,7 +2,7 @@ package app.revanced.integrations.patches;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import app.revanced.integrations.ryd.ReturnYouTubeDislikes; import app.revanced.integrations.returnyoutubedislike.ReturnYouTubeDislike;
/** /**
* Used by app.revanced.patches.youtube.layout.returnyoutubedislikes.patch.RYDPatch * Used by app.revanced.patches.youtube.layout.returnyoutubedislikes.patch.RYDPatch
@ -13,14 +13,14 @@ public class ReturnYouTubeDislikesPatch {
* Called when the video id changes * Called when the video id changes
*/ */
public static void newVideoLoaded(String videoId) { public static void newVideoLoaded(String videoId) {
ReturnYouTubeDislikes.newVideoLoaded(videoId); ReturnYouTubeDislike.newVideoLoaded(videoId);
} }
/** /**
* Called when a litho text component is created * Called when a litho text component is created
*/ */
public static void onComponentCreated(Object conversionContext, AtomicReference<Object> textRef) { public static void onComponentCreated(Object conversionContext, AtomicReference<Object> textRef) {
ReturnYouTubeDislikes.onComponentCreated(conversionContext, textRef); ReturnYouTubeDislike.onComponentCreated(conversionContext, textRef);
} }
/** /**
@ -28,6 +28,6 @@ public class ReturnYouTubeDislikesPatch {
* @param vote -1 (dislike), 0 (none) or 1 (like) * @param vote -1 (dislike), 0 (none) or 1 (like)
*/ */
public static void sendVote(int vote) { public static void sendVote(int vote) {
ReturnYouTubeDislikes.sendVote(vote); ReturnYouTubeDislike.sendVote(vote);
} }
} }

View File

@ -1,4 +1,4 @@
package app.revanced.integrations.ryd; package app.revanced.integrations.returnyoutubedislike;
import android.util.Base64; import android.util.Base64;
@ -8,7 +8,7 @@ import java.security.SecureRandom;
import app.revanced.integrations.settings.SettingsEnum; import app.revanced.integrations.settings.SettingsEnum;
import app.revanced.integrations.utils.LogHelper; import app.revanced.integrations.utils.LogHelper;
import app.revanced.integrations.ryd.requests.RYDRequester; import app.revanced.integrations.returnyoutubedislike.requests.ReturnYouTubeDislikeApi;
public class Registration { public class Registration {
@ -58,7 +58,7 @@ public class Registration {
private String register() { private String register() {
String userId = randomString(36); String userId = randomString(36);
LogHelper.debug(Registration.class, "Trying to register the following userId: " + userId); LogHelper.debug(Registration.class, "Trying to register the following userId: " + userId);
return RYDRequester.register(userId, this); return ReturnYouTubeDislikeApi.register(userId, this);
} }
private String randomString(int len) { private String randomString(int len) {

View File

@ -1,4 +1,4 @@
package app.revanced.integrations.ryd; package app.revanced.integrations.returnyoutubedislike;
import static app.revanced.integrations.videoplayer.VideoInformation.currentVideoId; import static app.revanced.integrations.videoplayer.VideoInformation.currentVideoId;
import static app.revanced.integrations.videoplayer.VideoInformation.dislikeCount; import static app.revanced.integrations.videoplayer.VideoInformation.dislikeCount;
@ -12,13 +12,13 @@ import java.util.Locale;
import java.util.Objects; import java.util.Objects;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import app.revanced.integrations.ryd.requests.RYDRequester; import app.revanced.integrations.returnyoutubedislike.requests.ReturnYouTubeDislikeApi;
import app.revanced.integrations.settings.SettingsEnum; import app.revanced.integrations.settings.SettingsEnum;
import app.revanced.integrations.utils.LogHelper; import app.revanced.integrations.utils.LogHelper;
import app.revanced.integrations.utils.ReVancedUtils; import app.revanced.integrations.utils.ReVancedUtils;
import app.revanced.integrations.utils.SharedPrefHelper; import app.revanced.integrations.utils.SharedPrefHelper;
public class ReturnYouTubeDislikes { public class ReturnYouTubeDislike {
private static boolean isEnabled; private static boolean isEnabled;
private static Thread _dislikeFetchThread = null; private static Thread _dislikeFetchThread = null;
private static Thread _votingThread = null; private static Thread _votingThread = null;
@ -35,7 +35,7 @@ public class ReturnYouTubeDislikes {
} }
Locale locale = context.getResources().getConfiguration().locale; Locale locale = context.getResources().getConfiguration().locale;
LogHelper.debug(ReturnYouTubeDislikes.class, "locale - " + locale); LogHelper.debug(ReturnYouTubeDislike.class, "locale - " + locale);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
compactNumberFormatter = CompactDecimalFormat.getInstance( compactNumberFormatter = CompactDecimalFormat.getInstance(
locale, locale,
@ -55,21 +55,21 @@ public class ReturnYouTubeDislikes {
} }
public static void newVideoLoaded(String videoId) { public static void newVideoLoaded(String videoId) {
LogHelper.debug(ReturnYouTubeDislikes.class, "newVideoLoaded - " + videoId); LogHelper.debug(ReturnYouTubeDislike.class, "newVideoLoaded - " + videoId);
dislikeCount = null; dislikeCount = null;
if (!isEnabled) return; if (!isEnabled) return;
try { try {
if (_dislikeFetchThread != null && _dislikeFetchThread.getState() != Thread.State.TERMINATED) { if (_dislikeFetchThread != null && _dislikeFetchThread.getState() != Thread.State.TERMINATED) {
LogHelper.debug(ReturnYouTubeDislikes.class, "Interrupting the thread. Current state " + _dislikeFetchThread.getState()); LogHelper.debug(ReturnYouTubeDislike.class, "Interrupting the thread. Current state " + _dislikeFetchThread.getState());
_dislikeFetchThread.interrupt(); _dislikeFetchThread.interrupt();
} }
} catch (Exception ex) { } catch (Exception ex) {
LogHelper.printException(ReturnYouTubeDislikes.class, "Error in the dislike fetch thread", ex); LogHelper.printException(ReturnYouTubeDislike.class, "Error in the dislike fetch thread", ex);
} }
_dislikeFetchThread = new Thread(() -> RYDRequester.fetchDislikes(videoId)); _dislikeFetchThread = new Thread(() -> ReturnYouTubeDislikeApi.fetchDislikes(videoId));
_dislikeFetchThread.start(); _dislikeFetchThread.start();
} }
@ -80,7 +80,7 @@ public class ReturnYouTubeDislikes {
// Contains a pathBuilder string, used to distinguish from other litho components // Contains a pathBuilder string, used to distinguish from other litho components
if (!conversionContext.toString().contains("dislike_button")) return; if (!conversionContext.toString().contains("dislike_button")) return;
LogHelper.debug(ReturnYouTubeDislikes.class, "dislike button was created"); LogHelper.debug(ReturnYouTubeDislike.class, "dislike button was created");
// Have to block the current thread until fetching is done // Have to block the current thread until fetching is done
// There's no known way to edit the text after creation yet // There's no known way to edit the text after creation yet
@ -90,7 +90,7 @@ public class ReturnYouTubeDislikes {
updateDislikeText(textRef, formatDislikes(dislikeCount)); updateDislikeText(textRef, formatDislikes(dislikeCount));
} }
} catch (Exception ex) { } catch (Exception ex) {
LogHelper.printException(ReturnYouTubeDislikes.class, "Error while trying to set dislikes text", ex); LogHelper.printException(ReturnYouTubeDislike.class, "Error while trying to set dislikes text", ex);
} }
} }
@ -101,22 +101,22 @@ public class ReturnYouTubeDislikes {
if (SharedPrefHelper.getBoolean(Objects.requireNonNull(context), SharedPrefHelper.SharedPrefNames.YOUTUBE, "user_signed_out", true)) if (SharedPrefHelper.getBoolean(Objects.requireNonNull(context), SharedPrefHelper.SharedPrefNames.YOUTUBE, "user_signed_out", true))
return; return;
LogHelper.debug(ReturnYouTubeDislikes.class, "sending vote - " + vote + " for video " + currentVideoId); LogHelper.debug(ReturnYouTubeDislike.class, "sending vote - " + vote + " for video " + currentVideoId);
try { try {
if (_votingThread != null && _votingThread.getState() != Thread.State.TERMINATED) { if (_votingThread != null && _votingThread.getState() != Thread.State.TERMINATED) {
LogHelper.debug(ReturnYouTubeDislikes.class, "Interrupting the thread. Current state " + _votingThread.getState()); LogHelper.debug(ReturnYouTubeDislike.class, "Interrupting the thread. Current state " + _votingThread.getState());
_votingThread.interrupt(); _votingThread.interrupt();
} }
} catch (Exception ex) { } catch (Exception ex) {
LogHelper.printException(ReturnYouTubeDislikes.class, "Error in the voting thread", ex); LogHelper.printException(ReturnYouTubeDislike.class, "Error in the voting thread", ex);
} }
_votingThread = new Thread(() -> { _votingThread = new Thread(() -> {
try { try {
boolean result = voting.sendVote(currentVideoId, vote); boolean result = voting.sendVote(currentVideoId, vote);
LogHelper.debug(ReturnYouTubeDislikes.class, "sendVote status " + result); LogHelper.debug(ReturnYouTubeDislike.class, "sendVote status " + result);
} catch (Exception ex) { } catch (Exception ex) {
LogHelper.printException(ReturnYouTubeDislikes.class, "Failed to send vote", ex); LogHelper.printException(ReturnYouTubeDislike.class, "Failed to send vote", ex);
} }
}); });
_votingThread.start(); _votingThread.start();
@ -139,10 +139,10 @@ public class ReturnYouTubeDislikes {
private static String formatDislikes(int dislikes) { private static String formatDislikes(int dislikes) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && compactNumberFormatter != null) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && compactNumberFormatter != null) {
final String formatted = compactNumberFormatter.format(dislikes); final String formatted = compactNumberFormatter.format(dislikes);
LogHelper.debug(ReturnYouTubeDislikes.class, "Formatting dislikes - " + dislikes + " - " + formatted); LogHelper.debug(ReturnYouTubeDislike.class, "Formatting dislikes - " + dislikes + " - " + formatted);
return formatted; return formatted;
} }
LogHelper.debug(ReturnYouTubeDislikes.class, "Couldn't format dislikes, using the unformatted count - " + dislikes); LogHelper.debug(ReturnYouTubeDislike.class, "Couldn't format dislikes, using the unformatted count - " + dislikes);
return String.valueOf(dislikes); return String.valueOf(dislikes);
} }
} }

View File

@ -1,7 +1,7 @@
package app.revanced.integrations.ryd; package app.revanced.integrations.returnyoutubedislike;
import app.revanced.integrations.utils.LogHelper; import app.revanced.integrations.utils.LogHelper;
import app.revanced.integrations.ryd.requests.RYDRequester; import app.revanced.integrations.returnyoutubedislike.requests.ReturnYouTubeDislikeApi;
public class Voting { public class Voting {
private Registration registration; private Registration registration;
@ -13,6 +13,6 @@ public class Voting {
public boolean sendVote(String videoId, int vote) { public boolean sendVote(String videoId, int vote) {
String userId = registration.getUserId(); String userId = registration.getUserId();
LogHelper.debug(Voting.class, "Trying to vote the following video: " + videoId + " with vote " + vote + " and userId: " + userId); LogHelper.debug(Voting.class, "Trying to vote the following video: " + videoId + " with vote " + vote + " and userId: " + userId);
return RYDRequester.sendVote(videoId, userId, vote); return ReturnYouTubeDislikeApi.sendVote(videoId, userId, vote);
} }
} }

View File

@ -1,4 +1,4 @@
package app.revanced.integrations.ryd.dialog; package app.revanced.integrations.returnyoutubedislike.dialog;
import static app.revanced.integrations.sponsorblock.StringRef.str; import static app.revanced.integrations.sponsorblock.StringRef.str;

View File

@ -1,4 +1,4 @@
package app.revanced.integrations.ryd.requests; package app.revanced.integrations.returnyoutubedislike.requests;
import static app.revanced.integrations.videoplayer.VideoInformation.dislikeCount; import static app.revanced.integrations.videoplayer.VideoInformation.dislikeCount;
import static app.revanced.integrations.whitelist.requests.Requester.parseJson; import static app.revanced.integrations.whitelist.requests.Requester.parseJson;
@ -12,65 +12,65 @@ import java.net.HttpURLConnection;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import app.revanced.integrations.utils.LogHelper; import app.revanced.integrations.utils.LogHelper;
import app.revanced.integrations.ryd.Registration; import app.revanced.integrations.returnyoutubedislike.Registration;
import app.revanced.integrations.whitelist.requests.Requester; import app.revanced.integrations.whitelist.requests.Requester;
import app.revanced.integrations.whitelist.requests.Route; import app.revanced.integrations.whitelist.requests.Route;
public class RYDRequester { public class ReturnYouTubeDislikeApi {
private static final String RYD_API_URL = "https://returnyoutubedislikeapi.com/"; private static final String RYD_API_URL = "https://returnyoutubedislikeapi.com/";
private RYDRequester() { private ReturnYouTubeDislikeApi() {
} }
public static void fetchDislikes(String videoId) { public static void fetchDislikes(String videoId) {
try { try {
LogHelper.debug(RYDRequester.class, "Fetching dislikes for " + videoId); LogHelper.debug(ReturnYouTubeDislikeApi.class, "Fetching dislikes for " + videoId);
HttpURLConnection connection = getConnectionFromRoute(RYDRoutes.GET_DISLIKES, videoId); HttpURLConnection connection = getConnectionFromRoute(ReturnYouTubeDislikeRoutes.GET_DISLIKES, videoId);
connection.setConnectTimeout(5 * 1000); connection.setConnectTimeout(5 * 1000);
if (connection.getResponseCode() == 200) { if (connection.getResponseCode() == 200) {
JSONObject json = getJSONObject(connection); JSONObject json = getJSONObject(connection);
dislikeCount = json.getInt("dislikes"); dislikeCount = json.getInt("dislikes");
LogHelper.debug(RYDRequester.class, "dislikes fetched - " + dislikeCount); LogHelper.debug(ReturnYouTubeDislikeApi.class, "dislikes fetched - " + dislikeCount);
} else { } else {
LogHelper.debug(RYDRequester.class, "dislikes fetch response was " + connection.getResponseCode()); LogHelper.debug(ReturnYouTubeDislikeApi.class, "dislikes fetch response was " + connection.getResponseCode());
} }
connection.disconnect(); connection.disconnect();
} catch (Exception ex) { } catch (Exception ex) {
dislikeCount = null; dislikeCount = null;
LogHelper.printException(RYDRequester.class, "Failed to fetch dislikes", ex); LogHelper.printException(ReturnYouTubeDislikeApi.class, "Failed to fetch dislikes", ex);
} }
} }
public static String register(String userId, Registration registration) { public static String register(String userId, Registration registration) {
try { try {
HttpURLConnection connection = getConnectionFromRoute(RYDRoutes.GET_REGISTRATION, userId); HttpURLConnection connection = getConnectionFromRoute(ReturnYouTubeDislikeRoutes.GET_REGISTRATION, userId);
connection.setConnectTimeout(5 * 1000); connection.setConnectTimeout(5 * 1000);
if (connection.getResponseCode() == 200) { if (connection.getResponseCode() == 200) {
JSONObject json = getJSONObject(connection); JSONObject json = getJSONObject(connection);
String challenge = json.getString("challenge"); String challenge = json.getString("challenge");
int difficulty = json.getInt("difficulty"); int difficulty = json.getInt("difficulty");
LogHelper.debug(RYDRequester.class, "Registration challenge - " + challenge + " with difficulty of " + difficulty); LogHelper.debug(ReturnYouTubeDislikeApi.class, "Registration challenge - " + challenge + " with difficulty of " + difficulty);
// Solve the puzzle // Solve the puzzle
String solution = Registration.solvePuzzle(challenge, difficulty); String solution = Registration.solvePuzzle(challenge, difficulty);
LogHelper.debug(RYDRequester.class, "Registration confirmation solution is " + solution); LogHelper.debug(ReturnYouTubeDislikeApi.class, "Registration confirmation solution is " + solution);
return confirmRegistration(userId, solution, registration); return confirmRegistration(userId, solution, registration);
} else { } else {
LogHelper.debug(RYDRequester.class, "Registration response was " + connection.getResponseCode()); LogHelper.debug(ReturnYouTubeDislikeApi.class, "Registration response was " + connection.getResponseCode());
} }
connection.disconnect(); connection.disconnect();
} catch (Exception ex) { } catch (Exception ex) {
LogHelper.printException(RYDRequester.class, "Failed to register userId", ex); LogHelper.printException(ReturnYouTubeDislikeApi.class, "Failed to register userId", ex);
} }
return null; return null;
} }
private static String confirmRegistration(String userId, String solution, Registration registration) { private static String confirmRegistration(String userId, String solution, Registration registration) {
try { try {
LogHelper.debug(RYDRequester.class, "Trying to confirm registration for the following userId: " + userId + " with solution: " + solution); LogHelper.debug(ReturnYouTubeDislikeApi.class, "Trying to confirm registration for the following userId: " + userId + " with solution: " + solution);
HttpURLConnection connection = getConnectionFromRoute(RYDRoutes.CONFIRM_REGISTRATION, userId); HttpURLConnection connection = getConnectionFromRoute(ReturnYouTubeDislikeRoutes.CONFIRM_REGISTRATION, userId);
applyCommonRequestSettings(connection); applyCommonRequestSettings(connection);
String jsonInputString = "{\"solution\": \"" + solution + "\"}"; String jsonInputString = "{\"solution\": \"" + solution + "\"}";
@ -80,20 +80,20 @@ public class RYDRequester {
} }
if (connection.getResponseCode() == 200) { if (connection.getResponseCode() == 200) {
String result = parseJson(connection); String result = parseJson(connection);
LogHelper.debug(RYDRequester.class, "Registration confirmation result was " + result); LogHelper.debug(ReturnYouTubeDislikeApi.class, "Registration confirmation result was " + result);
if (result.equalsIgnoreCase("true")) { if (result.equalsIgnoreCase("true")) {
registration.saveUserId(userId); registration.saveUserId(userId);
LogHelper.debug(RYDRequester.class, "Registration was successful for user " + userId); LogHelper.debug(ReturnYouTubeDislikeApi.class, "Registration was successful for user " + userId);
return userId; return userId;
} }
} else { } else {
LogHelper.debug(RYDRequester.class, "Registration confirmation response was " + connection.getResponseCode()); LogHelper.debug(ReturnYouTubeDislikeApi.class, "Registration confirmation response was " + connection.getResponseCode());
} }
connection.disconnect(); connection.disconnect();
} catch (Exception ex) { } catch (Exception ex) {
LogHelper.printException(RYDRequester.class, "Failed to confirm registration", ex); LogHelper.printException(ReturnYouTubeDislikeApi.class, "Failed to confirm registration", ex);
} }
return null; return null;
@ -101,7 +101,7 @@ public class RYDRequester {
public static boolean sendVote(String videoId, String userId, int vote) { public static boolean sendVote(String videoId, String userId, int vote) {
try { try {
HttpURLConnection connection = getConnectionFromRoute(RYDRoutes.SEND_VOTE); HttpURLConnection connection = getConnectionFromRoute(ReturnYouTubeDislikeRoutes.SEND_VOTE);
applyCommonRequestSettings(connection); applyCommonRequestSettings(connection);
String voteJsonString = "{\"userId\": \"" + userId + "\", \"videoId\": \"" + videoId + "\", \"value\": \"" + vote + "\"}"; String voteJsonString = "{\"userId\": \"" + userId + "\", \"videoId\": \"" + videoId + "\", \"value\": \"" + vote + "\"}";
@ -114,27 +114,27 @@ public class RYDRequester {
JSONObject json = getJSONObject(connection); JSONObject json = getJSONObject(connection);
String challenge = json.getString("challenge"); String challenge = json.getString("challenge");
int difficulty = json.getInt("difficulty"); int difficulty = json.getInt("difficulty");
LogHelper.debug(RYDRequester.class, "Vote challenge - " + challenge + " with difficulty of " + difficulty); LogHelper.debug(ReturnYouTubeDislikeApi.class, "Vote challenge - " + challenge + " with difficulty of " + difficulty);
// Solve the puzzle // Solve the puzzle
String solution = Registration.solvePuzzle(challenge, difficulty); String solution = Registration.solvePuzzle(challenge, difficulty);
LogHelper.debug(RYDRequester.class, "Vote confirmation solution is " + solution); LogHelper.debug(ReturnYouTubeDislikeApi.class, "Vote confirmation solution is " + solution);
// Confirm vote // Confirm vote
return confirmVote(videoId, userId, solution); return confirmVote(videoId, userId, solution);
} else { } else {
LogHelper.debug(RYDRequester.class, "Vote response was " + connection.getResponseCode()); LogHelper.debug(ReturnYouTubeDislikeApi.class, "Vote response was " + connection.getResponseCode());
} }
connection.disconnect(); connection.disconnect();
} catch (Exception ex) { } catch (Exception ex) {
LogHelper.printException(RYDRequester.class, "Failed to send vote", ex); LogHelper.printException(ReturnYouTubeDislikeApi.class, "Failed to send vote", ex);
} }
return false; return false;
} }
private static boolean confirmVote(String videoId, String userId, String solution) { private static boolean confirmVote(String videoId, String userId, String solution) {
try { try {
HttpURLConnection connection = getConnectionFromRoute(RYDRoutes.CONFIRM_VOTE); HttpURLConnection connection = getConnectionFromRoute(ReturnYouTubeDislikeRoutes.CONFIRM_VOTE);
applyCommonRequestSettings(connection); applyCommonRequestSettings(connection);
String jsonInputString = "{\"userId\": \"" + userId + "\", \"videoId\": \"" + videoId + "\", \"solution\": \"" + solution + "\"}"; String jsonInputString = "{\"userId\": \"" + userId + "\", \"videoId\": \"" + videoId + "\", \"solution\": \"" + solution + "\"}";
@ -144,20 +144,20 @@ public class RYDRequester {
} }
if (connection.getResponseCode() == 200) { if (connection.getResponseCode() == 200) {
String result = parseJson(connection); String result = parseJson(connection);
LogHelper.debug(RYDRequester.class, "Vote confirmation result was " + result); LogHelper.debug(ReturnYouTubeDislikeApi.class, "Vote confirmation result was " + result);
if (result.equalsIgnoreCase("true")) { if (result.equalsIgnoreCase("true")) {
LogHelper.debug(RYDRequester.class, "Vote was successful for user " + userId); LogHelper.debug(ReturnYouTubeDislikeApi.class, "Vote was successful for user " + userId);
return true; return true;
} }
} else { } else {
LogHelper.debug(RYDRequester.class, "Vote confirmation response was " + connection.getResponseCode()); LogHelper.debug(ReturnYouTubeDislikeApi.class, "Vote confirmation response was " + connection.getResponseCode());
} }
connection.disconnect(); connection.disconnect();
} catch (Exception ex) { } catch (Exception ex) {
LogHelper.printException(RYDRequester.class, "Failed to confirm vote", ex); LogHelper.printException(ReturnYouTubeDislikeApi.class, "Failed to confirm vote", ex);
} }
return false; return false;
} }

View File

@ -1,17 +1,17 @@
package app.revanced.integrations.ryd.requests; package app.revanced.integrations.returnyoutubedislike.requests;
import static app.revanced.integrations.whitelist.requests.Route.Method.GET; import static app.revanced.integrations.whitelist.requests.Route.Method.GET;
import static app.revanced.integrations.whitelist.requests.Route.Method.POST; import static app.revanced.integrations.whitelist.requests.Route.Method.POST;
import app.revanced.integrations.whitelist.requests.Route; import app.revanced.integrations.whitelist.requests.Route;
public class RYDRoutes { public class ReturnYouTubeDislikeRoutes {
public static final Route SEND_VOTE = new Route(POST, "interact/vote"); public static final Route SEND_VOTE = new Route(POST, "interact/vote");
public static final Route CONFIRM_VOTE = new Route(POST, "interact/confirmVote"); public static final Route CONFIRM_VOTE = new Route(POST, "interact/confirmVote");
public static final Route GET_DISLIKES = new Route(GET, "votes?videoId={video_id}"); public static final Route GET_DISLIKES = new Route(GET, "votes?videoId={video_id}");
public static final Route GET_REGISTRATION = new Route(GET, "puzzle/registration?userId={user_id}"); public static final Route GET_REGISTRATION = new Route(GET, "puzzle/registration?userId={user_id}");
public static final Route CONFIRM_REGISTRATION = new Route(POST, "puzzle/registration?userId={user_id}"); public static final Route CONFIRM_REGISTRATION = new Route(POST, "puzzle/registration?userId={user_id}");
private RYDRoutes() { private ReturnYouTubeDislikeRoutes() {
} }
} }

View File

@ -37,7 +37,7 @@ public class ReVancedSettingActivity extends Activity {
getFragmentManager().beginTransaction().replace(getIdentifier("xsettings_fragments", "id"), new SponsorBlockSettingsFragment()).commit(); getFragmentManager().beginTransaction().replace(getIdentifier("xsettings_fragments", "id"), new SponsorBlockSettingsFragment()).commit();
} else if (dataString.equalsIgnoreCase("ryd_settings")) { } else if (dataString.equalsIgnoreCase("ryd_settings")) {
trySetTitle(getIdentifier("revanced_ryd_settings_title", "string")); trySetTitle(getIdentifier("revanced_ryd_settings_title", "string"));
getFragmentManager().beginTransaction().replace(getIdentifier("xsettings_fragments", "id"), new RYDSettingsFragment()).commit(); getFragmentManager().beginTransaction().replace(getIdentifier("xsettings_fragments", "id"), new ReturnYouTubeDislikeSettingsFragment()).commit();
} else { } else {
trySetTitle(getIdentifier("revanced_settings", "string")); trySetTitle(getIdentifier("revanced_settings", "string"));
getFragmentManager().beginTransaction().replace(getIdentifier("xsettings_fragments", "id"), new ReVancedSettingsFragment()).commit(); getFragmentManager().beginTransaction().replace(getIdentifier("xsettings_fragments", "id"), new ReVancedSettingsFragment()).commit();

View File

@ -13,11 +13,11 @@ import android.preference.PreferenceFragment;
import android.preference.PreferenceScreen; import android.preference.PreferenceScreen;
import android.preference.SwitchPreference; import android.preference.SwitchPreference;
import app.revanced.integrations.ryd.ReturnYouTubeDislikes; import app.revanced.integrations.returnyoutubedislike.ReturnYouTubeDislike;
import app.revanced.integrations.settings.SettingsEnum; import app.revanced.integrations.settings.SettingsEnum;
import app.revanced.integrations.utils.SharedPrefHelper; import app.revanced.integrations.utils.SharedPrefHelper;
public class RYDSettingsFragment extends PreferenceFragment { public class ReturnYouTubeDislikeSettingsFragment extends PreferenceFragment {
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -39,7 +39,7 @@ public class RYDSettingsFragment extends PreferenceFragment {
preference.setSummary(str("revanced_ryd_summary")); preference.setSummary(str("revanced_ryd_summary"));
preference.setOnPreferenceChangeListener((pref, newValue) -> { preference.setOnPreferenceChangeListener((pref, newValue) -> {
final boolean value = (Boolean) newValue; final boolean value = (Boolean) newValue;
ReturnYouTubeDislikes.onEnabledChange(value); ReturnYouTubeDislike.onEnabledChange(value);
return true; return true;
}); });
} }