Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tvOS] Focus Improvements #807

Closed
wants to merge 48 commits into from

Conversation

alexhillc
Copy link
Contributor

@alexhillc alexhillc commented Feb 24, 2018

  • [ASCollectionDelegate] Adds support for new delegate methods:
    • collectionNode:canFocusItemAtIndexPath:
    • collectionNode:shouldUpdateFocusInContext:
    • collectionNode:didUpdateFocusInContext:withAnimationCoordinator:
    • indexPathForPreferredFocusedViewInCollectionNode:
  • [ASTableDelegate] Adds support for new delegate methods:
    • tableNode:canFocusRowAtIndexPath:
    • tableNode:shouldUpdateFocusInContext:
    • tableNode:didUpdateFocusInContext:withAnimationCoordinator:
    • indexPathForPreferredFocusedViewInTableNode:
  • [ASDisplayNode] Adds new focus convenience block properties so that subclassing nodes to achieve focusable ASDisplayNodes is not necessary:
    • canBecomeFocusedBlock, which cannot be implemented alongside -[ASDisplayNode canBecomeFocused]
    • shouldUpdateFocusBlock , which cannot be implemented alongside -[ASDisplayNode shouldUpdateFocusInContext:]
    • didUpdateFocusBlock, which cannot be implemented alongside -[ASDisplayNode didUpdateFocusInContext:withAnimationCoordinator:]
    • preferredFocusEnvironmentsBlock, which cannot be implemented alongside -[ASDisplayNode preferredFocusEnvironments]
    • preferredFocusedViewBlock, which cannot be implemented alongside -[ASDisplayNode preferredFocusedView]
  • [ASDisplayNode/ASCellNode] Adds bridging for presses API, along with forwarding of those presses:
    • pressesBegan:withEvent:
    • pressesChanged:withEvent:
    • pressesEnded:withEvent:
    • pressesCancelled:withEvent:
  • [ASCellNode] Adds support for new method overrides:
    • canBecomeFocused
    • shouldUpdateFocusInContext:
    • didUpdateFocusInContext:withAnimationCoordinator:
    • setNeedsFocusUpdate
    • updateFocusIfNeeded
    • preferredFocusEnvironments
    • preferredFocusedView
  • General:
    • Re-implements focus engine methods to always defer to the superclass (UIView) implementation if there is no overridden/block implementation of the method.

alexhillc and others added 30 commits December 25, 2017 19:38
[ASMultiplexImageNode] Enables support for Photos framework on tvOS 10+

[ASMultiplexImageNode] Fixes comment depth

[ASAvailability] Adjust logic in AS_AVAILABLE_IOS_TVOS to account for
both versions
Adjusts API_AVAILABLE to minimum deployment target
the built-in solution (more accurately target OS by checking target)
Change AS_AVAILABLE_IOS -> AS_AVAILABLE_IOS_TVOS in places that shoud
allow for both

[ASAvailability] Simplify AS_AVAILABLE_IOS_TVOS
overrides. Removes methods already implemented in
ASDisplayNode+UIViewBridge category.
[ASControlNode] Moves tvOS category declaration to ASControlNode header
[ASImageNode] Moves tvOS category declaration to ASImageNode header
[ASControlNode+Private] Adds private category for ASControlNode to
access private selectors
…fierMinimumLineSpacing, kCTParagraphStyleSpecifierMaximumLineSpacing, kCTParagraphStyleSpecifierLineSpacingAdjustment when mapping CTParagraphStyle onto NSParagraphStyle

[ASTextNode] Uses CoreText-cleansed attributed string when assigning ascender/descender to avoid crash when a CTParagraphStyle is passed as an attribute
[ASImageNode+tvOS] Add missing Foundation import (whoops!)
evaluates to an NSParagraphStyle, pass through to cleansed attributes. This
fixes a bug that would occur if a CTParagraphStyle was passed as an
attribute _alone_ (would not be caught by unsupported attributes
check)
[ASCellNode] Implement _ASCollectionViewCell focus methods
…nimum deployment target was bumped to 9.0

[Focus] Adds convenience blocks onto ASDisplayNode for commonly overridden focus methods + asserts when there is a subclass override as well as block impl
[ASFocus] Removes ASDisplayNode+UIViewBridge implementations of focus
engine methods, since overriding these methods can cause behavior that
is less than ideal for the developer -- instead, these methods will fall
back to the UIView implementation if there are no subclass overrides in
the node
@ghost
Copy link

ghost commented Feb 28, 2018

🚫 CI failed with log

@alexhillc alexhillc changed the base branch from master to 2.6 March 12, 2018 17:48
@alexhillc alexhillc changed the base branch from 2.6 to master March 12, 2018 17:48
@alexhillc alexhillc changed the title Focus Improvements [tvOS] Focus Improvements Mar 12, 2018
… a more effecient way of handling this, but is still cleaner than the alternative
@ghost
Copy link

ghost commented Mar 15, 2018

🚫 CI failed with log

@ghost
Copy link

ghost commented Mar 21, 2018

🚫 CI failed with log

the super implementation of each focus method if not implemented by an
ASFocus block or overridden. This does not solve the issue of being
unable to return the super implementation of _ASCollectionViewCell or
_ASTableViewCell for these methods from a subclass implementation --
will need to look more into this
@alexhillc
Copy link
Contributor Author

Going to close this out and make some fundamental changes to the PR -- this was mostly put together for a project I was working on (in a rush), but many of these changes do not really fit in with the rest of Texture

@alexhillc alexhillc closed this Apr 3, 2018
@ay8s
Copy link
Collaborator

ay8s commented Oct 8, 2018

@alexhillc Curious if you saw any issues with ASControlNodeEventPrimaryActionTriggered being triggers from ASButtonNode's?

@alexhillc
Copy link
Contributor Author

Hey @ay8s - tvOS would require a different implementation of ASControlNode event handling, using UIPresses rather than UITouches. I don't believe Texture forwards UIPresses (from ASDisplayView) to their respective nodes, so that would also need to be implemented before the control node event handling.

@ay8s
Copy link
Collaborator

ay8s commented Oct 9, 2018

@alexhillc That'd do it. Probably a good one to get on the list. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants