chore: Merge branch dev to main (#4041)

This commit is contained in:
oSumAtrIX 2024-12-06 08:33:46 +01:00 committed by GitHub
commit 6359f725bf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
316 changed files with 388 additions and 160 deletions

View File

@ -1,3 +1,10 @@
## [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) ## [5.2.1](https://github.com/ReVanced/revanced-patches/compare/v5.2.0...v5.2.1) (2024-12-04)

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"> <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> </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; import app.revanced.extension.shared.fixes.slink.BaseFixSLinksPatch;
/** @noinspection unused*/ /**
* @noinspection unused
*/
public class FixSLinksPatch extends BaseFixSLinksPatch { public class FixSLinksPatch extends BaseFixSLinksPatch {
static { static {
INSTANCE = new FixSLinksPatch(); 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; 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 { dependencies {
compileOnly(libs.appcompat) implementation(project(":extensions:shared:library"))
compileOnly(libs.annotation)
compileOnly(libs.okhttp)
compileOnly(libs.retrofit)
compileOnly(project(":extensions:shared:stub"))
} }

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.Logger;
import app.revanced.extension.shared.Utils; import app.revanced.extension.shared.Utils;
import app.revanced.extension.youtube.settings.Settings; import app.revanced.extension.shared.settings.BaseSettings;
abstract class Check { abstract class Check {
private static final int NUMBER_OF_TIMES_TO_IGNORE_WARNING_BEFORE_DISABLING = 2; 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. * For debugging and development only.
* Forces all checks to be performed and the check failed dialog to be shown. * 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. * set to -1.
*/ */
static boolean debugAlwaysShowWarning() { 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) { if (alwaysShowWarning) {
Logger.printInfo(() -> "Debug forcing environment check warning to show"); Logger.printInfo(() -> "Debug forcing environment check warning to show");
} }
@ -59,14 +59,14 @@ abstract class Check {
} }
static boolean shouldRun() { 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; < NUMBER_OF_TIMES_TO_IGNORE_WARNING_BEFORE_DISABLING;
} }
static void disableForever() { static void disableForever() {
Logger.printInfo(() -> "Environment checks disabled forever"); 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") @SuppressLint("NewApi")
@ -107,8 +107,8 @@ abstract class Check {
" ", " ",
(dialog, which) -> { (dialog, which) -> {
// Cleanup data if the user incorrectly imported a huge negative number. // Cleanup data if the user incorrectly imported a huge negative number.
final int current = Math.max(0, Settings.CHECK_ENVIRONMENT_WARNINGS_ISSUED.get()); final int current = Math.max(0, BaseSettings.CHECK_ENVIRONMENT_WARNINGS_ISSUED.get());
Settings.CHECK_ENVIRONMENT_WARNINGS_ISSUED.save(current + 1); BaseSettings.CHECK_ENVIRONMENT_WARNINGS_ISSUED.save(current + 1);
dialog.dismiss(); 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 app.revanced.extension.shared.Utils;
import org.json.JSONArray; 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 { public class Route {
private final String 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 = new BooleanSetting("revanced_debug", FALSE);
public static final BooleanSetting DEBUG_STACKTRACE = new BooleanSetting("revanced_debug_stacktrace", FALSE, parent(DEBUG)); 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 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.StringRef;
import app.revanced.extension.shared.Utils; import app.revanced.extension.shared.Utils;
import app.revanced.extension.shared.settings.preference.SharedPrefCategory; import app.revanced.extension.shared.settings.preference.SharedPrefCategory;
import app.revanced.extension.youtube.sponsorblock.SponsorBlockSettings;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; 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. * All settings that were instantiated.
* When a new setting is created, it is automatically added to this list. * 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); setting.writeToJSON(json, importExportKey);
} }
} }
SponsorBlockSettings.showExportWarningIfNeeded(alertDialogContext);
for (ImportExportCallback callback : importExportCallbacks) {
callback.settingsExported(alertDialogContext);
}
if (json.length() == 0) { if (json.length() == 0) {
return ""; return "";
@ -385,7 +411,7 @@ public abstract class Setting<T> {
/** /**
* @return if any settings that require a reboot were changed. * @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 { try {
if (!settingsJsonString.matches("[\\s\\S]*\\{")) { if (!settingsJsonString.matches("[\\s\\S]*\\{")) {
settingsJsonString = '{' + settingsJsonString + '}'; // Restore outer JSON braces settingsJsonString = '{' + settingsJsonString + '}'; // Restore outer JSON braces
@ -411,12 +437,9 @@ public abstract class Setting<T> {
} }
} }
// SB Enum categories are saved using StringSettings. for (ImportExportCallback callback : importExportCallbacks) {
// Which means they need to reload again if changed by other code (such as here). callback.settingsImported(alertDialogContext);
// 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();
Utils.showToastLong(numberOfSettingsImported == 0 Utils.showToastLong(numberOfSettingsImported == 0
? str("revanced_settings_import_reset") ? str("revanced_settings_import_reset")

View File

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

View File

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

View File

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

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.Logger;
import app.revanced.extension.shared.settings.preference.ReVancedAboutPreference; import app.revanced.extension.shared.settings.preference.ReVancedAboutPreference;
@SuppressWarnings("unused")
public class ReVancedTikTokAboutPreference extends ReVancedAboutPreference { 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; import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED;
public class ShowOnLockscreenPatch { public class ShowOnLockscreenPatch {
/**
* @noinspection deprecation
*/
public static Window getWindow(AppCompatActivity activity, float brightness) { public static Window getWindow(AppCompatActivity activity, float brightness) {
Window window = activity.getWindow(); Window window = activity.getWindow();

View File

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

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