fix(YouTube - Hide layout components): Prevent app from crashing on startup

The application crashes sporadically when a field is not initialized yet in a static context.
This commit is contained in:
oSumAtrIX 2023-11-27 20:02:59 +01:00
parent 6520499a27
commit c2112e066a
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4

View File

@ -12,8 +12,10 @@ import app.revanced.integrations.utils.StringTrieSearch;
public final class LayoutComponentsFilter extends Filter {
private final StringTrieSearch exceptions = new StringTrieSearch();
private static final StringTrieSearch mixPlaylistsExceptions = new StringTrieSearch();
private static ByteArrayAsStringFilterGroup mixPlaylistsExceptions2;
private static final ByteArrayAsStringFilterGroup mixPlaylistsExceptions2 = new ByteArrayAsStringFilterGroup(
null,
"cell_description_body"
);
private final CustomFilterGroup custom;
private static final ByteArrayAsStringFilterGroup mixPlaylists = new ByteArrayAsStringFilterGroup(
@ -25,6 +27,13 @@ public final class LayoutComponentsFilter extends Filter {
private final StringFilterGroup notifyMe;
private final StringFilterGroup expandableMetadata;
static {
mixPlaylistsExceptions.addPatterns(
"V.ED", // Playlist browse id.
"java.lang.ref.WeakReference"
);
}
@RequiresApi(api = Build.VERSION_CODES.N)
public LayoutComponentsFilter() {
exceptions.addPatterns(
@ -35,16 +44,6 @@ public final class LayoutComponentsFilter extends Filter {
"library_recent_shelf"
);
mixPlaylistsExceptions.addPatterns(
"V.ED", // Playlist browse id.
"java.lang.ref.WeakReference"
);
mixPlaylistsExceptions2 = new ByteArrayAsStringFilterGroup(
null,
"cell_description_body"
);
custom = new CustomFilterGroup(
SettingsEnum.CUSTOM_FILTER,
SettingsEnum.CUSTOM_FILTER_STRINGS
@ -272,7 +271,6 @@ public final class LayoutComponentsFilter extends Filter {
LogHelper.printDebug(() -> "Filtered mix playlist");
return true;
}
public static boolean showWatermark() {