From a673c74eddb81b7e1aec0a3535f6041a81ad37ae Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Tue, 17 Sep 2024 16:50:48 -0400 Subject: [PATCH] fix: Properly migrate very old SB user id This migration is probably no longer needed since spoof client required everyone to update, but might as well keep this single non recoverable migration a little longer just in case. --- .../integrations/youtube/settings/Settings.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/app/revanced/integrations/youtube/settings/Settings.java b/app/src/main/java/app/revanced/integrations/youtube/settings/Settings.java index eade93d828..d38aa427d0 100644 --- a/app/src/main/java/app/revanced/integrations/youtube/settings/Settings.java +++ b/app/src/main/java/app/revanced/integrations/youtube/settings/Settings.java @@ -10,6 +10,7 @@ import static app.revanced.integrations.youtube.sponsorblock.objects.CategoryBehaviour.*; import app.revanced.integrations.shared.settings.*; +import app.revanced.integrations.shared.settings.preference.SharedPrefCategory; import app.revanced.integrations.youtube.patches.AlternativeThumbnailsPatch.DeArrowAvailability; import app.revanced.integrations.youtube.patches.AlternativeThumbnailsPatch.StillImagesAvailability; import app.revanced.integrations.youtube.patches.AlternativeThumbnailsPatch.ThumbnailOption; @@ -17,7 +18,6 @@ import app.revanced.integrations.youtube.patches.spoof.SpoofClientPatch; import app.revanced.integrations.youtube.sponsorblock.SponsorBlockSettings; -@SuppressWarnings("deprecation") public class Settings extends BaseSettings { // Video public static final BooleanSetting RESTORE_OLD_VIDEO_QUALITY_MENU = new BooleanSetting("revanced_restore_old_video_quality_menu", TRUE); @@ -294,7 +294,7 @@ public class Settings extends BaseSettings { * Do not use directly, instead use {@link SponsorBlockSettings} */ public static final StringSetting SB_PRIVATE_USER_ID = new StringSetting("sb_private_user_id_Do_Not_Share", ""); - public static final StringSetting DEPRECATED_SB_UUID_OLD_MIGRATION_SETTING = new StringSetting("uuid", ""); // Delete sometime in 2025 + public static final StringSetting DEPRECATED_SB_UUID_OLD_MIGRATION_SETTING = new StringSetting("uuid", ""); // Delete sometime in early 2025 public static final IntegerSetting SB_CREATE_NEW_SEGMENT_STEP = new IntegerSetting("sb_create_new_segment_step", 150, parent(SB_ENABLED)); public static final BooleanSetting SB_VOTING_BUTTON = new BooleanSetting("sb_voting_button", FALSE, parent(SB_ENABLED)); public static final BooleanSetting SB_CREATE_NEW_SEGMENT = new BooleanSetting("sb_create_new_segment", FALSE, parent(SB_ENABLED)); @@ -337,9 +337,14 @@ public class Settings extends BaseSettings { static { // region Migration - // Do _not_ delete this SB private user id migration property until sometime in 2024. + // Do _not_ delete this SB private user id migration property until sometime in early 2025. // This is the only setting that cannot be reconfigured if lost, // and more time should be given for users who rarely upgrade. + SharedPrefCategory sbPrefs = new SharedPrefCategory("sponsor-block"); + String key = DEPRECATED_SB_UUID_OLD_MIGRATION_SETTING.key + .substring(3); // Remove the "sb_" prefix, as old categories are saved without it. + migrateFromOldPreferences(sbPrefs, DEPRECATED_SB_UUID_OLD_MIGRATION_SETTING, key); + migrateOldSettingToNew(DEPRECATED_SB_UUID_OLD_MIGRATION_SETTING, SB_PRIVATE_USER_ID); // endregion