FBTVNavigationTracker.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /**
  2. * Copyright (c) 2018-present, Facebook, Inc.
  3. * All rights reserved.
  4. *
  5. * This source code is licensed under the BSD-style license found in the
  6. * LICENSE file in the root directory of this source tree. An additional grant
  7. * of patent rights can be found in the PATENTS file in the same directory.
  8. */
  9. #import <Foundation/Foundation.h>
  10. #import <XCTest/XCUIElement.h>
  11. #if TARGET_OS_TV
  12. /**
  13. Defines directions to move focuse to.
  14. */
  15. typedef NS_ENUM(NSUInteger, FBTVDirection) {
  16. FBTVDirectionUp = 0,
  17. FBTVDirectionDown = 1,
  18. FBTVDirectionLeft = 2,
  19. FBTVDirectionRight = 3,
  20. FBTVDirectionNone = 4
  21. };
  22. NS_ASSUME_NONNULL_BEGIN
  23. @interface FBTVNavigationItem : NSObject
  24. @end
  25. @interface FBTVNavigationTracker : NSObject
  26. /**
  27. Track the target element's point
  28. @param targetElement A target element which will track
  29. @return An instancce of FBTVNavigationTracker
  30. */
  31. + (instancetype)trackerWithTargetElement: (XCUIElement *) targetElement;
  32. /**
  33. Determine the correct direction to move the focus to the tracked target
  34. element from the currently focused one
  35. @return FBTVDirection to move the focus to
  36. */
  37. - (FBTVDirection)directionToFocusedElement;
  38. @end
  39. NS_ASSUME_NONNULL_END
  40. #endif