fix(youtube/spoof-app-version): restore watch history preview (#394)

This commit is contained in:
LisoUseInAIKyrios 2023-05-10 00:31:21 +04:00 committed by GitHub
parent 9e6176886b
commit 4c7f737913
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,9 +6,24 @@ import app.revanced.integrations.adremover.AdRemoverAPI;
import app.revanced.integrations.settings.SettingsEnum; import app.revanced.integrations.settings.SettingsEnum;
public class HideBreakingNewsPatch { public class HideBreakingNewsPatch {
//Used by app.revanced.patches.youtube.layout.homepage.breakingnews.patch.BreakingNewsPatch
/**
* When spoofing to app versions older than 17.30.35, the watch history preview bar uses
* the same layout components as the breaking news shelf.
*
* Breaking news does not appear to be present in these older versions anyways.
*/
private static boolean isSpoofingOldVersionWithHorizontalCardListWatchHistory() {
return SettingsEnum.SPOOF_APP_VERSION.getBoolean()
&& SettingsEnum.SPOOF_APP_VERSION_TARGET.getString().compareTo("17.30.35") < 0;
}
/**
* Injection point.
*/
public static void hideBreakingNews(View view) { public static void hideBreakingNews(View view) {
if (!SettingsEnum.HIDE_BREAKING_NEWS.getBoolean()) return; if (!SettingsEnum.HIDE_BREAKING_NEWS.getBoolean()
|| isSpoofingOldVersionWithHorizontalCardListWatchHistory()) return;
AdRemoverAPI.HideViewWithLayout1dp(view); AdRemoverAPI.HideViewWithLayout1dp(view);
} }
} }