hank
2019-01-22 bf63695cd124ba0c3127f4cc8aa99c737729dd1d
commit | author | age
13e53a 1 // Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
H 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
19 #import <Foundation/Foundation.h>
20 #import <UIKit/UIKit.h>
21
22 #import "FBSDKAppLinkReturnToRefererView.h"
23
24 NS_ASSUME_NONNULL_BEGIN
25
26 @class FBSDKAppLink;
27 @class FBSDKAppLinkReturnToRefererController;
28
29 /*!
30  Protocol that a class can implement in order to be notified when the user has navigated back
31  to the referer of an App Link.
32  */
33 @protocol FBSDKAppLinkReturnToRefererControllerDelegate <NSObject>
34
35 @optional
36
37 /*! Called when the user has tapped to navigate, but before the navigation has been performed. */
38 - (void)returnToRefererController:(FBSDKAppLinkReturnToRefererController *)controller
39             willNavigateToAppLink:(FBSDKAppLink *)appLink;
40
41 /*! Called after the navigation has been attempted, with an indication of whether the referer
42  app link was successfully opened. */
43 - (void)returnToRefererController:(FBSDKAppLinkReturnToRefererController *)controller
44              didNavigateToAppLink:(FBSDKAppLink *)url
45                              type:(FBSDKAppLinkNavigationType)type;
46
47 @end
48
49 /*!
50  A controller class that implements default behavior for a FBSDKAppLinkReturnToRefererView, including
51  the ability to display the view above the navigation bar for navigation-based apps.
52  */
53 NS_EXTENSION_UNAVAILABLE_IOS("Not available in app extension")
54 @interface FBSDKAppLinkReturnToRefererController : NSObject <FBSDKAppLinkReturnToRefererViewDelegate>
55
56 /*!
57  The delegate that will be notified when the user navigates back to the referer.
58  */
59 @property (nonatomic, weak, nullable) id<FBSDKAppLinkReturnToRefererControllerDelegate> delegate;
60
61 /*!
62  The FBSDKAppLinkReturnToRefererView this controller is controlling.
63  */
64 @property (nonatomic, strong) FBSDKAppLinkReturnToRefererView *view;
65
66 /*!
67  Initializes a controller suitable for controlling a FBSDKAppLinkReturnToRefererView that is to be displayed
68  contained within another UIView (i.e., not displayed above the navigation bar).
69  */
70 - (instancetype)init NS_DESIGNATED_INITIALIZER;
71
72 /*!
73  Initializes a controller suitable for controlling a FBSDKAppLinkReturnToRefererView that is to be displayed
74  displayed above the navigation bar.
75  */
76 - (instancetype)initForDisplayAboveNavController:(UINavigationController *)navController;
77
78 /*!
79  Removes the view entirely from the navigation controller it is currently displayed in.
80  */
81 - (void)removeFromNavController;
82
83 /*!
84  Shows the FBSDKAppLinkReturnToRefererView with the specified referer information. If nil or missing data,
85  the view will not be displayed. */
86 - (void)showViewForRefererAppLink:(FBSDKAppLink *)refererAppLink;
87
88 /*!
89  Shows the FBSDKAppLinkReturnToRefererView with referer information extracted from the specified URL.
90  If nil or missing referer App Link data, the view will not be displayed. */
91 - (void)showViewForRefererURL:(NSURL *)url;
92
93 /*!
94  Closes the view, possibly animating it.
95  */
96 - (void)closeViewAnimated:(BOOL)animated;
97
98 @end
99
100 NS_ASSUME_NONNULL_END