Wuyx
2016-12-01 a62229dd52507addd75498c136df906c43772a75
commit | author | age
bad748 1 // Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
W 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
21 #import <FBSDKShareKit/FBSDKAppGroupContent.h>
22
23 @protocol FBSDKAppGroupAddDialogDelegate;
24
25 /*!
26  @abstract A dialog for creating app groups.
27  */
28 @interface FBSDKAppGroupAddDialog : NSObject
29
30 /*!
31  @abstract Convenience method to build up an app group dialog with content and a delegate.
32  @param content The content for the app group.
33  @param delegate The receiver's delegate.
34  */
35 + (instancetype)showWithContent:(FBSDKAppGroupContent *)content
36                        delegate:(id<FBSDKAppGroupAddDialogDelegate>)delegate;
37
38 /*!
39  @abstract The receiver's delegate or nil if it doesn't have a delegate.
40  */
41 @property (nonatomic, weak) id<FBSDKAppGroupAddDialogDelegate> delegate;
42
43 /*!
44  @abstract The content for app group.
45  */
46 @property (nonatomic, copy) FBSDKAppGroupContent *content;
47
48 /*!
49  @abstract A Boolean value that indicates whether the receiver can initiate an app group dialog.
50  @discussion May return NO if the appropriate Facebook app is not installed and is required or an access token is
51  required but not available.  This method does not validate the content on the receiver, so this can be checked before
52  building up the content.
53  @see validateWithError:
54  @result YES if the receiver can share, otherwise NO.
55  */
56 - (BOOL)canShow;
57
58 /*!
59  @abstract Begins the app group dialog from the receiver.
60  @result YES if the receiver was able to show the dialog, otherwise NO.
61  */
62 - (BOOL)show;
63
64 /*!
65  @abstract Validates the content on the receiver.
66  @param errorRef If an error occurs, upon return contains an NSError object that describes the problem.
67  @return YES if the content is valid, otherwise NO.
68  */
69 - (BOOL)validateWithError:(NSError *__autoreleasing *)errorRef;
70
71 @end
72
73 /*!
74  @abstract A delegate for FBSDKAppGroupAddDialog.
75  @discussion The delegate is notified with the results of the app group request as long as the application has
76  permissions to receive the information.  For example, if the person is not signed into the containing app, the shower
77  may not be able to distinguish between completion of an app group request and cancellation.
78  */
79 @protocol FBSDKAppGroupAddDialogDelegate <NSObject>
80
81 /*!
82  @abstract Sent to the delegate when the app group request completes without error.
83  @param appGroupAddDialog The FBSDKAppGroupAddDialog that completed.
84  @param results The results from the dialog.  This may be nil or empty.
85  */
86 - (void)appGroupAddDialog:(FBSDKAppGroupAddDialog *)appGroupAddDialog didCompleteWithResults:(NSDictionary *)results;
87
88 /*!
89  @abstract Sent to the delegate when the app group request encounters an error.
90  @param appGroupAddDialog The FBSDKAppGroupAddDialog that completed.
91  @param error The error.
92  */
93 - (void)appGroupAddDialog:(FBSDKAppGroupAddDialog *)appGroupAddDialog didFailWithError:(NSError *)error;
94
95 /*!
96  @abstract Sent to the delegate when the app group dialog is cancelled.
97  @param appGroupAddDialog The FBSDKAppGroupAddDialog that completed.
98  */
99 - (void)appGroupAddDialogDidCancel:(FBSDKAppGroupAddDialog *)appGroupAddDialog;
100
101 @end