Merge branch 'dev' into feat/universal-icon-patch

# Conflicts:
#	patches/src/main/kotlin/app/revanced/patches/music/layout/compactheader/Fingerprints.kt
This commit is contained in:
oSumAtrIX 2024-12-05 23:12:56 +01:00
commit 9dca7681ea
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4
379 changed files with 1050 additions and 694 deletions

View File

@ -1,3 +1,46 @@
## [5.2.2-dev.1](https://github.com/ReVanced/revanced-patches/compare/v5.2.1...v5.2.2-dev.1) (2024-12-05)
### Bug Fixes
* **YouTube - Spoof video streams:** Use system language as default iOS audio stream ([#4042](https://github.com/ReVanced/revanced-patches/issues/4042)) ([4017185](https://github.com/ReVanced/revanced-patches/commit/4017185e760c0569e6644b94bbe66a84fa245b4b))
## [5.2.1](https://github.com/ReVanced/revanced-patches/compare/v5.2.0...v5.2.1) (2024-12-04)
### Bug Fixes
* **Twitch:** Resolve setting menu crashes ([#4025](https://github.com/ReVanced/revanced-patches/issues/4025)) ([62df596](https://github.com/ReVanced/revanced-patches/commit/62df5965d7331e47b3143425d169a79a19eac447))
* **YouTube - Spoof app version:** Update spoof target to resolve library tab crashes ([#4014](https://github.com/ReVanced/revanced-patches/issues/4014)) ([c8eced5](https://github.com/ReVanced/revanced-patches/commit/c8eced54704017df4e91e536dbef1e9514306f67))
* **YouTube - Spoof app version:** Update spoof target to resolve library tab crashes ([#4019](https://github.com/ReVanced/revanced-patches/issues/4019)) ([d89ad65](https://github.com/ReVanced/revanced-patches/commit/d89ad6501a7cdb3c074c6204dac7960ca3e252f1))
* **YouTube Music - Hide category bar:** Add support for latest release ([#3968](https://github.com/ReVanced/revanced-patches/issues/3968)) ([b63fdeb](https://github.com/ReVanced/revanced-patches/commit/b63fdeb10b504468307a77bd5de69407906848bf))
### Performance Improvements
* Move variables to local scope ([43c0421](https://github.com/ReVanced/revanced-patches/commit/43c04216c6e647eaf6ad7e813eb5f0df0c108b77))
## [5.2.1-dev.5](https://github.com/ReVanced/revanced-patches/compare/v5.2.1-dev.4...v5.2.1-dev.5) (2024-12-01)
### Performance Improvements
* Move variables to local scope ([43c0421](https://github.com/ReVanced/revanced-patches/commit/43c04216c6e647eaf6ad7e813eb5f0df0c108b77))
## [5.2.1-dev.4](https://github.com/ReVanced/revanced-patches/compare/v5.2.1-dev.3...v5.2.1-dev.4) (2024-11-30)
### Bug Fixes
* **Twitch:** Resolve setting menu crashes ([#4025](https://github.com/ReVanced/revanced-patches/issues/4025)) ([62df596](https://github.com/ReVanced/revanced-patches/commit/62df5965d7331e47b3143425d169a79a19eac447))
## [5.2.1-dev.3](https://github.com/ReVanced/revanced-patches/compare/v5.2.1-dev.2...v5.2.1-dev.3) (2024-11-29)
### Bug Fixes
* **YouTube Music - Hide category bar:** Add support for latest release ([#3968](https://github.com/ReVanced/revanced-patches/issues/3968)) ([b63fdeb](https://github.com/ReVanced/revanced-patches/commit/b63fdeb10b504468307a77bd5de69407906848bf))
## [5.2.1-dev.2](https://github.com/ReVanced/revanced-patches/compare/v5.2.1-dev.1...v5.2.1-dev.2) (2024-11-28)

View File

@ -0,0 +1,5 @@
android.namespace = "app.revanced.extension"
dependencies {
compileOnly(libs.annotation)
}

View File

@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
</manifest>

View File

@ -0,0 +1,5 @@
android.namespace = "app.revanced.extension"
dependencies {
compileOnly(libs.annotation)
}

View File

@ -0,0 +1 @@
android.namespace = "app.revanced.extension"

View File

@ -0,0 +1,4 @@
dependencies {
compileOnly(project(":extensions:shared:library"))
compileOnly(project(":extensions:boostforreddit:stub"))
}

View File

@ -0,0 +1 @@
<manifest/>

View File

@ -4,7 +4,9 @@ import com.rubenmayayo.reddit.ui.activities.WebViewActivity;
import app.revanced.extension.shared.fixes.slink.BaseFixSLinksPatch;
/** @noinspection unused*/
/**
* @noinspection unused
*/
public class FixSLinksPatch extends BaseFixSLinksPatch {
static {
INSTANCE = new FixSLinksPatch();

View File

@ -0,0 +1 @@
<manifest/>

View File

@ -0,0 +1,3 @@
dependencies {
compileOnly(project(":extensions:reddit:stub"))
}

View File

@ -0,0 +1 @@
<manifest/>

View File

@ -1,4 +1,4 @@
package app.revanced.extension.reddit.patches;
package app.revanced.extension.patches;
import com.reddit.domain.model.ILink;

View File

@ -0,0 +1,17 @@
plugins {
id(libs.plugins.android.library.get().pluginId)
}
android {
namespace = "app.revanced.extension"
compileSdk = 33
defaultConfig {
minSdk = 24
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
}

View File

@ -0,0 +1 @@
<manifest/>

View File

@ -1,11 +0,0 @@
extension {
name = "extensions/all/screencapture/remove-screen-capture-restriction.rve"
}
android {
namespace = "app.revanced.extension"
}
dependencies {
compileOnly(libs.annotation)
}

View File

@ -1,7 +0,0 @@
extension {
name = "extensions/all/screenshot/remove-screenshot-restriction.rve"
}
android {
namespace = "app.revanced.extension"
}

View File

@ -1,22 +1,3 @@
extension {
name = "extensions/shared.rve"
}
android {
namespace = "app.revanced.extension"
buildTypes {
release {
isMinifyEnabled = true
}
}
}
dependencies {
compileOnly(libs.appcompat)
compileOnly(libs.annotation)
compileOnly(libs.okhttp)
compileOnly(libs.retrofit)
compileOnly(project(":extensions:shared:stub"))
implementation(project(":extensions:shared:library"))
}

View File

@ -0,0 +1,21 @@
plugins {
id("com.android.library")
}
android {
namespace = "app.revanced.extension"
compileSdk = 34
defaultConfig {
minSdk = 23
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
}
dependencies {
compileOnly(libs.annotation)
}

View File

@ -19,7 +19,7 @@ import java.util.Collection;
import app.revanced.extension.shared.Logger;
import app.revanced.extension.shared.Utils;
import app.revanced.extension.youtube.settings.Settings;
import app.revanced.extension.shared.settings.BaseSettings;
abstract class Check {
private static final int NUMBER_OF_TIMES_TO_IGNORE_WARNING_BEFORE_DISABLING = 2;
@ -46,11 +46,11 @@ abstract class Check {
/**
* For debugging and development only.
* Forces all checks to be performed and the check failed dialog to be shown.
* Can be enabled by importing settings text with {@link Settings#CHECK_ENVIRONMENT_WARNINGS_ISSUED}
* Can be enabled by importing settings text with {@link BaseSettings#CHECK_ENVIRONMENT_WARNINGS_ISSUED}
* set to -1.
*/
static boolean debugAlwaysShowWarning() {
final boolean alwaysShowWarning = Settings.CHECK_ENVIRONMENT_WARNINGS_ISSUED.get() < 0;
final boolean alwaysShowWarning = BaseSettings.CHECK_ENVIRONMENT_WARNINGS_ISSUED.get() < 0;
if (alwaysShowWarning) {
Logger.printInfo(() -> "Debug forcing environment check warning to show");
}
@ -59,14 +59,14 @@ abstract class Check {
}
static boolean shouldRun() {
return Settings.CHECK_ENVIRONMENT_WARNINGS_ISSUED.get()
return BaseSettings.CHECK_ENVIRONMENT_WARNINGS_ISSUED.get()
< NUMBER_OF_TIMES_TO_IGNORE_WARNING_BEFORE_DISABLING;
}
static void disableForever() {
Logger.printInfo(() -> "Environment checks disabled forever");
Settings.CHECK_ENVIRONMENT_WARNINGS_ISSUED.save(Integer.MAX_VALUE);
BaseSettings.CHECK_ENVIRONMENT_WARNINGS_ISSUED.save(Integer.MAX_VALUE);
}
@SuppressLint("NewApi")
@ -107,8 +107,8 @@ abstract class Check {
" ",
(dialog, which) -> {
// Cleanup data if the user incorrectly imported a huge negative number.
final int current = Math.max(0, Settings.CHECK_ENVIRONMENT_WARNINGS_ISSUED.get());
Settings.CHECK_ENVIRONMENT_WARNINGS_ISSUED.save(current + 1);
final int current = Math.max(0, BaseSettings.CHECK_ENVIRONMENT_WARNINGS_ISSUED.get());
BaseSettings.CHECK_ENVIRONMENT_WARNINGS_ISSUED.save(current + 1);
dialog.dismiss();
}

View File

@ -1,4 +1,4 @@
package app.revanced.extension.youtube.requests;
package app.revanced.extension.shared.requests;
import app.revanced.extension.shared.Utils;
import org.json.JSONArray;

View File

@ -1,4 +1,4 @@
package app.revanced.extension.youtube.requests;
package app.revanced.extension.shared.requests;
public class Route {
private final String route;

View File

@ -14,4 +14,6 @@ public class BaseSettings {
public static final BooleanSetting DEBUG = new BooleanSetting("revanced_debug", FALSE);
public static final BooleanSetting DEBUG_STACKTRACE = new BooleanSetting("revanced_debug_stacktrace", FALSE, parent(DEBUG));
public static final BooleanSetting DEBUG_TOAST_ON_ERROR = new BooleanSetting("revanced_debug_toast_on_error", TRUE, "revanced_debug_toast_on_error_user_dialog_message");
public static final IntegerSetting CHECK_ENVIRONMENT_WARNINGS_ISSUED = new IntegerSetting("revanced_check_environment_warnings_issued", 0, true, false);
}

View File

@ -7,7 +7,6 @@ import app.revanced.extension.shared.Logger;
import app.revanced.extension.shared.StringRef;
import app.revanced.extension.shared.Utils;
import app.revanced.extension.shared.settings.preference.SharedPrefCategory;
import app.revanced.extension.youtube.sponsorblock.SponsorBlockSettings;
import org.jetbrains.annotations.NotNull;
import org.json.JSONException;
import org.json.JSONObject;
@ -62,6 +61,30 @@ public abstract class Setting<T> {
};
}
/**
* Callback for importing/exporting settings.
*/
public interface ImportExportCallback {
/**
* Called after all settings have been imported.
*/
void settingsImported(@Nullable Context context);
/**
* Called after all settings have been exported.
*/
void settingsExported(@Nullable Context context);
}
private static final List<ImportExportCallback> importExportCallbacks = new ArrayList<>();
/**
* Adds a callback for {@link #importFromJSON(Context, String)} and {@link #exportToJson(Context)}.
*/
public static void addImportExportCallback(@NonNull ImportExportCallback callback) {
importExportCallbacks.add(Objects.requireNonNull(callback));
}
/**
* All settings that were instantiated.
* When a new setting is created, it is automatically added to this list.
@ -365,7 +388,10 @@ public abstract class Setting<T> {
setting.writeToJSON(json, importExportKey);
}
}
SponsorBlockSettings.showExportWarningIfNeeded(alertDialogContext);
for (ImportExportCallback callback : importExportCallbacks) {
callback.settingsExported(alertDialogContext);
}
if (json.length() == 0) {
return "";
@ -385,7 +411,7 @@ public abstract class Setting<T> {
/**
* @return if any settings that require a reboot were changed.
*/
public static boolean importFromJSON(@NonNull String settingsJsonString) {
public static boolean importFromJSON(@NonNull Context alertDialogContext, @NonNull String settingsJsonString) {
try {
if (!settingsJsonString.matches("[\\s\\S]*\\{")) {
settingsJsonString = '{' + settingsJsonString + '}'; // Restore outer JSON braces
@ -411,12 +437,9 @@ public abstract class Setting<T> {
}
}
// SB Enum categories are saved using StringSettings.
// Which means they need to reload again if changed by other code (such as here).
// This call could be removed by creating a custom Setting class that manages the
// "String <-> Enum" logic or by adding an event hook of when settings are imported.
// But for now this is simple and works.
SponsorBlockSettings.updateFromImportedSettings();
for (ImportExportCallback callback : importExportCallbacks) {
callback.settingsImported(alertDialogContext);
}
Utils.showToastLong(numberOfSettingsImported == 0
? str("revanced_settings_import_reset")

View File

@ -1,23 +1,13 @@
package app.revanced.extension.shared.settings.preference;
import static app.revanced.extension.shared.StringRef.str;
import static app.revanced.extension.shared.Utils.getResourceIdentifier;
import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.Insets;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.preference.*;
import android.util.TypedValue;
import android.view.ViewGroup;
import android.view.WindowInsets;
import android.widget.TextView;
import android.widget.Toolbar;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@ -29,7 +19,6 @@ import app.revanced.extension.shared.Utils;
import app.revanced.extension.shared.settings.BaseSettings;
import app.revanced.extension.shared.settings.BooleanSetting;
import app.revanced.extension.shared.settings.Setting;
import app.revanced.extension.youtube.ThemeHelper;
@SuppressWarnings("deprecation")
public abstract class AbstractPreferenceFragment extends PreferenceFragment {
@ -85,14 +74,6 @@ public abstract class AbstractPreferenceFragment extends PreferenceFragment {
}
};
@SuppressLint("UseCompatLoadingForDrawables")
public static Drawable getBackButtonDrawable() {
final int backButtonResource = getResourceIdentifier(ThemeHelper.isDarkTheme()
? "yt_outline_arrow_left_white_24"
: "yt_outline_arrow_left_black_24",
"drawable");
return Utils.getContext().getResources().getDrawable(backButtonResource);
}
/**
* Initialize this instance, and do any custom behavior.
@ -284,7 +265,6 @@ public abstract class AbstractPreferenceFragment extends PreferenceFragment {
// causes a callback to the listener even though nothing changed.
initialize();
updateUIToSettingValues();
setPreferenceScreenToolbar(getPreferenceScreen());
preferenceManager.getSharedPreferences().registerOnSharedPreferenceChangeListener(listener);
} catch (Exception ex) {
@ -297,56 +277,4 @@ public abstract class AbstractPreferenceFragment extends PreferenceFragment {
getPreferenceManager().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(listener);
super.onDestroy();
}
private void setPreferenceScreenToolbar(PreferenceScreen parentScreen) {
for (int i = 0, preferenceCount = parentScreen.getPreferenceCount(); i < preferenceCount; i++) {
Preference childPreference = parentScreen.getPreference(i);
if (childPreference instanceof PreferenceScreen) {
// Recursively set sub preferences.
setPreferenceScreenToolbar((PreferenceScreen) childPreference);
childPreference.setOnPreferenceClickListener(
childScreen -> {
Dialog preferenceScreenDialog = ((PreferenceScreen) childScreen).getDialog();
ViewGroup rootView = (ViewGroup) preferenceScreenDialog
.findViewById(android.R.id.content)
.getParent();
// Fix required for Android 15 and YT 19.45+
// FIXME:
// On Android 15 the text layout is not aligned the same as the parent
// screen and it looks a little off. Otherwise this works.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
rootView.setOnApplyWindowInsetsListener((v, insets) -> {
Insets statusInsets = insets.getInsets(WindowInsets.Type.statusBars());
v.setPadding(0, statusInsets.top, 0, 0);
return insets;
});
}
Toolbar toolbar = new Toolbar(childScreen.getContext());
toolbar.setTitle(childScreen.getTitle());
toolbar.setNavigationIcon(getBackButtonDrawable());
toolbar.setNavigationOnClickListener(view -> preferenceScreenDialog.dismiss());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
final int margin = (int) TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_DIP, 16, getResources().getDisplayMetrics()
);
toolbar.setTitleMargin(margin, 0, margin, 0);
}
TextView toolbarTextView = Utils.getChildView(toolbar,
true, TextView.class::isInstance);
if (toolbarTextView != null) {
toolbarTextView.setTextColor(ThemeHelper.getForegroundColor());
}
rootView.addView(toolbar, 0);
return false;
}
);
}
}
}
}

View File

@ -72,20 +72,21 @@ public class ImportExportPreference extends EditTextPreference implements Prefer
builder.setNeutralButton(str("revanced_settings_import_copy"), (dialog, which) -> {
Utils.setClipboard(getEditText().getText().toString());
}).setPositiveButton(str("revanced_settings_import"), (dialog, which) -> {
importSettings(getEditText().getText().toString());
importSettings(builder.getContext(), getEditText().getText().toString());
});
} catch (Exception ex) {
Logger.printException(() -> "onPrepareDialogBuilder failure", ex);
}
}
private void importSettings(String replacementSettings) {
private void importSettings(Context context, String replacementSettings) {
try {
if (replacementSettings.equals(existingSettings)) {
return;
}
AbstractPreferenceFragment.settingImportInProgress = true;
final boolean rebootNeeded = Setting.importFromJSON(replacementSettings);
final boolean rebootNeeded = Setting.importFromJSON(context, replacementSettings);
if (rebootNeeded) {
AbstractPreferenceFragment.showRestartDialog(getContext());
}

View File

@ -1,7 +1,7 @@
package app.revanced.extension.shared.settings.preference;
import static app.revanced.extension.shared.StringRef.str;
import static app.revanced.extension.youtube.requests.Route.Method.GET;
import static app.revanced.extension.shared.requests.Route.Method.GET;
import android.annotation.SuppressLint;
import android.app.Dialog;
@ -34,8 +34,8 @@ import java.util.List;
import app.revanced.extension.shared.Logger;
import app.revanced.extension.shared.Utils;
import app.revanced.extension.youtube.requests.Requester;
import app.revanced.extension.youtube.requests.Route;
import app.revanced.extension.shared.requests.Requester;
import app.revanced.extension.shared.requests.Route;
/**
* Opens a dialog showing official links.

View File

@ -1,4 +1 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
</manifest>
<manifest/>

View File

@ -1,36 +0,0 @@
package app.revanced.extension.youtube.settings.preference;
import android.os.Build;
import android.preference.ListPreference;
import android.preference.Preference;
import androidx.annotation.RequiresApi;
import app.revanced.extension.shared.Logger;
import app.revanced.extension.shared.settings.preference.AbstractPreferenceFragment;
import app.revanced.extension.youtube.patches.playback.speed.CustomPlaybackSpeedPatch;
import app.revanced.extension.youtube.settings.Settings;
/**
* Preference fragment for ReVanced settings.
*
* @noinspection deprecation
*/
public class ReVancedPreferenceFragment extends AbstractPreferenceFragment {
@RequiresApi(api = Build.VERSION_CODES.O)
@Override
protected void initialize() {
super.initialize();
try {
// If the preference was included, then initialize it based on the available playback speed.
Preference defaultSpeedPreference = findPreference(Settings.PLAYBACK_SPEED_DEFAULT.key);
if (defaultSpeedPreference instanceof ListPreference) {
CustomPlaybackSpeedPatch.initializeListPreference((ListPreference) defaultSpeedPreference);
}
} catch (Exception ex) {
Logger.printException(() -> "initialize failure", ex);
}
}
}

View File

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest />

View File

@ -1,11 +0,0 @@
extension {
name = "extensions/all/connectivity/wifi/spoof/spoof-wifi.rve"
}
android {
namespace = "app.revanced.extension"
}
dependencies {
compileOnly(libs.annotation)
}

View File

@ -0,0 +1,5 @@
dependencies {
compileOnly(project(":extensions:shared:library"))
compileOnly(project(":extensions:syncforreddit:stub"))
compileOnly(libs.annotation)
}

View File

@ -0,0 +1 @@
<manifest/>

View File

@ -0,0 +1,17 @@
plugins {
id(libs.plugins.android.library.get().pluginId)
}
android {
namespace = "app.revanced.extension"
compileSdk = 33
defaultConfig {
minSdk = 24
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
}

View File

@ -0,0 +1 @@
<manifest/>

View File

@ -0,0 +1,5 @@
dependencies {
compileOnly(project(":extensions:shared:library"))
compileOnly(project(":extensions:tiktok:stub"))
compileOnly(libs.annotation)
}

View File

@ -0,0 +1 @@
<manifest/>

View File

@ -8,7 +8,6 @@ import java.util.Map;
import app.revanced.extension.shared.Logger;
import app.revanced.extension.shared.settings.preference.ReVancedAboutPreference;
@SuppressWarnings("unused")
public class ReVancedTikTokAboutPreference extends ReVancedAboutPreference {
/**

View File

@ -0,0 +1,17 @@
plugins {
id(libs.plugins.android.library.get().pluginId)
}
android {
namespace = "app.revanced.extension"
compileSdk = 33
defaultConfig {
minSdk = 24
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
}

View File

@ -0,0 +1 @@
<manifest/>

View File

@ -0,0 +1,3 @@
dependencies {
compileOnly(libs.appcompat)
}

View File

@ -0,0 +1 @@
<manifest/>

View File

@ -11,6 +11,9 @@ import static android.view.WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD;
import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED;
public class ShowOnLockscreenPatch {
/**
* @noinspection deprecation
*/
public static Window getWindow(AppCompatActivity activity, float brightness) {
Window window = activity.getWindow();

Some files were not shown because too many files have changed in this diff Show More