2024-01-01 16:33:20 +01:00
|
|
|
package app.revanced.integrations.youtube.patches;
|
2022-12-29 17:46:21 +01:00
|
|
|
|
|
|
|
import android.view.View;
|
|
|
|
|
2024-01-01 16:33:20 +01:00
|
|
|
import app.revanced.integrations.youtube.patches.spoof.SpoofAppVersionPatch;
|
|
|
|
import app.revanced.integrations.youtube.settings.Settings;
|
|
|
|
import app.revanced.integrations.shared.Utils;
|
2022-12-29 17:46:21 +01:00
|
|
|
|
2024-01-01 16:33:20 +01:00
|
|
|
@SuppressWarnings("unused")
|
2022-12-29 17:46:21 +01:00
|
|
|
public class HideBreakingNewsPatch {
|
2023-05-09 22:31:21 +02:00
|
|
|
|
|
|
|
/**
|
2023-11-18 00:50:55 +01:00
|
|
|
* When spoofing to app versions 17.31.00 and older, the watch history preview bar uses
|
2023-05-09 22:31:21 +02:00
|
|
|
* the same layout components as the breaking news shelf.
|
|
|
|
*
|
|
|
|
* Breaking news does not appear to be present in these older versions anyways.
|
|
|
|
*/
|
2023-11-18 00:50:55 +01:00
|
|
|
private static final boolean isSpoofingOldVersionWithHorizontalCardListWatchHistory =
|
2024-03-08 06:10:06 +01:00
|
|
|
SpoofAppVersionPatch.isSpoofingToLessThan("18.01.00");
|
2023-05-09 22:31:21 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Injection point.
|
|
|
|
*/
|
2022-12-29 17:46:21 +01:00
|
|
|
public static void hideBreakingNews(View view) {
|
2024-01-01 16:33:20 +01:00
|
|
|
if (!Settings.HIDE_BREAKING_NEWS.get()
|
2023-11-18 00:50:55 +01:00
|
|
|
|| isSpoofingOldVersionWithHorizontalCardListWatchHistory) return;
|
2024-01-01 16:33:20 +01:00
|
|
|
Utils.hideViewByLayoutParams(view);
|
2022-12-29 17:46:21 +01:00
|
|
|
}
|
|
|
|
}
|