mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2024-11-12 18:04:26 +01:00
chore(YouTube - Announcements): Remove language parameter of API call (#3874)
This commit is contained in:
parent
5279f13d61
commit
4363dc5b4b
2 changed files with 6 additions and 9 deletions
|
@ -15,13 +15,10 @@ import android.widget.TextView;
|
|||
import androidx.annotation.RequiresApi;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Locale;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import app.revanced.extension.shared.Logger;
|
||||
import app.revanced.extension.shared.Utils;
|
||||
|
@ -84,8 +81,8 @@ public final class AnnouncementsPatch {
|
|||
try {
|
||||
if (isLatestAlready()) return;
|
||||
|
||||
HttpURLConnection connection = AnnouncementsRoutes.getAnnouncementsConnectionFromRoute(
|
||||
GET_LATEST_ANNOUNCEMENTS, Locale.getDefault().toLanguageTag());
|
||||
HttpURLConnection connection = AnnouncementsRoutes
|
||||
.getAnnouncementsConnectionFromRoute(GET_LATEST_ANNOUNCEMENTS);
|
||||
|
||||
Logger.printDebug(() -> "Get latest announcements route connection url: " + connection.getURL());
|
||||
|
||||
|
@ -98,11 +95,11 @@ public final class AnnouncementsPatch {
|
|||
LocalDateTime archivedAt = LocalDateTime.MAX;
|
||||
Level level = Level.INFO;
|
||||
try {
|
||||
final var announcement = new JSONObject(jsonString);
|
||||
final var announcement = new JSONArray(jsonString).getJSONObject(0);
|
||||
|
||||
id = announcement.getInt("id");
|
||||
title = announcement.getString("title");
|
||||
message = announcement.getJSONObject("content").getString("message");
|
||||
message = announcement.getString("content");
|
||||
if (!announcement.isNull("archived_at")) {
|
||||
archivedAt = LocalDateTime.parse(announcement.getString("archived_at"));
|
||||
}
|
||||
|
|
|
@ -9,9 +9,9 @@ import java.net.HttpURLConnection;
|
|||
import static app.revanced.extension.youtube.requests.Route.Method.GET;
|
||||
|
||||
public class AnnouncementsRoutes {
|
||||
public static final Route GET_LATEST_ANNOUNCEMENTS = new Route(GET, "/announcements/latest?tag=youtube");
|
||||
public static final Route GET_LATEST_ANNOUNCEMENT_IDS = new Route(GET, "/announcements/latest/id?tag=youtube");
|
||||
private static final String ANNOUNCEMENTS_PROVIDER = "https://api.revanced.app/v4";
|
||||
public static final Route GET_LATEST_ANNOUNCEMENT_IDS = new Route(GET, "/announcements/latest/id?tag=youtube");
|
||||
public static final Route GET_LATEST_ANNOUNCEMENTS = new Route(GET, "/announcements/latest?tag=youtube");
|
||||
|
||||
private AnnouncementsRoutes() {
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue