Skip to content

Commit

Permalink
Remove deprecated visibilityOutputTag
Browse files Browse the repository at this point in the history
Summary:
it was only added as a part of qe. it is not needed anymore.

I didnt think it will be so many changes related to it... so im adding Adi for double checking what i even removed :P

Reviewed By: adityasharat

Differential Revision: D60281653

fbshipit-source-id: 26dc830975939f7ab61eadac176d97a085a0c9b9
  • Loading branch information
Anna Powolny authored and facebook-github-bot committed Jul 29, 2024
1 parent eace0c7 commit 9c83ea0
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 67 deletions.
10 changes: 0 additions & 10 deletions litho-core/src/main/java/com/facebook/litho/CommonProps.kt
Original file line number Diff line number Diff line change
Expand Up @@ -616,10 +616,6 @@ class CommonProps : LayoutProps, Equivalence<CommonProps?> {
otherProps.layerType(type, paint)
}

fun visibilityOutputTag(visibilityOutputTag: String?) {
otherProps.visibilityOutputTag(visibilityOutputTag)
}

fun copyLayoutProps(layoutProps: LayoutProps) {
_layoutProps?.copyInto(layoutProps)
}
Expand Down Expand Up @@ -694,7 +690,6 @@ class CommonProps : LayoutProps, Equivalence<CommonProps?> {
@DrawableRes private var stateListAnimatorRes: Int = 0
private var layerType = LayerType.LAYER_TYPE_NOT_SET
private var layerPaint: Paint? = null
private var visibilityOutputTag: String? = null

private var systemGestureExclusionZones: MutableList<(Rect) -> Rect>? = null

Expand Down Expand Up @@ -811,10 +806,6 @@ class CommonProps : LayoutProps, Equivalence<CommonProps?> {
layerPaint = paint
}

fun visibilityOutputTag(visibilityOutputTag: String?) {
this.visibilityOutputTag = visibilityOutputTag
}

fun addSystemGestureExclusionZone(exclusion: (Rect) -> Rect) {
(systemGestureExclusionZones
?: ArrayList<(Rect) -> Rect>().also { systemGestureExclusionZones = it })
Expand Down Expand Up @@ -887,7 +878,6 @@ class CommonProps : LayoutProps, Equivalence<CommonProps?> {
node.stateListAnimatorRes(stateListAnimatorRes)
}
node.layerType(layerType, layerPaint)
node.visibilityOutputTag(visibilityOutputTag)

systemGestureExclusionZones?.let { node.addSystemGestureExclusionZones(it) }
}
Expand Down
6 changes: 0 additions & 6 deletions litho-core/src/main/java/com/facebook/litho/Component.java
Original file line number Diff line number Diff line change
Expand Up @@ -2294,12 +2294,6 @@ public T tooltipText(@Nullable String tooltipText) {
return getThis();
}

@Deprecated
public T visibilityOutputTag(@Nullable String visibilityOutputTag) {
mComponent.getOrCreateCommonProps().visibilityOutputTag(visibilityOutputTag);
return getThis();
}

private @Nullable Component getOwner() {
return mContext.getComponentScope();
}
Expand Down
7 changes: 0 additions & 7 deletions litho-core/src/main/java/com/facebook/litho/LithoNode.kt
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,6 @@ open class LithoNode : Node<LithoLayoutContext>, Cloneable {
var layerType: Int = LayerType.LAYER_TYPE_NOT_SET
internal set

var visibilityOutputTag: String? = null
internal set

var importantForAccessibility: Int = ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO
internal set

Expand Down Expand Up @@ -571,10 +568,6 @@ open class LithoNode : Node<LithoLayoutContext>, Cloneable {
}
}

fun visibilityOutputTag(visibilityOutputTag: String?) {
this.visibilityOutputTag = visibilityOutputTag
}

fun fullImpressionHandler(fullImpressionHandler: EventHandler<FullImpressionVisibleEvent>?) {
privateFlags = privateFlags or PFLAG_FULL_IMPRESSION_HANDLER_IS_SET
this.fullImpressionHandler =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,6 @@ internal object LithoReducer {
renderTreeNode?.renderUnit?.id ?: 0,
node.visibleHeightRatio,
node.visibleWidthRatio,
node.visibilityOutputTag,
visibleHandler,
invisibleHandler,
focusedHandler,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,4 @@ interface VisibilityBoundsTransformer {
fun getTransformedLocalVisibleRect(host: ViewGroup): Rect?

fun getViewportRect(view: View): Rect

fun shouldUseTransformedVisibleRect(visibilityOutput: VisibilityOutput): Boolean
}
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,11 @@ private static void processVisibilityOutputsNonInc(

final @Nullable VisibilityBoundsTransformer transformer =
extensionState.getState().mVisibilityBoundsTransformer;
@Nullable Rect transformedLocalVisibleRect = null;
if (transformer != null) {
transformedLocalVisibleRect =
transformer.getTransformedLocalVisibleRect(extensionState.getRootHost());
Rect transformed = transformer.getTransformedLocalVisibleRect(extensionState.getRootHost());
if (transformed != null) {
localVisibleRect = transformed;
}
}

final boolean isTracing = RenderCoreSystrace.isTracing();
Expand All @@ -267,14 +268,9 @@ private static void processVisibilityOutputsNonInc(

final Rect visibilityOutputBounds = visibilityOutput.getBounds();

final boolean shouldUseTransformedVisibleRect =
transformer != null && transformer.shouldUseTransformedVisibleRect(visibilityOutput);
final boolean boundsIntersect =
intersection.setIntersect(
visibilityOutputBounds,
shouldUseTransformedVisibleRect && transformedLocalVisibleRect != null
? transformedLocalVisibleRect
: localVisibleRect);
intersection.setIntersect(visibilityOutputBounds, localVisibleRect);

final boolean isFullyVisible =
boundsIntersect && intersection.equals(visibilityOutputBounds);
final String visibilityOutputId = visibilityOutput.getId();
Expand Down Expand Up @@ -390,27 +386,10 @@ private static void processVisibilityOutputsNonInc(
}
}

Rect transformedViewportRect = null;
if (focusedHandler != null
|| unfocusedHandler != null
|| visibilityChangedHandler != null) {
if (shouldUseTransformedVisibleRect && transformer != null) {
final Host host = getRootHost(extensionState);
if (host != null && (host.getParent() instanceof View)) {
final View parent = (View) host.getParent();
transformedViewportRect = transformer.getViewportRect(parent);
}
}
}

// Check if the component has entered or exited the focused range.
if (focusedHandler != null || unfocusedHandler != null) {
if (isInFocusedRange(
extensionState,
visibilityOutputBounds,
intersection,
shouldUseTransformedVisibleRect,
transformedViewportRect)) {
extensionState, visibilityOutputBounds, intersection, transformer)) {
if (!visibilityItem.isInFocusedRange()) {
visibilityItem.setFocusedRange(true);
if (focusedHandler != null) {
Expand Down Expand Up @@ -441,10 +420,6 @@ private static void processVisibilityOutputsNonInc(
final int visibleHeight = getVisibleHeight(intersection);
int rootHostViewWidth = getRootHostViewWidth(extensionState);
int rootHostViewHeight = getRootHostViewHeight(extensionState);
if (shouldUseTransformedVisibleRect && transformedViewportRect != null) {
rootHostViewWidth = transformedViewportRect.width();
rootHostViewHeight = transformedViewportRect.height();
}

VisibilityUtils.dispatchOnVisibilityChanged(
visibilityChangedHandler,
Expand Down Expand Up @@ -533,8 +508,7 @@ private static boolean isInFocusedRange(
ExtensionState<VisibilityMountExtensionState> extensionState,
Rect componentBounds,
Rect componentVisibleBounds,
boolean shouldUseTransformedVisibleRect,
@Nullable Rect transformedViewportRect) {
@Nullable VisibilityBoundsTransformer transformer) {
final Host host = getRootHost(extensionState);
if (host == null) {
return false;
Expand All @@ -547,10 +521,12 @@ private static boolean isInFocusedRange(
return false;
}

int halfViewportArea = parent.getWidth() * parent.getHeight() / 2;
if (shouldUseTransformedVisibleRect && transformedViewportRect != null) {
halfViewportArea = transformedViewportRect.width() * transformedViewportRect.height() / 2;
}
int halfViewportArea =
(transformer != null)
? transformer.getViewportRect(parent).width()
* transformer.getViewportRect(parent).height()
/ 2
: parent.getWidth() * parent.getHeight() / 2;

final int totalComponentArea = computeRectArea(componentBounds);
final int visibleComponentArea = computeRectArea(componentVisibleBounds);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ class VisibilityOutput(
@JvmField val renderUnitId: Long,
val visibleHeightRatio: Float,
val visibleWidthRatio: Float,
val tag: String?,
val visibleEventHandler: Function<Void?>?,
val invisibleEventHandler: Function<Void?>?,
val focusedEventHandler: Function<Void?>?,
Expand All @@ -54,7 +53,6 @@ class VisibilityOutput(
bounds: Rect,
visibleHeightRatio: Float,
visibleWidthRatio: Float,
tag: String?,
visibleEventHandler: Function<Void?>?,
invisibleEventHandler: Function<Void?>?,
focusedEventHandler: Function<Void?>?,
Expand All @@ -69,7 +67,6 @@ class VisibilityOutput(
0L,
visibleHeightRatio,
visibleWidthRatio,
tag,
visibleEventHandler,
invisibleEventHandler,
focusedEventHandler,
Expand Down

0 comments on commit 9c83ea0

Please sign in to comment.