mirror of
https://github.com/revanced/revanced-patches
synced 2025-02-10 05:56:48 +01:00
fix(YouTube - Spoof video streams): Use system language as default iOS audio stream (#4042)
This commit is contained in:
parent
cc40246e60
commit
4017185e76
@ -438,7 +438,7 @@ public abstract class Setting<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (ImportExportCallback callback : importExportCallbacks) {
|
for (ImportExportCallback callback : importExportCallbacks) {
|
||||||
callback.settingsExported(alertDialogContext);
|
callback.settingsImported(alertDialogContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils.showToastLong(numberOfSettingsImported == 0
|
Utils.showToastLong(numberOfSettingsImported == 0
|
||||||
|
@ -72,21 +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(Utils.getContext(), replacementSettings);
|
final boolean rebootNeeded = Setting.importFromJSON(context, replacementSettings);
|
||||||
if (rebootNeeded) {
|
if (rebootNeeded) {
|
||||||
AbstractPreferenceFragment.showRestartDialog(getContext());
|
AbstractPreferenceFragment.showRestartDialog(getContext());
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import java.io.IOException;
|
|||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
|
|
||||||
import app.revanced.extension.shared.Logger;
|
import app.revanced.extension.shared.Logger;
|
||||||
|
import app.revanced.extension.shared.Utils;
|
||||||
import app.revanced.extension.shared.requests.Requester;
|
import app.revanced.extension.shared.requests.Requester;
|
||||||
import app.revanced.extension.shared.requests.Route;
|
import app.revanced.extension.shared.requests.Route;
|
||||||
import app.revanced.extension.youtube.patches.spoof.ClientType;
|
import app.revanced.extension.youtube.patches.spoof.ClientType;
|
||||||
@ -24,6 +25,9 @@ final class PlayerRoutes {
|
|||||||
*/
|
*/
|
||||||
private static final int CONNECTION_TIMEOUT_MILLISECONDS = 10 * 1000; // 10 Seconds.
|
private static final int CONNECTION_TIMEOUT_MILLISECONDS = 10 * 1000; // 10 Seconds.
|
||||||
|
|
||||||
|
private static final String LOCALE_LANGUAGE = Utils.getContext().getResources()
|
||||||
|
.getConfiguration().locale.getLanguage();
|
||||||
|
|
||||||
private PlayerRoutes() {
|
private PlayerRoutes() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,6 +38,8 @@ final class PlayerRoutes {
|
|||||||
JSONObject context = new JSONObject();
|
JSONObject context = new JSONObject();
|
||||||
|
|
||||||
JSONObject client = new JSONObject();
|
JSONObject client = new JSONObject();
|
||||||
|
// Required to use correct default audio channel with iOS.
|
||||||
|
client.put("hl", LOCALE_LANGUAGE);
|
||||||
client.put("clientName", clientType.name());
|
client.put("clientName", clientType.name());
|
||||||
client.put("clientVersion", clientType.clientVersion);
|
client.put("clientVersion", clientType.clientVersion);
|
||||||
client.put("deviceModel", clientType.deviceModel);
|
client.put("deviceModel", clientType.deviceModel);
|
||||||
@ -41,7 +47,6 @@ final class PlayerRoutes {
|
|||||||
if (clientType.androidSdkVersion != null) {
|
if (clientType.androidSdkVersion != null) {
|
||||||
client.put("androidSdkVersion", clientType.androidSdkVersion);
|
client.put("androidSdkVersion", clientType.androidSdkVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
context.put("client", client);
|
context.put("client", client);
|
||||||
|
|
||||||
innerTubeBody.put("context", context);
|
innerTubeBody.put("context", context);
|
||||||
|
@ -30,7 +30,7 @@ public class SponsorBlockSettings {
|
|||||||
public static final Setting.ImportExportCallback SB_IMPORT_EXPORT_CALLBACK = new Setting.ImportExportCallback() {
|
public static final Setting.ImportExportCallback SB_IMPORT_EXPORT_CALLBACK = new Setting.ImportExportCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void settingsImported(@Nullable Context context) {
|
public void settingsImported(@Nullable Context context) {
|
||||||
updateFromImportedSettings();
|
SegmentCategory.loadAllCategoriesFromSettings();
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void settingsExported(@Nullable Context context) {
|
public void settingsExported(@Nullable Context context) {
|
||||||
@ -172,7 +172,7 @@ public class SponsorBlockSettings {
|
|||||||
/**
|
/**
|
||||||
* Export the categories using flatten json (no embedded dictionaries or arrays).
|
* Export the categories using flatten json (no embedded dictionaries or arrays).
|
||||||
*/
|
*/
|
||||||
public static void showExportWarningIfNeeded(@Nullable Context dialogContext) {
|
private static void showExportWarningIfNeeded(@Nullable Context dialogContext) {
|
||||||
Utils.verifyOnMainThread();
|
Utils.verifyOnMainThread();
|
||||||
initialize();
|
initialize();
|
||||||
|
|
||||||
@ -245,11 +245,4 @@ public class SponsorBlockSettings {
|
|||||||
|
|
||||||
SegmentCategory.updateEnabledCategories();
|
SegmentCategory.updateEnabledCategories();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Updates internal data based on {@link Setting} values.
|
|
||||||
*/
|
|
||||||
public static void updateFromImportedSettings() {
|
|
||||||
SegmentCategory.loadAllCategoriesFromSettings();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user