mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-12 06:06:18 +00:00
Compare commits
5 Commits
v5.0.0-dev
...
v5.0.0-dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6e75ffd5f1 | ||
|
|
75d661fcdc | ||
|
|
4d1de6bc50 | ||
|
|
327ebd3649 | ||
|
|
34e98a54e0 |
14
CHANGELOG.md
14
CHANGELOG.md
@@ -1,3 +1,17 @@
|
||||
# [5.0.0-dev.4](https://github.com/ReVanced/revanced-patches/compare/v5.0.0-dev.3...v5.0.0-dev.4) (2024-11-09)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **YouTube - Remember video quality:** Correctly set default quality when changing from a low quality video ([#3879](https://github.com/ReVanced/revanced-patches/issues/3879)) ([ddb73e8](https://github.com/ReVanced/revanced-patches/commit/ddb73e857d7c26fd27ea995a27f53f5660d3f71c))
|
||||
|
||||
# [5.0.0-dev.3](https://github.com/ReVanced/revanced-patches/compare/v5.0.0-dev.2...v5.0.0-dev.3) (2024-11-09)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Add missing dependency to patch ([97f5240](https://github.com/ReVanced/revanced-patches/commit/97f5240d53b9978fb3745170fe03619c7c90274a))
|
||||
|
||||
# [5.0.0-dev.2](https://github.com/ReVanced/revanced-patches/compare/v5.0.0-dev.1...v5.0.0-dev.2) (2024-11-09)
|
||||
|
||||
|
||||
|
||||
@@ -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() {
|
||||
}
|
||||
|
||||
@@ -416,7 +416,6 @@ public final class ShortsFilter extends Filter {
|
||||
// endregion
|
||||
|
||||
public static void setNavigationBar(PivotBar view) {
|
||||
Logger.printDebug(() -> "Setting navigation bar");
|
||||
pivotBarRef = new WeakReference<>(view);
|
||||
}
|
||||
|
||||
|
||||
@@ -62,19 +62,12 @@ public class RememberVideoQualityPatch {
|
||||
*/
|
||||
public static int setVideoQuality(Object[] qualities, final int originalQualityIndex, Object qInterface, String qIndexMethod) {
|
||||
try {
|
||||
if (!(qualityNeedsUpdating || userChangedDefaultQuality) || qInterface == null) {
|
||||
return originalQualityIndex;
|
||||
}
|
||||
qualityNeedsUpdating = false;
|
||||
final int preferredQuality = Utils.getNetworkType() == NetworkType.MOBILE
|
||||
? mobileQualitySetting.get()
|
||||
: wifiQualitySetting.get();
|
||||
|
||||
final int preferredQuality;
|
||||
if (Utils.getNetworkType() == NetworkType.MOBILE) {
|
||||
preferredQuality = mobileQualitySetting.get();
|
||||
} else {
|
||||
preferredQuality = wifiQualitySetting.get();
|
||||
}
|
||||
if (!userChangedDefaultQuality && preferredQuality == AUTOMATIC_VIDEO_QUALITY_VALUE) {
|
||||
return originalQualityIndex; // nothing to do
|
||||
return originalQualityIndex; // Nothing to do.
|
||||
}
|
||||
|
||||
if (videoQualities == null || videoQualities.size() != qualities.length) {
|
||||
@@ -87,7 +80,11 @@ public class RememberVideoQualityPatch {
|
||||
}
|
||||
}
|
||||
}
|
||||
Logger.printDebug(() -> "videoQualities: " + videoQualities);
|
||||
|
||||
// After changing videos the qualities can initially be for the prior video.
|
||||
// So if the qualities have changed an update is needed.
|
||||
qualityNeedsUpdating = true;
|
||||
Logger.printDebug(() -> "VideoQualities: " + videoQualities);
|
||||
}
|
||||
|
||||
if (userChangedDefaultQuality) {
|
||||
@@ -98,7 +95,12 @@ public class RememberVideoQualityPatch {
|
||||
return userSelectedQualityIndex;
|
||||
}
|
||||
|
||||
// find the highest quality that is equal to or less than the preferred
|
||||
if (!qualityNeedsUpdating) {
|
||||
return originalQualityIndex;
|
||||
}
|
||||
qualityNeedsUpdating = false;
|
||||
|
||||
// Find the highest quality that is equal to or less than the preferred.
|
||||
int qualityToUse = videoQualities.get(0); // first element is automatic mode
|
||||
int qualityIndexToUse = 0;
|
||||
int i = 0;
|
||||
@@ -112,20 +114,18 @@ public class RememberVideoQualityPatch {
|
||||
|
||||
// If the desired quality index is equal to the original index,
|
||||
// then the video is already set to the desired default quality.
|
||||
//
|
||||
// The method could return here, but the UI video quality flyout will still
|
||||
// show 'Auto' (ie: Auto (480p))
|
||||
// It appears that "Auto" picks the resolution on video load,
|
||||
// and it does not appear to change the resolution during playback.
|
||||
//
|
||||
// To prevent confusion, set the video index anyways (even if it matches the existing index)
|
||||
// As that will force the UI picker to not display "Auto" which may confuse the user.
|
||||
final int qualityToUseFinal = qualityToUse;
|
||||
if (qualityIndexToUse == originalQualityIndex) {
|
||||
Logger.printDebug(() -> "Video is already preferred quality: " + preferredQuality);
|
||||
// On first load of a new video, if the UI video quality flyout menu
|
||||
// is not updated then it will still show 'Auto' (ie: Auto (480p)),
|
||||
// even though it's already set to the desired resolution.
|
||||
//
|
||||
// To prevent confusion, set the video index anyways (even if it matches the existing index)
|
||||
// as that will force the UI picker to not display "Auto".
|
||||
Logger.printDebug(() -> "Video is already preferred quality: " + qualityToUseFinal);
|
||||
} else {
|
||||
final int qualityToUseLog = qualityToUse;
|
||||
Logger.printDebug(() -> "Quality changed from: "
|
||||
+ videoQualities.get(originalQualityIndex) + " to: " + qualityToUseLog);
|
||||
Logger.printDebug(() -> "Changing video quality from: "
|
||||
+ videoQualities.get(originalQualityIndex) + " to: " + qualityToUseFinal);
|
||||
}
|
||||
|
||||
Method m = qInterface.getClass().getMethod(qIndexMethod, Integer.TYPE);
|
||||
|
||||
@@ -3,4 +3,4 @@ org.gradle.jvmargs = -Xms512M -Xmx2048M
|
||||
org.gradle.parallel = true
|
||||
android.useAndroidX = true
|
||||
kotlin.code.style = official
|
||||
version = 5.0.0-dev.2
|
||||
version = 5.0.0-dev.4
|
||||
|
||||
@@ -3,6 +3,7 @@ package app.revanced.patches.youtube.misc.dns
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.patch.bytecodePatch
|
||||
import app.revanced.patches.all.misc.resources.addResources
|
||||
import app.revanced.patches.all.misc.resources.addResourcesPatch
|
||||
import app.revanced.patches.youtube.shared.mainActivityOnCreateFingerprint
|
||||
|
||||
private const val EXTENSION_CLASS_DESCRIPTOR =
|
||||
@@ -13,6 +14,8 @@ val checkWatchHistoryDomainNameResolutionPatch = bytecodePatch(
|
||||
name = "Check watch history domain name resolution",
|
||||
description = "Checks if the device DNS server is preventing user watch history from being saved.",
|
||||
) {
|
||||
dependsOn(addResourcesPatch)
|
||||
|
||||
compatibleWith(
|
||||
"com.google.android.youtube"(
|
||||
"18.38.44",
|
||||
|
||||
Reference in New Issue
Block a user