fix(Spotify): Fix Hide Create button
and Sanitize sharing links
for older but supported app targets (#5159)
This commit is contained in:
@ -37,20 +37,24 @@ public final class HideCreateButtonPatch {
|
||||
return null;
|
||||
}
|
||||
|
||||
String stringifiedNavigationBarItem = navigationBarItem.toString();
|
||||
try {
|
||||
String stringifiedNavigationBarItem = navigationBarItem.toString();
|
||||
|
||||
for (ComponentFilter componentFilter : CREATE_BUTTON_COMPONENT_FILTERS) {
|
||||
if (componentFilter.filterUnavailable()) {
|
||||
Logger.printInfo(() -> "returnNullIfIsCreateButton: Filter " +
|
||||
componentFilter.getFilterRepresentation() + " not available, skipping");
|
||||
continue;
|
||||
}
|
||||
for (ComponentFilter componentFilter : CREATE_BUTTON_COMPONENT_FILTERS) {
|
||||
if (componentFilter.filterUnavailable()) {
|
||||
Logger.printInfo(() -> "returnNullIfIsCreateButton: Filter " +
|
||||
componentFilter.getFilterRepresentation() + " not available, skipping");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (stringifiedNavigationBarItem.contains(componentFilter.getFilterValue())) {
|
||||
Logger.printInfo(() -> "Hiding Create button because the navigation bar item " + navigationBarItem +
|
||||
" matched the filter " + componentFilter.getFilterRepresentation());
|
||||
return null;
|
||||
if (stringifiedNavigationBarItem.contains(componentFilter.getFilterValue())) {
|
||||
Logger.printInfo(() -> "Hiding Create button because the navigation bar item " +
|
||||
navigationBarItem + " matched the filter " + componentFilter.getFilterRepresentation());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
Logger.printException(() -> "returnNullIfIsCreateButton failure", ex);
|
||||
}
|
||||
|
||||
return navigationBarItem;
|
||||
|
@ -202,37 +202,41 @@ public final class UnlockPremiumPatch {
|
||||
return false;
|
||||
}
|
||||
|
||||
String stringifiedContextMenuItem = contextMenuItem.toString();
|
||||
try {
|
||||
String stringifiedContextMenuItem = contextMenuItem.toString();
|
||||
|
||||
for (List<ComponentFilter> componentFilters : CONTEXT_MENU_ITEMS_COMPONENT_FILTERS) {
|
||||
boolean allMatch = true;
|
||||
StringBuilder matchedFilterRepresentations = new StringBuilder();
|
||||
for (List<ComponentFilter> componentFilters : CONTEXT_MENU_ITEMS_COMPONENT_FILTERS) {
|
||||
boolean allMatch = true;
|
||||
StringBuilder matchedFilterRepresentations = new StringBuilder();
|
||||
|
||||
for (int i = 0, filterSize = componentFilters.size(); i < filterSize; i++) {
|
||||
ComponentFilter componentFilter = componentFilters.get(i);
|
||||
for (int i = 0, filterSize = componentFilters.size(); i < filterSize; i++) {
|
||||
ComponentFilter componentFilter = componentFilters.get(i);
|
||||
|
||||
if (componentFilter.filterUnavailable()) {
|
||||
Logger.printInfo(() -> "isFilteredContextMenuItem: Filter " +
|
||||
componentFilter.getFilterRepresentation() + " not available, skipping");
|
||||
continue;
|
||||
if (componentFilter.filterUnavailable()) {
|
||||
Logger.printInfo(() -> "isFilteredContextMenuItem: Filter " +
|
||||
componentFilter.getFilterRepresentation() + " not available, skipping");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!stringifiedContextMenuItem.contains(componentFilter.getFilterValue())) {
|
||||
allMatch = false;
|
||||
break;
|
||||
}
|
||||
|
||||
matchedFilterRepresentations.append(componentFilter.getFilterRepresentation());
|
||||
if (i < filterSize - 1) {
|
||||
matchedFilterRepresentations.append(", ");
|
||||
}
|
||||
}
|
||||
|
||||
if (!stringifiedContextMenuItem.contains(componentFilter.getFilterValue())) {
|
||||
allMatch = false;
|
||||
break;
|
||||
}
|
||||
|
||||
matchedFilterRepresentations.append(componentFilter.getFilterRepresentation());
|
||||
if (i < filterSize - 1) {
|
||||
matchedFilterRepresentations.append(", ");
|
||||
if (allMatch) {
|
||||
Logger.printInfo(() -> "Filtering context menu item " + stringifiedContextMenuItem +
|
||||
" because the following filters matched: " + matchedFilterRepresentations);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (allMatch) {
|
||||
Logger.printInfo(() -> "Filtering context menu item " + stringifiedContextMenuItem +
|
||||
" because the following filters matched: " + matchedFilterRepresentations);
|
||||
return true;
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
Logger.printException(() -> "isFilteredContextMenuItem failure", ex);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user