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/FBSDKGameRequestContent.h> |
|
22 |
|
e81c27
|
23 |
NS_ASSUME_NONNULL_BEGIN |
H |
24 |
|
bad748
|
25 |
@protocol FBSDKGameRequestDialogDelegate; |
W |
26 |
|
9febd9
|
27 |
/** |
W |
28 |
A dialog for sending game requests. |
bad748
|
29 |
*/ |
e81c27
|
30 |
NS_SWIFT_NAME(GameRequestDialog) |
bad748
|
31 |
@interface FBSDKGameRequestDialog : NSObject |
W |
32 |
|
e81c27
|
33 |
- (instancetype)init NS_DESIGNATED_INITIALIZER |
H |
34 |
NS_SWIFT_UNAVAILABLE("Use init(content:delegate:) instead"); |
|
35 |
+ (instancetype)new NS_UNAVAILABLE; |
|
36 |
|
9febd9
|
37 |
/** |
e81c27
|
38 |
Convenience method to build up a game request with content and a delegate. |
13e53a
|
39 |
@param content The content for the game request. |
H |
40 |
@param delegate The receiver's delegate. |
bad748
|
41 |
*/ |
e81c27
|
42 |
+ (instancetype)dialogWithContent:(FBSDKGameRequestContent *)content |
H |
43 |
delegate:(nullable id<FBSDKGameRequestDialogDelegate>)delegate |
|
44 |
NS_SWIFT_NAME(init(content:delegate:)); |
|
45 |
|
|
46 |
/** |
|
47 |
Convenience method to build up and show a game request with content and a delegate. |
|
48 |
@param content The content for the game request. |
|
49 |
@param delegate The receiver's delegate. |
|
50 |
*/ |
|
51 |
+ (instancetype)showWithContent:(FBSDKGameRequestContent *)content |
|
52 |
delegate:(nullable id<FBSDKGameRequestDialogDelegate>)delegate |
|
53 |
NS_SWIFT_UNAVAILABLE("Use init(content:delegate:).show() instead"); |
bad748
|
54 |
|
9febd9
|
55 |
/** |
W |
56 |
The receiver's delegate or nil if it doesn't have a delegate. |
bad748
|
57 |
*/ |
e81c27
|
58 |
@property (nonatomic, weak, nullable) id<FBSDKGameRequestDialogDelegate> delegate; |
bad748
|
59 |
|
9febd9
|
60 |
/** |
W |
61 |
The content for game request. |
bad748
|
62 |
*/ |
W |
63 |
@property (nonatomic, copy) FBSDKGameRequestContent *content; |
|
64 |
|
9febd9
|
65 |
/** |
W |
66 |
Specifies whether frictionless requests are enabled. |
bad748
|
67 |
*/ |
e81c27
|
68 |
@property (nonatomic, assign, getter=isFrictionlessRequestsEnabled) BOOL frictionlessRequestsEnabled; |
bad748
|
69 |
|
9febd9
|
70 |
/** |
W |
71 |
A Boolean value that indicates whether the receiver can initiate a game request. |
|
72 |
|
|
73 |
May return NO if the appropriate Facebook app is not installed and is required or an access token is |
bad748
|
74 |
required but not available. This method does not validate the content on the receiver, so this can be checked before |
W |
75 |
building up the content. |
9febd9
|
76 |
|
13e53a
|
77 |
@see validateWithError: |
H |
78 |
@return YES if the receiver can share, otherwise NO. |
bad748
|
79 |
*/ |
13e53a
|
80 |
@property (nonatomic, readonly) BOOL canShow; |
bad748
|
81 |
|
9febd9
|
82 |
/** |
W |
83 |
Begins the game request from the receiver. |
13e53a
|
84 |
@return YES if the receiver was able to show the dialog, otherwise NO. |
bad748
|
85 |
*/ |
W |
86 |
- (BOOL)show; |
|
87 |
|
9febd9
|
88 |
/** |
W |
89 |
Validates the content on the receiver. |
13e53a
|
90 |
@param errorRef If an error occurs, upon return contains an NSError object that describes the problem. |
H |
91 |
@return YES if the content is valid, otherwise NO. |
bad748
|
92 |
*/ |
W |
93 |
- (BOOL)validateWithError:(NSError *__autoreleasing *)errorRef; |
|
94 |
|
|
95 |
@end |
|
96 |
|
9febd9
|
97 |
/** |
W |
98 |
A delegate for FBSDKGameRequestDialog. |
|
99 |
|
|
100 |
The delegate is notified with the results of the game request as long as the application has permissions to |
bad748
|
101 |
receive the information. For example, if the person is not signed into the containing app, the shower may not be able |
W |
102 |
to distinguish between completion of a game request and cancellation. |
|
103 |
*/ |
e81c27
|
104 |
NS_SWIFT_NAME(GameRequestDialogDelegate) |
bad748
|
105 |
@protocol FBSDKGameRequestDialogDelegate <NSObject> |
W |
106 |
|
9febd9
|
107 |
/** |
W |
108 |
Sent to the delegate when the game request completes without error. |
13e53a
|
109 |
@param gameRequestDialog The FBSDKGameRequestDialog that completed. |
H |
110 |
@param results The results from the dialog. This may be nil or empty. |
bad748
|
111 |
*/ |
e81c27
|
112 |
- (void)gameRequestDialog:(FBSDKGameRequestDialog *)gameRequestDialog didCompleteWithResults:(NSDictionary<NSString *, id> *)results; |
bad748
|
113 |
|
9febd9
|
114 |
/** |
W |
115 |
Sent to the delegate when the game request encounters an error. |
13e53a
|
116 |
@param gameRequestDialog The FBSDKGameRequestDialog that completed. |
H |
117 |
@param error The error. |
bad748
|
118 |
*/ |
W |
119 |
- (void)gameRequestDialog:(FBSDKGameRequestDialog *)gameRequestDialog didFailWithError:(NSError *)error; |
|
120 |
|
9febd9
|
121 |
/** |
W |
122 |
Sent to the delegate when the game request dialog is cancelled. |
13e53a
|
123 |
@param gameRequestDialog The FBSDKGameRequestDialog that completed. |
bad748
|
124 |
*/ |
W |
125 |
- (void)gameRequestDialogDidCancel:(FBSDKGameRequestDialog *)gameRequestDialog; |
|
126 |
|
|
127 |
@end |
e81c27
|
128 |
|
H |
129 |
NS_ASSUME_NONNULL_END |