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