forked from facebook/facebook-ios-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FBNativeDialogs.h
170 lines (135 loc) · 7.37 KB
/
FBNativeDialogs.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/*
* Copyright 2012 Facebook
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#import <UIKit/UIKit.h>
#import <CoreLocation/CoreLocation.h>
@class FBSession;
/*!
@typedef FBNativeDialogResult enum
@abstract
Passed to a handler to indicate the result of a dialog being displayed to the user.
*/
typedef enum {
/*! Indicates that the dialog action completed successfully. */
FBNativeDialogResultSucceeded,
/*! Indicates that the dialog action was cancelled (either by the user or the system). */
FBNativeDialogResultCancelled,
/*! Indicates that the dialog could not be shown (because not on ios6 or ios6 auth was not used). */
FBNativeDialogResultError
} FBNativeDialogResult;
/*!
@typedef
@abstract Defines a handler that will be called in response to the native share dialog
being displayed.
*/
typedef void (^FBShareDialogHandler)(FBNativeDialogResult result, NSError *error);
/*!
@class FBNativeDialogs
@abstract
Provides methods to display native (i.e., non-Web-based) dialogs to the user.
Currently the iOS 6 sharing dialog is supported.
*/
@interface FBNativeDialogs : NSObject
/*!
@abstract
Presents a dialog that allows the user to share a status update that may include
text, images, or URLs. This dialog is only available on iOS 6.0 and above. The
current active session returned by [FBSession activeSession] will be used to determine
whether the dialog will be displayed. If a session is active, it must be open and the
login method used to authenticate the user must be native iOS 6.0 authentication.
If no session active, then whether the call succeeds or not will depend on
whether Facebook integration has been configured.
@param viewController The view controller which will present the dialog.
@param initialText The text which will initially be populated in the dialog. The user
will have the opportunity to edit this text before posting it. May be nil.
@param image A UIImage that will be attached to the status update. May be nil.
@param url An NSURL that will be attached to the status update. May be nil.
@param handler A handler that will be called when the dialog is dismissed, or if an error
occurs. May be nil.
@return YES if the dialog was presented, NO if not (in the case of a NO result, the handler
will still be called, with an error indicating the reason the dialog was not displayed)
*/
+ (BOOL)presentShareDialogModallyFrom:(UIViewController*)viewController
initialText:(NSString*)initialText
image:(UIImage*)image
url:(NSURL*)url
handler:(FBShareDialogHandler)handler;
/*!
@abstract
Presents a dialog that allows the user to share a status update that may include
text, images, or URLs. This dialog is only available on iOS 6.0 and above. The
current active session returned by [FBSession activeSession] will be used to determine
whether the dialog will be displayed. If a session is active, it must be open and the
login method used to authenticate the user must be native iOS 6.0 authentication.
If no session active, then whether the call succeeds or not will depend on
whether Facebook integration has been configured.
@param viewController The view controller which will present the dialog.
@param initialText The text which will initially be populated in the dialog. The user
will have the opportunity to edit this text before posting it. May be nil.
@param images An array of UIImages that will be attached to the status update. May
be nil.
@param urls An array of NSURLs that will be attached to the status update. May be nil.
@param handler A handler that will be called when the dialog is dismissed, or if an error
occurs. May be nil.
@return YES if the dialog was presented, NO if not (in the case of a NO result, the handler
will still be called, with an error indicating the reason the dialog was not displayed)
*/
+ (BOOL)presentShareDialogModallyFrom:(UIViewController*)viewController
initialText:(NSString*)initialText
images:(NSArray*)images
urls:(NSArray*)urls
handler:(FBShareDialogHandler)handler;
/*!
@abstract
Presents a dialog that allows the user to share a status update that may include
text, images, or URLs. This dialog is only available on iOS 6.0 and above. An
<FBSession> may be specified, or nil may be passed to indicate that the current
active session should be used. If a session is specified (whether explicitly or by
virtue of being the active session), it must be open and the login method used to
authenticate the user must be native iOS 6.0 authentication. If no session is specified
(and there is no active session), then whether the call succeeds or not will depend on
whether Facebook integration has been configured.
@param viewController The view controller which will present the dialog.
@param session The <FBSession> to use to determine whether or not the user has been
authenticated with iOS native authentication. If nil, then [FBSession activeSession]
will be checked. See discussion above for the implications of nil or non-nil session.
@param initialText The text which will initially be populated in the dialog. The user
will have the opportunity to edit this text before posting it. May be nil.
@param images An array of UIImages that will be attached to the status update. May
be nil.
@param urls An array of NSURLs that will be attached to the status update. May be nil.
@param handler A handler that will be called when the dialog is dismissed, or if an error
occurs. May be nil.
@return YES if the dialog was presented, NO if not (in the case of a NO result, the handler
will still be called, with an error indicating the reason the dialog was not displayed)
*/
+ (BOOL)presentShareDialogModallyFrom:(UIViewController*)viewController
session:(FBSession*)session
initialText:(NSString*)initialText
images:(NSArray*)images
urls:(NSArray*)urls
handler:(FBShareDialogHandler)handler;
/*!
@abstract
Determines whether a call to presentShareDialogModallyFrom: will successfully present
a dialog. This is useful for applications that need to modify the available UI controls
depending on whether the dialog is available on the current platform and for the current
user.
@param session The <FBSession> to use to determine whether or not the user has been
authenticated with iOS native authentication. If nil, then [FBSession activeSession]
will be checked. See discussion above for the implications of nil or non-nil session.
@return YES if the dialog would be presented for the session, and NO if not
*/
+ (BOOL)canPresentShareDialogWithSession:(FBSession*)session;
@end