Skip to content
This repository has been archived by the owner on Dec 11, 2024. It is now read-only.

Commit

Permalink
feat(YouTube - Spoof app version): Remove obsolete 19.13.37 spoof t…
Browse files Browse the repository at this point in the history
…arget
  • Loading branch information
anddea committed Nov 10, 2024
1 parent f3b55e2 commit 78ffd65
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,16 @@
import static app.revanced.integrations.shared.utils.Utils.runOnMainThreadDelayed;

import android.app.Activity;
import android.app.AlertDialog;

import androidx.annotation.NonNull;

import app.revanced.integrations.shared.settings.BaseSettings;
import app.revanced.integrations.shared.settings.BooleanSetting;
import app.revanced.integrations.shared.utils.Utils;
import app.revanced.integrations.youtube.settings.Settings;
import app.revanced.integrations.youtube.utils.ExtendedUtils;

@SuppressWarnings("unused")
public class InitializationPatch {
private static final BooleanSetting SETTINGS_INITIALIZED = BaseSettings.SETTINGS_INITIALIZED;
private static final BooleanSetting SPOOF_APP_VERSION = Settings.SPOOF_APP_VERSION;
private static final boolean hasRollingNumberIssue = Settings.SPOOF_APP_VERSION_TARGET.defaultValue.startsWith("19");

/**
* Some layouts that depend on litho do not load when the app is first installed.
Expand All @@ -31,13 +26,7 @@ public static void onCreate(@NonNull Activity mActivity) {
if (SETTINGS_INITIALIZED.get()) {
return;
}
runOnMainThreadDelayed(() -> {
if (hasRollingNumberIssue) {
showSpoofAppVersionDialog(mActivity);
} else {
showRestartDialog(mActivity, str("revanced_extended_restart_first_run"), 3500);
}
}, 500);
runOnMainThreadDelayed(() -> showRestartDialog(mActivity, str("revanced_extended_restart_first_run"), 3500), 500);
runOnMainThreadDelayed(() -> SETTINGS_INITIALIZED.save(true), 1000);
}

Expand All @@ -47,18 +36,4 @@ public static void setExtendedUtils(@NonNull Activity mActivity) {
ExtendedUtils.setVersionName();
ExtendedUtils.setPlayerFlyoutMenuAdditionalSettings();
}

private static void showSpoofAppVersionDialog(@NonNull Activity mActivity) {
new AlertDialog.Builder(mActivity)
.setMessage(str("revanced_extended_restart_first_run_rolling_number"))
.setPositiveButton(android.R.string.ok, (dialog, id)
-> Utils.runOnMainThreadDelayed(() -> {
SPOOF_APP_VERSION.save(true);
Utils.restartApp(mActivity);
}, 3500))
.setNegativeButton(android.R.string.cancel, (dialog, id)
-> Utils.runOnMainThreadDelayed(() -> Utils.restartApp(mActivity), 3500))
.setCancelable(false)
.show();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,4 @@ public static boolean OldSeekbarThumbnailsDefaultBoolean() {
return false;
}

// Modified by a patch. Do not touch.
public static String SpoofAppVersionDefaultString() {
return "18.17.43";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,7 @@ public class Settings extends BaseSettings {

public static final EnumSetting<FormFactor> CHANGE_LAYOUT = new EnumSetting<>("revanced_change_layout", FormFactor.ORIGINAL, true);
public static final BooleanSetting SPOOF_APP_VERSION = new BooleanSetting("revanced_spoof_app_version", false, true, "revanced_spoof_app_version_user_dialog_message");
public static final StringSetting SPOOF_APP_VERSION_TARGET = new StringSetting("revanced_spoof_app_version_target",
PatchStatus.SpoofAppVersionDefaultString(), true, parent(SPOOF_APP_VERSION));
public static final StringSetting SPOOF_APP_VERSION_TARGET = new StringSetting("revanced_spoof_app_version_target", "18.17.43", true, parent(SPOOF_APP_VERSION));

// PreferenceScreen: General - Account menu
public static final BooleanSetting HIDE_ACCOUNT_MENU = new BooleanSetting("revanced_hide_account_menu", FALSE);
Expand Down

0 comments on commit 78ffd65

Please sign in to comment.