fix(YouTube - Hide player flyout menu items): Do not hide entire flyout menu for eperimental app targets
Co-Authored-By: LisoUseInAIKyrios <118716522+lisouseinaikyrios@users.noreply.github.com>
This commit is contained in:
parent
af95a58009
commit
20079d267a
2 changed files with 35 additions and 7 deletions
|
|
@ -63,23 +63,48 @@ public final class LithoFilterPatch {
|
|||
final int minimumAscii = 32; // 32 = space character
|
||||
final int maximumAscii = 126; // 127 = delete character
|
||||
final int minimumAsciiStringLength = 4; // Minimum length of an ASCII string to include.
|
||||
// Logger ignores text past 4096 bytes on each line. Must wrap lines otherwise logging is clipped.
|
||||
final int preferredLineLength = 3000; // Preferred length before wrapping on next substring.
|
||||
final int maxLineLength = 3300; // Hard limit to line wrap in the middle of substring.
|
||||
String delimitingCharacter = "❙"; // Non ascii character, to allow easier log filtering.
|
||||
|
||||
final int length = buffer.length;
|
||||
final int lastIndex = length - 1;
|
||||
int start = 0;
|
||||
int end = 0;
|
||||
while (end < length) {
|
||||
int value = buffer[end];
|
||||
if (value < minimumAscii || value > maximumAscii || end == length - 1) {
|
||||
if (end - start >= minimumAsciiStringLength) {
|
||||
for (int i = start; i < end; i++) {
|
||||
int currentLineLength = 0;
|
||||
|
||||
for (int end = 0; end < length; end++) {
|
||||
final int value = buffer[end];
|
||||
final boolean isAscii = (value >= minimumAscii && value <= maximumAscii);
|
||||
final boolean atEnd = (end == lastIndex);
|
||||
|
||||
if (!isAscii || atEnd) {
|
||||
int wordEnd = end + ((atEnd && isAscii) ? 1 : 0);
|
||||
|
||||
if (wordEnd - start >= minimumAsciiStringLength) {
|
||||
for (int i = start; i < wordEnd; i++) {
|
||||
builder.append((char) buffer[i]);
|
||||
currentLineLength++;
|
||||
|
||||
// Hard line limit. Hard wrap the current substring to next logger line.
|
||||
if (currentLineLength >= maxLineLength) {
|
||||
builder.append('\n');
|
||||
currentLineLength = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Wrap after substring if over preferred limit.
|
||||
if (currentLineLength >= preferredLineLength) {
|
||||
builder.append('\n');
|
||||
currentLineLength = 0;
|
||||
}
|
||||
|
||||
builder.append(delimitingCharacter);
|
||||
currentLineLength++;
|
||||
}
|
||||
|
||||
start = end + 1;
|
||||
}
|
||||
end++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,6 +127,9 @@ public final class PlayerFlyoutMenuItemsFilter extends Filter {
|
|||
return false;
|
||||
}
|
||||
|
||||
// 21.x+ fix.
|
||||
if (path.contains("bottom_sheet_list_option.e")) return false;
|
||||
|
||||
return flyoutFilterGroupList.check(buffer).isFiltered();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue