commit | author | age
|
bad748
|
1 |
/* |
W |
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 |
|
|
11 |
#import <Foundation/Foundation.h> |
|
12 |
|
|
13 |
#import <Bolts/BFAppLink.h> |
|
14 |
|
|
15 |
/*! |
|
16 |
The result of calling navigate on a BFAppLinkNavigation |
|
17 |
*/ |
|
18 |
typedef NS_ENUM(NSInteger, BFAppLinkNavigationType) { |
|
19 |
/*! Indicates that the navigation failed and no app was opened */ |
|
20 |
BFAppLinkNavigationTypeFailure, |
|
21 |
/*! Indicates that the navigation succeeded by opening the URL in the browser */ |
|
22 |
BFAppLinkNavigationTypeBrowser, |
|
23 |
/*! Indicates that the navigation succeeded by opening the URL in an app on the device */ |
|
24 |
BFAppLinkNavigationTypeApp |
|
25 |
}; |
|
26 |
|
|
27 |
@protocol BFAppLinkResolving; |
|
28 |
@class BFTask; |
|
29 |
|
|
30 |
/*! |
|
31 |
Represents a pending request to navigate to an App Link. Most developers will |
|
32 |
simply use navigateToURLInBackground: to open a URL, but developers can build |
|
33 |
custom requests with additional navigation and app data attached to them by |
|
34 |
creating BFAppLinkNavigations themselves. |
|
35 |
*/ |
|
36 |
@interface BFAppLinkNavigation : NSObject |
|
37 |
|
|
38 |
/*! |
|
39 |
The extras for the AppLinkNavigation. This will generally contain application-specific |
|
40 |
data that should be passed along with the request, such as advertiser or affiliate IDs or |
|
41 |
other such metadata relevant on this device. |
|
42 |
*/ |
|
43 |
@property (nonatomic, copy, readonly) NSDictionary *extras; |
|
44 |
|
|
45 |
/*! |
|
46 |
The al_applink_data for the AppLinkNavigation. This will generally contain data common to |
|
47 |
navigation attempts such as back-links, user agents, and other information that may be used |
|
48 |
in routing and handling an App Link request. |
|
49 |
*/ |
|
50 |
@property (nonatomic, copy, readonly) NSDictionary *appLinkData; |
|
51 |
|
|
52 |
/*! The AppLink to navigate to */ |
|
53 |
@property (nonatomic, strong, readonly) BFAppLink *appLink; |
|
54 |
|
|
55 |
/*! Creates an AppLinkNavigation with the given link, extras, and App Link data */ |
|
56 |
+ (instancetype)navigationWithAppLink:(BFAppLink *)appLink |
|
57 |
extras:(NSDictionary *)extras |
|
58 |
appLinkData:(NSDictionary *)appLinkData; |
|
59 |
|
|
60 |
/*! Performs the navigation */ |
|
61 |
- (BFAppLinkNavigationType)navigate:(NSError **)error; |
|
62 |
|
|
63 |
/*! Returns a BFAppLink for the given URL */ |
|
64 |
+ (BFTask *)resolveAppLinkInBackground:(NSURL *)destination; |
|
65 |
|
|
66 |
/*! Returns a BFAppLink for the given URL using the given App Link resolution strategy */ |
|
67 |
+ (BFTask *)resolveAppLinkInBackground:(NSURL *)destination resolver:(id<BFAppLinkResolving>)resolver; |
|
68 |
|
|
69 |
/*! Navigates to a BFAppLink and returns whether it opened in-app or in-browser */ |
|
70 |
+ (BFAppLinkNavigationType)navigateToAppLink:(BFAppLink *)link error:(NSError **)error; |
|
71 |
|
|
72 |
/*! Navigates to a URL (an asynchronous action) and returns a BFNavigationType */ |
|
73 |
+ (BFTask *)navigateToURLInBackground:(NSURL *)destination; |
|
74 |
|
|
75 |
/*! |
|
76 |
Navigates to a URL (an asynchronous action) using the given App Link resolution |
|
77 |
strategy and returns a BFNavigationType |
|
78 |
*/ |
|
79 |
+ (BFTask *)navigateToURLInBackground:(NSURL *)destination resolver:(id<BFAppLinkResolving>)resolver; |
|
80 |
|
|
81 |
/*! |
|
82 |
Gets the default resolver to be used for App Link resolution. If the developer has not set one explicitly, |
|
83 |
a basic, built-in resolver will be used. |
|
84 |
*/ |
|
85 |
+ (id<BFAppLinkResolving>)defaultResolver; |
|
86 |
|
|
87 |
/*! |
|
88 |
Sets the default resolver to be used for App Link resolution. Setting this to nil will revert the |
|
89 |
default resolver to the basic, built-in resolver provided by Bolts. |
|
90 |
*/ |
|
91 |
+ (void)setDefaultResolver:(id<BFAppLinkResolving>)resolver; |
|
92 |
|
|
93 |
@end |