FBSDKAppLinkResolver.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. // Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
  2. //
  3. // You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
  4. // copy, modify, and distribute this software in source code or binary form for use
  5. // in connection with the web services and APIs provided by Facebook.
  6. //
  7. // As with any software that integrates with the Facebook platform, your use of
  8. // this software is subject to the Facebook Developer Principles and Policies
  9. // [http://developers.facebook.com/policy/]. This copyright notice shall be
  10. // included in all copies or substantial portions of the software.
  11. //
  12. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  14. // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  15. // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  16. // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  17. // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  18. #import <Foundation/Foundation.h>
  19. #import "FBSDKAppLinkResolving.h"
  20. @class BFTask;
  21. // Check if Bolts.framework is available for import
  22. #if __has_include(<Bolts/BFAppLinkResolving.h>)
  23. // Import it if it's available
  24. #import <Bolts/BFAppLinkResolving.h>
  25. #else
  26. // Otherwise - redeclare BFAppLinkResolving protocol to resolve the problem of missing symbols
  27. // Please note: Bolts.framework is still required for AppLink resolving to work,
  28. // but this allows FBSDKCoreKit to weakly link Bolts.framework as well as this enables clang modulemaps to work.
  29. /**
  30. Implement this protocol to provide an alternate strategy for resolving
  31. App Links that may include pre-fetching, caching, or querying for App Link
  32. data from an index provided by a service provider.
  33. */
  34. DEPRECATED_MSG_ATTRIBUTE("Use `FBSDKAppLinkResolving`")
  35. @protocol BFAppLinkResolving <NSObject>
  36. /**
  37. Asynchronously resolves App Link data for a given URL.
  38. @param url The URL to resolve into an App Link.
  39. @return A BFTask that will return a BFAppLink for the given URL.
  40. */
  41. - (BFTask *)appLinkFromURLInBackground:(NSURL *)url
  42. DEPRECATED_MSG_ATTRIBUTE("Use `appLinkFromURL:handler:`");
  43. @end
  44. #endif
  45. /**
  46. Provides an implementation of the BFAppLinkResolving protocol that uses the Facebook App Link
  47. Index API to resolve App Links given a URL. It also provides an additional helper method that can resolve
  48. multiple App Links in a single call.
  49. Usage of this type requires a client token. See `[FBSDKSettings setClientToken:]` and linking
  50. Bolts.framework
  51. */
  52. #pragma clang diagnostic push
  53. #pragma clang diagnostic ignored "-Wdeprecated-declarations"
  54. @interface FBSDKAppLinkResolver : NSObject<FBSDKAppLinkResolving, BFAppLinkResolving>
  55. #pragma clang diagnostic pop
  56. /**
  57. Asynchronously resolves App Link data for multiple URLs.
  58. @param urls An array of NSURLs to resolve into App Links.
  59. @return A BFTask that will return dictionary mapping input NSURLs to their
  60. corresponding BFAppLink.
  61. You should set the client token before making this call. See `[FBSDKSettings setClientToken:]`
  62. */
  63. - (BFTask *)appLinksFromURLsInBackground:(NSArray<NSURL *> *)urls
  64. DEPRECATED_MSG_ATTRIBUTE("Use `appLinkFromURLs:handler:`");
  65. /**
  66. Asynchronously resolves App Link data for a given URL.
  67. @param url The URL to resolve into an App Link.
  68. @return A BFTask that will return a BFAppLink for the given URL.
  69. */
  70. - (BFTask *)appLinkFromURLInBackground:(NSURL *)url
  71. DEPRECATED_MSG_ATTRIBUTE("Use `appLinkFromURL:handler:`");
  72. /**
  73. Asynchronously resolves App Link data for a given array of URLs.
  74. @param urls The URLs to resolve into an App Link.
  75. @param handler The completion block that will return an App Link for the given URL.
  76. */
  77. - (void)appLinksFromURLs:(NSArray<NSURL *> *)urls handler:(FBSDKAppLinksFromURLArrayHandler)handler
  78. NS_EXTENSION_UNAVAILABLE_IOS("Not available in app extension");
  79. /**
  80. Allocates and initializes a new instance of FBSDKAppLinkResolver.
  81. */
  82. + (instancetype)resolver;
  83. @end