BFURL.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * Copyright (c) 2014, 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. */
  10. #import <Foundation/Foundation.h>
  11. @class BFAppLink;
  12. /*!
  13. Provides a set of utilities for working with NSURLs, such as parsing of query parameters
  14. and handling for App Link requests.
  15. */
  16. @interface BFURL : NSObject
  17. /*!
  18. Creates a link target from a raw URL.
  19. On success, this posts the BFAppLinkParseEventName measurement event. If you are constructing the BFURL within your application delegate's
  20. application:openURL:sourceApplication:annotation:, you should instead use URLWithInboundURL:sourceApplication:
  21. to support better BFMeasurementEvent notifications
  22. @param url The instance of `NSURL` to create BFURL from.
  23. */
  24. + (BFURL *)URLWithURL:(NSURL *)url;
  25. /*!
  26. Creates a link target from a raw URL received from an external application. This is typically called from the app delegate's
  27. application:openURL:sourceApplication:annotation: and will post the BFAppLinkNavigateInEventName measurement event.
  28. @param url The instance of `NSURL` to create BFURL from.
  29. @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:
  30. */
  31. + (BFURL *)URLWithInboundURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication;
  32. /*!
  33. Gets the target URL. If the link is an App Link, this is the target of the App Link.
  34. Otherwise, it is the url that created the target.
  35. */
  36. @property (nonatomic, strong, readonly) NSURL *targetURL;
  37. /*!
  38. Gets the query parameters for the target, parsed into an NSDictionary.
  39. */
  40. @property (nonatomic, strong, readonly) NSDictionary *targetQueryParameters;
  41. /*!
  42. If this link target is an App Link, this is the data found in al_applink_data.
  43. Otherwise, it is nil.
  44. */
  45. @property (nonatomic, strong, readonly) NSDictionary *appLinkData;
  46. /*!
  47. If this link target is an App Link, this is the data found in extras.
  48. */
  49. @property (nonatomic, strong, readonly) NSDictionary *appLinkExtras;
  50. /*!
  51. The App Link indicating how to navigate back to the referer app, if any.
  52. */
  53. @property (nonatomic, strong, readonly) BFAppLink *appLinkReferer;
  54. /*!
  55. The URL that was used to create this BFURL.
  56. */
  57. @property (nonatomic, strong, readonly) NSURL *inputURL;
  58. /*!
  59. The query parameters of the inputURL, parsed into an NSDictionary.
  60. */
  61. @property (nonatomic, strong, readonly) NSDictionary *inputQueryParameters;
  62. @end