mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-11 13:46:17 +00:00
refactor(Spoof video streams): Handle migration of default spoof client for users upgrading from very old patches
This commit is contained in:
@@ -6,6 +6,8 @@ import static app.revanced.extension.shared.settings.Setting.parent;
|
||||
import static app.revanced.extension.shared.spoof.SpoofVideoStreamsPatch.AudioStreamLanguageOverrideAvailability;
|
||||
import static app.revanced.extension.shared.spoof.SpoofVideoStreamsPatch.SpoofiOSAvailability;
|
||||
|
||||
import app.revanced.extension.shared.Logger;
|
||||
import app.revanced.extension.shared.Utils;
|
||||
import app.revanced.extension.shared.spoof.ClientType;
|
||||
|
||||
/**
|
||||
@@ -36,4 +38,16 @@ public class BaseSettings {
|
||||
// Client type must be last spoof setting due to cyclic references.
|
||||
public static final EnumSetting<ClientType> SPOOF_VIDEO_STREAMS_CLIENT_TYPE = new EnumSetting<>("revanced_spoof_video_streams_client_type", ClientType.ANDROID_VR_NO_AUTH, true, parent(SPOOF_VIDEO_STREAMS));
|
||||
|
||||
static {
|
||||
// Data migration fix for YT Music users updating from very old patches that always
|
||||
// stored default values in preference object, which requires manually updating
|
||||
// the setting if the default changes. Package name may not contain "youtube.music"
|
||||
// if the user has used change package name patch, but this will detect users
|
||||
// with default installations.
|
||||
if (!SPOOF_VIDEO_STREAMS_CLIENT_TYPE.isSetToDefault()
|
||||
&& Utils.getContext().getPackageName().contains("youtube.music")) {
|
||||
Logger.printInfo(() -> "Resetting spoof client from: " + SPOOF_VIDEO_STREAMS_CLIENT_TYPE.get());
|
||||
SPOOF_VIDEO_STREAMS_CLIENT_TYPE.resetToDefault();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user