Skip to content

Commit

Permalink
fix(YouTube Music - Spoof app version): ListPreference sometimes sele…
Browse files Browse the repository at this point in the history
…cts wrong values
  • Loading branch information
anddea committed Oct 15, 2024
1 parent 3fbf316 commit 88488f6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@ public static String getVersionOverride(String version) {
return Settings.SPOOF_APP_VERSION_TARGET.get();
}

public static String getSpoofAppVersionDefault() {
return "6.11.52";
}

// endregion

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import androidx.annotation.NonNull;

import app.revanced.integrations.music.patches.general.GeneralPatch;
import app.revanced.integrations.shared.settings.BaseSettings;
import app.revanced.integrations.shared.settings.BooleanSetting;
import app.revanced.integrations.shared.settings.FloatSetting;
Expand Down Expand Up @@ -103,7 +104,7 @@ public class Settings extends BaseSettings {
public static final BooleanSetting REMOVE_VIEWER_DISCRETION_DIALOG = new BooleanSetting("revanced_remove_viewer_discretion_dialog", FALSE);
public static final BooleanSetting RESTORE_OLD_STYLE_LIBRARY_SHELF = new BooleanSetting("revanced_restore_old_style_library_shelf", FALSE, true);
public static final BooleanSetting SPOOF_APP_VERSION = new BooleanSetting("revanced_spoof_app_version", FALSE, true);
public static final StringSetting SPOOF_APP_VERSION_TARGET = new StringSetting("revanced_spoof_app_version_target", "4.27.53", true);
public static final StringSetting SPOOF_APP_VERSION_TARGET = new StringSetting("revanced_spoof_app_version_target", GeneralPatch.getSpoofAppVersionDefault(), true);


// PreferenceScreen: Navigation bar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public void onCreate(Bundle savedInstanceState) {
} else if (settings.equals(SB_API_URL)) {
SponsorBlockApiUrlPreference.showDialog(mActivity);
} else if (settings.equals(SPOOF_APP_VERSION_TARGET)) {
ResettableListPreference.showDialog(mActivity, stringSetting, -1);
ResettableListPreference.showDialog(mActivity, stringSetting, 0);
} else {
Logger.printDebug(() -> "Failed to find the right value: " + dataString);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ public static void showDialog(Activity mActivity, @NonNull Setting<String> setti
final String[] mEntryValues = getStringArray(entryValueKey);

final int findIndex = Arrays.binarySearch(mEntryValues, setting.get());
if (defaultIndex == -1) defaultIndex = mEntryValues.length - 1;
mClickedDialogEntryIndex = findIndex >= 0 ? findIndex : defaultIndex;

getDialogBuilder(mActivity)
Expand Down

0 comments on commit 88488f6

Please sign in to comment.