FBSDKInternalUtility.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*
  2. * Copyright (c) Meta Platforms, Inc. and affiliates.
  3. * All rights reserved.
  4. *
  5. * This source code is licensed under the license found in the
  6. * LICENSE file in the root directory of this source tree.
  7. */
  8. #import <Foundation/Foundation.h>
  9. #import <UIKit/UIKit.h>
  10. #import <FBSDKCoreKit/FBSDKAppAvailabilityChecker.h>
  11. #import <FBSDKCoreKit/FBSDKAppURLSchemeProviding.h>
  12. #import <FBSDKCoreKit/FBSDKInternalUtilityProtocol.h>
  13. #import <FBSDKCoreKit/_FBSDKWindowFinding.h>
  14. #if !TARGET_OS_TV
  15. #import <FBSDKCoreKit/FBSDKURLHosting.h>
  16. #endif
  17. @protocol FBSDKErrorCreating;
  18. @protocol FBSDKInfoDictionaryProviding;
  19. @protocol FBSDKSettings;
  20. @protocol __FBSDKLoggerCreating;
  21. NS_ASSUME_NONNULL_BEGIN
  22. NS_SWIFT_NAME(InternalUtility)
  23. @interface FBSDKInternalUtility : NSObject
  24. #if !TARGET_OS_TV
  25. <FBSDKAppAvailabilityChecker, FBSDKAppURLSchemeProviding, FBSDKInternalUtility, FBSDKURLHosting, _FBSDKWindowFinding>
  26. #else
  27. <FBSDKAppAvailabilityChecker, FBSDKAppURLSchemeProviding, FBSDKInternalUtility>
  28. #endif
  29. #if !DEBUG
  30. - (instancetype)init NS_UNAVAILABLE;
  31. + (instancetype)new NS_UNAVAILABLE;
  32. #endif
  33. @property (class, nonnull, readonly) FBSDKInternalUtility *sharedUtility;
  34. /**
  35. Returns bundle for returning localized strings
  36. We assume a convention of a bundle named FBSDKStrings.bundle, otherwise we
  37. return the main bundle.
  38. */
  39. @property (nonatomic, readonly, strong) NSBundle *bundleForStrings;
  40. /**
  41. Tests whether the supplied URL is a valid URL for opening in the browser.
  42. @param URL The URL to test.
  43. @return YES if the URL refers to an http or https resource, otherwise NO.
  44. */
  45. - (BOOL)isBrowserURL:(NSURL *)URL;
  46. /**
  47. Checks equality between 2 objects.
  48. Checks for pointer equality, nils, isEqual:.
  49. @param object The first object to compare.
  50. @param other The second object to compare.
  51. @return YES if the objects are equal, otherwise NO.
  52. */
  53. - (BOOL)object:(id)object isEqualToObject:(id)other;
  54. /// Attempts to find the first UIViewController in the view's responder chain. Returns nil if not found.
  55. - (nullable UIViewController *)viewControllerForView:(UIView *)view;
  56. /// returns true if the url scheme is registered in the CFBundleURLTypes
  57. - (BOOL)isRegisteredURLScheme:(NSString *)urlScheme;
  58. /// returns currently displayed top view controller.
  59. - (nullable UIViewController *)topMostViewController;
  60. /// returns the current key window
  61. - (nullable UIWindow *)findWindow;
  62. #pragma mark - FB Apps Installed
  63. @property (nonatomic, readonly, assign) BOOL isMessengerAppInstalled;
  64. - (BOOL)isRegisteredCanOpenURLScheme:(NSString *)urlScheme;
  65. /**
  66. Internal method exposed to facilitate transition to Swift.
  67. API Subject to change or removal without warning. Do not use.
  68. @warning INTERNAL - DO NOT USE
  69. */
  70. - (void)configureWithInfoDictionaryProvider:(id<FBSDKInfoDictionaryProviding>)infoDictionaryProvider
  71. loggerFactory:(id<__FBSDKLoggerCreating>)loggerFactory
  72. settings:(id<FBSDKSettings>)settings
  73. errorFactory:(id<FBSDKErrorCreating>)errorFactory
  74. NS_SWIFT_NAME(configure(infoDictionaryProvider:loggerFactory:settings:errorFactory:));
  75. @end
  76. NS_ASSUME_NONNULL_END