FBSDKAppLinkUtility.h 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. #if !TARGET_OS_TV
  9. #import <Foundation/Foundation.h>
  10. @protocol FBSDKInfoDictionaryProviding;
  11. @protocol FBSDKUserIDProviding;
  12. NS_ASSUME_NONNULL_BEGIN
  13. /**
  14. Describes the callback for fetchDeferredAppLink.
  15. @param url the url representing the deferred App Link
  16. @param error the error during the request, if any
  17. The url may also have a fb_click_time_utc query parameter that
  18. represents when the click occurred that caused the deferred App Link to be created.
  19. */
  20. typedef void (^ FBSDKURLBlock)(NSURL *_Nullable url, NSError *_Nullable error)
  21. NS_SWIFT_NAME(URLBlock);
  22. /// Class containing App Links related utility methods.
  23. NS_SWIFT_NAME(AppLinkUtility)
  24. @interface FBSDKAppLinkUtility : NSObject
  25. - (instancetype)init NS_UNAVAILABLE;
  26. + (instancetype)new NS_UNAVAILABLE;
  27. /**
  28. Call this method from the main thread to fetch deferred applink data if you use Mobile App
  29. Engagement Ads (https://developers.facebook.com/docs/ads-for-apps/mobile-app-ads-engagement).
  30. This may require a network round trip. If successful, the handler is invoked with the link
  31. data (this will only return a valid URL once, and future calls will result in a nil URL
  32. value in the callback).
  33. @param handler the handler to be invoked if there is deferred App Link data
  34. The handler may contain an NSError instance to capture any errors. In the
  35. common case where there simply was no app link data, the NSError instance will be nil.
  36. This method should only be called from a location that occurs after any launching URL has
  37. been processed (e.g., you should call this method from your application delegate's
  38. applicationDidBecomeActive:).
  39. */
  40. + (void)fetchDeferredAppLink:(nullable FBSDKURLBlock)handler;
  41. /**
  42. Call this method to fetch promotion code from the url, if it's present.
  43. @param url App Link url that was passed to the app.
  44. @return Promotion code string.
  45. Call this method to fetch App Invite Promotion Code from applink if present.
  46. This can be used to fetch the promotion code that was associated with the invite when it
  47. was created. This method should be called with the url from the openURL method.
  48. */
  49. + (nullable NSString *)appInvitePromotionCodeFromURL:(NSURL *)url;
  50. /**
  51. Check whether the scheme is defined in the app's URL schemes.
  52. @param scheme the scheme of App Link URL
  53. @return YES if the scheme is defined, otherwise NO.
  54. */
  55. + (BOOL)isMatchURLScheme:(NSString *)scheme;
  56. /**
  57. Internal method exposed to facilitate transition to Swift.
  58. API Subject to change or removal without warning. Do not use.
  59. @warning INTERNAL - DO NOT USE
  60. */
  61. // UNCRUSTIFY_FORMAT_OFF
  62. + (void)configureWithGraphRequestFactory:(id<FBSDKGraphRequestFactory>)graphRequestFactory
  63. infoDictionaryProvider:(id<FBSDKInfoDictionaryProviding>)infoDictionaryProvider
  64. settings:(id<FBSDKSettings>)settings
  65. appEventsConfigurationProvider:(id<FBSDKAppEventsConfigurationProviding>)appEventsConfigurationProvider
  66. advertiserIDProvider:(id<FBSDKAdvertiserIDProviding>)advertiserIDProvider
  67. appEventsDropDeterminer:(id<FBSDKAppEventDropDetermining>)appEventsDropDeterminer
  68. appEventParametersExtractor:(id<FBSDKAppEventParametersExtracting>)appEventParametersExtractor
  69. appLinkURLFactory:(id<FBSDKAppLinkURLCreating>)appLinkURLFactory
  70. userIDProvider:(id<FBSDKUserIDProviding>)userIDProvider
  71. userDataStore:(id<FBSDKUserDataPersisting>)userDataStore
  72. NS_SWIFT_NAME(configure(graphRequestFactory:infoDictionaryProvider:settings:appEventsConfigurationProvider:advertiserIDProvider:appEventsDropDeterminer:appEventParametersExtractor:appLinkURLFactory:userIDProvider:userDataStore:));
  73. // UNCRUSTIFY_FORMAT_ON
  74. @end
  75. NS_ASSUME_NONNULL_END
  76. #endif