FBSDKURL.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. NS_ASSUME_NONNULL_BEGIN
  20. @class FBSDKAppLink;
  21. /*!
  22. Provides a set of utilities for working with NSURLs, such as parsing of query parameters
  23. and handling for App Link requests.
  24. */
  25. @interface FBSDKURL : NSObject
  26. /*!
  27. Creates a link target from a raw URL.
  28. On success, this posts the FBSDKAppLinkParseEventName measurement event. If you are constructing the FBSDKURL within your application delegate's
  29. application:openURL:sourceApplication:annotation:, you should instead use URLWithInboundURL:sourceApplication:
  30. to support better FBSDKMeasurementEvent notifications
  31. @param url The instance of `NSURL` to create FBSDKURL from.
  32. */
  33. + (FBSDKURL *)URLWithURL:(NSURL *)url;
  34. /*!
  35. Creates a link target from a raw URL received from an external application. This is typically called from the app delegate's
  36. application:openURL:sourceApplication:annotation: and will post the FBSDKAppLinkNavigateInEventName measurement event.
  37. @param url The instance of `NSURL` to create FBSDKURL from.
  38. @param sourceApplication the bundle ID of the app that is requesting your app to open the URL. The same sourceApplication in application:openURL:sourceApplication:annotation:
  39. */
  40. + (FBSDKURL *)URLWithInboundURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication;
  41. /*!
  42. Gets the target URL. If the link is an App Link, this is the target of the App Link.
  43. Otherwise, it is the url that created the target.
  44. */
  45. @property (nonatomic, strong, readonly) NSURL *targetURL;
  46. /*!
  47. Gets the query parameters for the target, parsed into an NSDictionary.
  48. */
  49. @property (nonatomic, strong, readonly) NSDictionary<NSString *, id> *targetQueryParameters;
  50. /*!
  51. If this link target is an App Link, this is the data found in al_applink_data.
  52. Otherwise, it is nil.
  53. */
  54. @property (nonatomic, strong, readonly) NSDictionary<NSString *, id> *appLinkData;
  55. /*!
  56. If this link target is an App Link, this is the data found in extras.
  57. */
  58. @property (nonatomic, strong, readonly) NSDictionary<NSString *, id> *appLinkExtras;
  59. /*!
  60. The App Link indicating how to navigate back to the referer app, if any.
  61. */
  62. @property (nonatomic, strong, readonly) FBSDKAppLink *appLinkReferer;
  63. /*!
  64. The URL that was used to create this FBSDKURL.
  65. */
  66. @property (nonatomic, strong, readonly) NSURL *inputURL;
  67. /*!
  68. The query parameters of the inputURL, parsed into an NSDictionary.
  69. */
  70. @property (nonatomic, strong, readonly) NSDictionary<NSString *, id> *inputQueryParameters;
  71. @end
  72. NS_ASSUME_NONNULL_END