12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028 |
- /*
- * Copyright 2010-present 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 <CoreLocation/CoreLocation.h>
- #import <UIKit/UIKit.h>
- #import "FBAppCall.h"
- #import "FBLinkShareParams.h"
- #import "FBOpenGraphActionParams.h"
- #import "FBPhotoParams.h"
- @class FBSession;
- @protocol FBOpenGraphAction;
- /*!
- @typedef FBNativeDialogResult enum
- @abstract
- Passed to a handler to indicate the result of a dialog being displayed to the user.
- */
- typedef NS_ENUM(NSUInteger, FBOSIntegratedShareDialogResult) {
- /*! Indicates that the dialog action completed successfully. */
- FBOSIntegratedShareDialogResultSucceeded = 0,
- /*! Indicates that the dialog action was cancelled (either by the user or the system). */
- FBOSIntegratedShareDialogResultCancelled = 1,
- /*! Indicates that the dialog could not be shown (because not on ios6 or ios6 auth was not used). */
- FBOSIntegratedShareDialogResultError = 2
- };
- /*!
- @typedef
- @abstract Defines a handler that will be called in response to the native share dialog
- being displayed.
- */
- typedef void (^FBOSIntegratedShareDialogHandler)(FBOSIntegratedShareDialogResult result, NSError *error);
- /*!
- @typedef FBDialogAppCallCompletionHandler
- @abstract
- A block that when passed to a method in FBDialogs is called back
- with the results of the AppCall for that dialog.
- @discussion
- This will be called on the UI thread, once the AppCall completes.
- @param call The `FBAppCall` that was completed.
- @param results The results of the AppCall for the dialog. This parameters is present
- purely for convenience, and is the exact same value as call.dialogData.results.
- @param error The `NSError` representing any error that occurred. This parameters is
- present purely for convenience, and is the exact same value as call.error.
- */
- typedef void (^FBDialogAppCallCompletionHandler)(
- FBAppCall *call,
- NSDictionary *results,
- NSError *error);
- /*!
- @class FBDialogs
- @abstract
- Provides methods to display native (i.e., non-Web-based) dialogs to the user.
- @discussion
- If you are building an app with a urlSchemeSuffix, you should also set the appropriate
- plist entry. See `[FBSettings defaultUrlSchemeSuffix]`.
- */
- @interface FBDialogs : NSObject
- #pragma mark - OSIntegratedShareDialog
- /*!
- @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)presentOSIntegratedShareDialogModallyFrom:(UIViewController *)viewController
- initialText:(NSString *)initialText
- image:(UIImage *)image
- url:(NSURL *)url
- handler:(FBOSIntegratedShareDialogHandler)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)presentOSIntegratedShareDialogModallyFrom:(UIViewController *)viewController
- initialText:(NSString *)initialText
- images:(NSArray *)images
- urls:(NSArray *)urls
- handler:(FBOSIntegratedShareDialogHandler)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)presentOSIntegratedShareDialogModallyFrom:(UIViewController *)viewController
- session:(FBSession *)session
- initialText:(NSString *)initialText
- images:(NSArray *)images
- urls:(NSArray *)urls
- handler:(FBOSIntegratedShareDialogHandler)handler;
- /*!
- @abstract Determines if the device is capable of presenting the OS integrated share dialog.
- @discussion This is the most basic check for capability for this feature.
- @see canPresentOSIntegratedShareDialogWithSession:
- */
- + (BOOL)canPresentOSIntegratedShareDialog;
- /*!
- @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)canPresentOSIntegratedShareDialogWithSession:(FBSession *)session;
- #pragma mark - Native Share Dialog
- /*!
- @abstract Determines if the device is capable of presenting the share dialog.
- @discussion This is the most basic check for capability for this feature.
- @see canPresentShareDialogWithOpenGraphActionParams:
- @see canPresentShareDialogWithParams:
- @see canPresentShareDialogWithPhotos:
- */
- + (BOOL)canPresentShareDialog;
- /*!
- @abstract
- Determines whether a call to presentShareDialogWithOpenGraphActionParams:clientState:handler:
- will successfully present a dialog in the Facebook application. This is useful for applications
- that need to modify the available UI controls depending on whether the dialog is
- available on the current platform.
- @param params The parameters for the FB share dialog.
- @return YES if the dialog would be presented, and NO if not
- @discussion A return value of YES here indicates that the corresponding
- presentShareDialogWithOpenGraphActionParams method will return a non-nil FBAppCall for
- the same params. And vice versa.
- */
- + (BOOL)canPresentShareDialogWithOpenGraphActionParams:(FBOpenGraphActionParams *)params;
- /*!
- @abstract
- Determines whether a call to presentShareDialogWithTarget: will successfully
- present a dialog in the Facebook application. This is useful for applications that
- need to modify the available UI controls depending on whether the dialog is
- available on the current platform.
- @param params The parameters for the FB share dialog.
- @return YES if the dialog would be presented, and NO if not
- @discussion A return value of YES here indicates that the corresponding
- presentShareDialogWithParams method will return a non-nil FBAppCall for the same
- params. And vice versa.
- */
- + (BOOL)canPresentShareDialogWithParams:(FBLinkShareParams *)params;
- /*!
- @abstract
- Determines whether a call to presentShareDialogWithPhotoParams: will successfully
- present a dialog in the Facebook application. This is useful for applications that
- need to modify the available UI controls depending on whether the dialog is
- available on the current platform.
- @return YES if the dialog would be presented, and NO if not
- @discussion A return value of YES here indicates that the corresponding
- presentShareDialogWithPhotoParams method will return a non-nil FBAppCall.
- */
- + (BOOL)canPresentShareDialogWithPhotos;
- /*!
- @abstract
- Presents a dialog in the Facebook application that allows the user to share a status
- update that may include text, images, or URLs. No session is required, and the app
- does not need to be authorized to call this.
- Note that this will perform an app switch to the Facebook app, and will cause the
- current app to be suspended. When the share is complete, the Facebook app will redirect
- to a url of the form "fb{APP_ID}://" that the application must handle. The app should
- then call [FBAppCall handleOpenURL:sourceApplication:fallbackHandler:] to trigger
- the appropriate handling. Note that FBAppCall will first try to call the completion
- handler associated with this method, but since during an app switch, the calling app
- may be suspended or killed, the app must also give a fallbackHandler to the
- handleOpenURL: method in FBAppCall.
- @param params The parameters for the FB share dialog.
- @param clientState An NSDictionary that's passed through when the completion handler
- is called. This is useful for the app to maintain state about the share request that
- was made so as to have appropriate action when the handler is called. May be nil.
- @param handler A completion handler that may be called when the status update is
- complete. May be nil. If non-nil, the handler will always be called asynchronously.
- @return An FBAppCall object that will also be passed into the provided
- FBAppCallCompletionHandler.
- @discussion A non-nil FBAppCall object is only returned if the corresponding
- canPresentShareDialogWithParams method is also returning YES for the same params.
- */
- + (FBAppCall *)presentShareDialogWithParams:(FBLinkShareParams *)params
- clientState:(NSDictionary *)clientState
- handler:(FBDialogAppCallCompletionHandler)handler;
- /*!
- @abstract
- Presents a dialog in the Facebook application that allows the user to share the
- supplied link. No session is required, and the app does not need to be authorized
- to call this.
- Note that this will perform an app switch to the Facebook app, and will cause the
- current app to be suspended. When the share is complete, the Facebook app will redirect
- to a url of the form "fb{APP_ID}://" that the application must handle. The app should
- then call [FBAppCall handleOpenURL:sourceApplication:fallbackHandler:] to trigger
- the appropriate handling. Note that FBAppCall will first try to call the completion
- handler associated with this method, but since during an app switch, the calling app
- may be suspended or killed, the app must also give a fallbackHandler to the
- handleOpenURL: method in FBAppCall.
- @param link The URL link to be attached to the post.
- @param handler A completion handler that may be called when the status update is
- complete. May be nil. If non-nil, the handler will always be called asynchronously.
- @return An FBAppCall object that will also be passed into the provided
- FBAppCallCompletionHandler.
- @discussion A non-nil FBAppCall object is only returned if the corresponding
- canPresentShareDialogWithParams method is also returning YES for the same params.
- */
- + (FBAppCall *)presentShareDialogWithLink:(NSURL *)link
- handler:(FBDialogAppCallCompletionHandler)handler;
- /*!
- @abstract
- Presents a dialog in the Facebook application that allows the user to share the
- supplied link. No session is required, and the app does not need to be authorized
- to call this.
- Note that this will perform an app switch to the Facebook app, and will cause the
- current app to be suspended. When the share is complete, the Facebook app will redirect
- to a url of the form "fb{APP_ID}://" that the application must handle. The app should
- then call [FBAppCall handleOpenURL:sourceApplication:fallbackHandler:] to trigger
- the appropriate handling. Note that FBAppCall will first try to call the completion
- handler associated with this method, but since during an app switch, the calling app
- may be suspended or killed, the app must also give a fallbackHandler to the
- handleOpenURL: method in FBAppCall.
- @param link The URL link to be attached to the post.
- @param name The name, or title associated with the link. May be nil.
- @param handler A completion handler that may be called when the status update is
- complete. May be nil. If non-nil, the handler will always be called asynchronously.
- @return An FBAppCall object that will also be passed into the provided
- FBAppCallCompletionHandler.
- @discussion A non-nil FBAppCall object is only returned if the corresponding
- canPresentShareDialogWithParams method is also returning YES for the same params.
- */
- + (FBAppCall *)presentShareDialogWithLink:(NSURL *)link
- name:(NSString *)name
- handler:(FBDialogAppCallCompletionHandler)handler;
- /*!
- @abstract
- Presents a dialog in the Facebook application that allows the user to share the
- supplied link. No session is required, and the app does not need to be authorized
- to call this.
- Note that this will perform an app switch to the Facebook app, and will cause the
- current app to be suspended. When the share is complete, the Facebook app will redirect
- to a url of the form "fb{APP_ID}://" that the application must handle. The app should
- then call [FBAppCall handleOpenURL:sourceApplication:fallbackHandler:] to trigger
- the appropriate handling. Note that FBAppCall will first try to call the completion
- handler associated with this method, but since during an app switch, the calling app
- may be suspended or killed, the app must also give a fallbackHandler to the
- handleOpenURL: method in FBAppCall.
- @param link The URL link to be attached to the post.
- @param name The name, or title associated with the link. May be nil.
- @param caption The caption to be used with the link. May be nil.
- @param description The description associated with the link. May be nil.
- @param picture The link to a thumbnail to associate with the link. May be nil.
- @param clientState An NSDictionary that's passed through when the completion handler
- is called. This is useful for the app to maintain state about the share request that
- was made so as to have appropriate action when the handler is called. May be nil.
- @param handler A completion handler that may be called when the status update is
- complete. May be nil. If non-nil, the handler will always be called asynchronously.
- @return An FBAppCall object that will also be passed into the provided
- FBAppCallCompletionHandler.
- @discussion A non-nil FBAppCall object is only returned if the corresponding
- canPresentShareDialogWithParams method is also returning YES for the same params.
- */
- + (FBAppCall *)presentShareDialogWithLink:(NSURL *)link
- name:(NSString *)name
- caption:(NSString *)caption
- description:(NSString *)description
- picture:(NSURL *)picture
- clientState:(NSDictionary *)clientState
- handler:(FBDialogAppCallCompletionHandler)handler;
- /*!
- @abstract
- Presents a dialog in the Facebook application that allows the user to share the
- supplied photo(s). No session is required, and the app does not need to be authorized
- to call this.
- Note that this will perform an app switch to the Facebook app, and will cause the
- current app to be suspended. When the share is complete, the Facebook app will redirect
- to a url of the form "fb{APP_ID}://" that the application must handle. The app should
- then call [FBAppCall handleOpenURL:sourceApplication:fallbackHandler:] to trigger
- the appropriate handling. Note that FBAppCall will first try to call the completion
- handler associated with this method, but since during an app switch, the calling app
- may be suspended or killed, the app must also give a fallbackHandler to the
- handleOpenURL: method in FBAppCall.
- @param params The parameters for the FB share dialog.
- @param clientState An NSDictionary that's passed through when the completion handler
- is called. This is useful for the app to maintain state about the share request that
- was made so as to have appropriate action when the handler is called. May be nil.
- @param handler A completion handler that may be called when the status update is
- complete. May be nil. If non-nil, the handler will always be called asynchronously.
- @return An FBAppCall object that will also be passed into the provided
- FBAppCallCompletionHandler.
- @discussion A non-nil FBAppCall object is only returned if the corresponding
- canPresentShareDialogWithPhotoParams method is also returning YES for the same params.
- */
- + (FBAppCall *)presentShareDialogWithPhotoParams:(FBPhotoParams *)params
- clientState:(NSDictionary *)clientState
- handler:(FBDialogAppCallCompletionHandler)handler;
- /*!
- @abstract
- Presents a dialog in the Facebook application that allows the user to share the
- supplied photo(s). No session is required, and the app does not need to be authorized
- to call this.
- Note that this will perform an app switch to the Facebook app, and will cause the
- current app to be suspended. When the share is complete, the Facebook app will redirect
- to a url of the form "fb{APP_ID}://" that the application must handle. The app should
- then call [FBAppCall handleOpenURL:sourceApplication:fallbackHandler:] to trigger
- the appropriate handling. Note that FBAppCall will first try to call the completion
- handler associated with this method, but since during an app switch, the calling app
- may be suspended or killed, the app must also give a fallbackHandler to the
- handleOpenURL: method in FBAppCall.
- @param photos An NSArray containing UIImages to be shared. May be nil.
- @param handler A completion handler that may be called when the status update is
- complete. May be nil. If non-nil, the handler will always be called asynchronously.
- @return An FBAppCall object that will also be passed into the provided
- FBAppCallCompletionHandler.
- @discussion A non-nil FBAppCall object is only returned if the corresponding
- canPresentShareDialogWithPhotoParams method is also returning YES for the same params.
- */
- + (FBAppCall *)presentShareDialogWithPhotos:(NSArray *)photos
- handler:(FBDialogAppCallCompletionHandler)handler;
- /*!
- @abstract
- Presents a dialog in the Facebook application that allows the user to share the
- supplied photo(s). No session is required, and the app does not need to be authorized
- to call this.
- Note that this will perform an app switch to the Facebook app, and will cause the
- current app to be suspended. When the share is complete, the Facebook app will redirect
- to a url of the form "fb{APP_ID}://" that the application must handle. The app should
- then call [FBAppCall handleOpenURL:sourceApplication:fallbackHandler:] to trigger
- the appropriate handling. Note that FBAppCall will first try to call the completion
- handler associated with this method, but since during an app switch, the calling app
- may be suspended or killed, the app must also give a fallbackHandler to the
- handleOpenURL: method in FBAppCall.
- @param photos An NSArray containing UIImages to be shared.
- @param clientState An NSDictionary that's passed through when the completion handler
- is called. This is useful for the app to maintain state about the share request that
- was made so as to have appropriate action when the handler is called. May be nil.
- @param handler A completion handler that may be called when the status update is
- complete. May be nil. If non-nil, the handler will always be called asynchronously.
- @return An FBAppCall object that will also be passed into the provided
- FBAppCallCompletionHandler.
- @discussion A non-nil FBAppCall object is only returned if the corresponding
- canPresentShareDialogWithPhotoParams method is also returning YES for the same params.
- */
- + (FBAppCall *)presentShareDialogWithPhotos:(NSArray *)photos
- clientState:(NSDictionary *)clientState
- handler:(FBDialogAppCallCompletionHandler)handler;
- /*!
- @abstract
- Presents a dialog in the Facebook application that allows the user to publish an Open
- Graph action. No session is required, and the app does not need to be authorized to call
- this.
- Note that this will perform an app switch to the Facebook app, and will cause the
- current app to be suspended. When the share is complete, the Facebook app will redirect
- to a url of the form "fb{APP_ID}://" that the application must handle. The app should
- then call [FBAppCall handleOpenURL:sourceApplication:fallbackHandler:] to trigger
- the appropriate handling. Note that FBAppCall will first try to call the completion
- handler associated with this method, but since during an app switch, the calling app
- may be suspended or killed, the app must also give a fallbackHandler to the
- handleOpenURL: method in FBAppCall.
- @param params The parameters for the Open Graph action dialog.
- @param clientState An NSDictionary that's passed through when the completion handler
- is called. This is useful for the app to maintain state about the share request that
- was made so as to have appropriate action when the handler is called. May be nil.
- @param handler A completion handler that may be called when the status update is
- complete. May be nil. If non-nil, the handler will always be called asynchronously.
- @return An FBAppCall object that will also be passed into the provided
- FBAppCallCompletionHandler.
- @discussion A non-nil FBAppCall object is only returned if the corresponding
- canPresentShareDialogWithOpenGraphActionParams method is also returning YES for the same params.
- */
- + (FBAppCall *)presentShareDialogWithOpenGraphActionParams:(FBOpenGraphActionParams *)params
- clientState:(NSDictionary *)clientState
- handler:(FBDialogAppCallCompletionHandler)handler;
- /*!
- @abstract
- Presents a dialog in the Facebook application that allows the user to publish the
- supplied Open Graph action. No session is required, and the app does not need to be
- authorized to call this.
- Note that this will perform an app switch to the Facebook app, and will cause the
- current app to be suspended. When the share is complete, the Facebook app will redirect
- to a url of the form "fb{APP_ID}://" that the application must handle. The app should
- then call [FBAppCall handleOpenURL:sourceApplication:fallbackHandler:] to trigger
- the appropriate handling. Note that FBAppCall will first try to call the completion
- handler associated with this method, but since during an app switch, the calling app
- may be suspended or killed, the app must also give a fallbackHandler to the
- handleOpenURL: method in FBAppCall.
- @param action The Open Graph action to be published. May not be nil.
- @param actionType the fully-specified Open Graph action type of the action (e.g.,
- my_app_namespace:my_action).
- @param previewPropertyName the name of the property on the action that represents the
- primary Open Graph object associated with the action; this object will be displayed in the
- preview portion of the share dialog.
- @param handler A completion handler that may be called when the status update is
- complete. May be nil. If non-nil, the handler will always be called asynchronously.
- @return An FBAppCall object that will also be passed into the provided
- FBAppCallCompletionHandler.
- @discussion A non-nil FBAppCall object is only returned if the corresponding
- canPresentShareDialogWithOpenGraphActionParams method is also returning YES for the same params.
- */+ (FBAppCall *)presentShareDialogWithOpenGraphAction:(id<FBOpenGraphAction>)action
- actionType:(NSString *)actionType
- previewPropertyName:(NSString *)previewPropertyName
- handler:(FBDialogAppCallCompletionHandler)handler;
- /*!
- @abstract
- Presents a dialog in the Facebook application that allows the user to publish the
- supplied Open Graph action. No session is required, and the app does not need to be
- authorized to call this.
- Note that this will perform an app switch to the Facebook app, and will cause the
- current app to be suspended. When the share is complete, the Facebook app will redirect
- to a url of the form "fb{APP_ID}://" that the application must handle. The app should
- then call [FBAppCall handleOpenURL:sourceApplication:fallbackHandler:] to trigger
- the appropriate handling. Note that FBAppCall will first try to call the completion
- handler associated with this method, but since during an app switch, the calling app
- may be suspended or killed, the app must also give a fallbackHandler to the
- handleOpenURL: method in FBAppCall.
- @param action The Open Graph action to be published. May not be nil.
- @param actionType the fully-specified Open Graph action type of the action (e.g.,
- my_app_namespace:my_action).
- @param previewPropertyName the name of the property on the action that represents the
- primary Open Graph object associated with the action; this object will be displayed in the
- preview portion of the share dialog.
- @param clientState An NSDictionary that's passed through when the completion handler
- is called. This is useful for the app to maintain state about the share request that
- was made so as to have appropriate action when the handler is called. May be nil.
- @param handler A completion handler that may be called when the status update is
- complete. May be nil. If non-nil, the handler will always be called asynchronously.
- @return An FBAppCall object that will also be passed into the provided
- FBAppCallCompletionHandler.
- @discussion A non-nil FBAppCall object is only returned if the corresponding
- canPresentShareDialogWithOpenGraphActionParams method is also returning YES for the same params.
- */
- + (FBAppCall *)presentShareDialogWithOpenGraphAction:(id<FBOpenGraphAction>)action
- actionType:(NSString *)actionType
- previewPropertyName:(NSString *)previewPropertyName
- clientState:(NSDictionary *)clientState
- handler:(FBDialogAppCallCompletionHandler)handler;
- #pragma mark - Message Dialog
- /*!
- @abstract Determines if the device is capable of presenting the message dialog.
- @discussion This is the most basic check for capability for this feature.
- @see canPresentMessageDialogWithOpenGraphActionParams:
- @see canPresentMessageDialogWithParams:
- @see canPresentMessageDialogWithPhotos:
- */
- + (BOOL)canPresentMessageDialog;
- /*!
- @abstract
- Determines whether a call to `presentMessageDialogWithOpenGraphActionParams:...` will
- successfully present a dialog in the Facebook Messenger app. This is useful for applications
- that need to modify the available UI controls depending on whether the dialog is
- available on the current platform.
- @param params the dialog parameters
- @return YES if the dialog would be presented, and NO if not
- */
- + (BOOL)canPresentMessageDialogWithOpenGraphActionParams:(FBOpenGraphActionParams *)params;
- /*!
- @abstract
- Determines whether a call to `presentMessageDialogWithParams:...` will successfully
- present a dialog in the Facebook Messenger app. This is useful for applications that
- need to modify the available UI controls depending on whether the dialog is
- available on the current platform.
- @param params the dialog parameters
- @return YES if the dialog would be presented, and NO if not
- */
- + (BOOL)canPresentMessageDialogWithParams:(FBLinkShareParams *)params;
- /*!
- @abstract
- Determines whether a call to `presentMessageDialogWithPhotos:...` will successfully
- present a dialog in the Facebook Messenger app. This is useful for applications that
- need to modify the available UI controls depending on whether the dialog is
- available on the current platform.
- @return YES if the dialog would be presented, and NO if not
- */
- + (BOOL)canPresentMessageDialogWithPhotos;
- /*!
- @abstract
- Presents a dialog in the Facebook Messenger app that allows the user to publish an Open
- Graph action. No session is required, and the app does not need to be authorized to call
- this.
- Note that this will perform an app switch to the Messenger app, and will cause the
- current app to be suspended. When the share is complete, the Messenger app will redirect
- to a url of the form "fb{APP_ID}://" that the application must handle. The app should
- then call [FBAppCall handleOpenURL:sourceApplication:fallbackHandler:] to trigger
- the appropriate handling. Note that FBAppCall will first try to call the completion
- handler associated with this method, but since during an app switch, the calling app
- may be suspended or killed, the app must also give a fallbackHandler to the
- handleOpenURL: method in FBAppCall.
- @param params The parameters for the Open Graph action dialog.
- @param clientState An NSDictionary that's passed through when the completion handler
- is called. This is useful for the app to maintain state about the share request that
- was made so as to have appropriate action when the handler is called. May be nil.
- @param handler A completion handler that may be called when the status update is
- complete. May be nil. If non-nil, the handler will always be called asynchronously.
- @return An FBAppCall object that will also be passed into the provided
- FBAppCallCompletionHandler.
- @discussion A non-nil FBAppCall object is only returned if the corresponding
- `canPresentMessageDialogWithOpenGraphActionParams:` method is also returning YES for the same params.
- */
- + (FBAppCall *)presentMessageDialogWithOpenGraphActionParams:(FBOpenGraphActionParams *)params
- clientState:(NSDictionary *)clientState
- handler:(FBDialogAppCallCompletionHandler)handler;
- /*!
- @abstract
- Presents a dialog in the Facebook Messenger app that allows the user to publish the
- supplied Open Graph action. No session is required, and the app does not need to be
- authorized to call this.
- Note that this will perform an app switch to the Messenger app, and will cause the
- current app to be suspended. When the share is complete, the Messenger app will redirect
- to a url of the form "fb{APP_ID}://" that the application must handle. The app should
- then call [FBAppCall handleOpenURL:sourceApplication:fallbackHandler:] to trigger
- the appropriate handling. Note that FBAppCall will first try to call the completion
- handler associated with this method, but since during an app switch, the calling app
- may be suspended or killed, the app must also give a fallbackHandler to the
- handleOpenURL: method in FBAppCall.
- @param action The Open Graph action to be published. May not be nil.
- @param actionType the fully-specified Open Graph action type of the action (e.g.,
- my_app_namespace:my_action).
- @param previewPropertyName the name of the property on the action that represents the
- primary Open Graph object associated with the action; this object will be displayed in the
- preview portion of the share dialog.
- @param handler A completion handler that may be called when the status update is
- complete. May be nil. If non-nil, the handler will always be called asynchronously.
- @return An FBAppCall object that will also be passed into the provided
- FBAppCallCompletionHandler.
- @discussion A non-nil FBAppCall object is only returned if the corresponding
- canPresentMessageDialogWithOpenGraphActionParams method is also returning YES for the same params.
- */+ (FBAppCall *)presentMessageDialogWithOpenGraphAction:(id<FBOpenGraphAction>)action
- actionType:(NSString *)actionType
- previewPropertyName:(NSString *)previewPropertyName
- handler:(FBDialogAppCallCompletionHandler)handler;
- /*!
- @abstract
- Presents a dialog in the Facebook Messenger app that allows the user to publish the
- supplied Open Graph action. No session is required, and the app does not need to be
- authorized to call this.
- Note that this will perform an app switch to the Messenger app, and will cause the
- current app to be suspended. When the share is complete, the Messenger app will redirect
- to a url of the form "fb{APP_ID}://" that the application must handle. The app should
- then call [FBAppCall handleOpenURL:sourceApplication:fallbackHandler:] to trigger
- the appropriate handling. Note that FBAppCall will first try to call the completion
- handler associated with this method, but since during an app switch, the calling app
- may be suspended or killed, the app must also give a fallbackHandler to the
- handleOpenURL: method in FBAppCall.
- @param action The Open Graph action to be published. May not be nil.
- @param actionType the fully-specified Open Graph action type of the action (e.g.,
- my_app_namespace:my_action).
- @param previewPropertyName the name of the property on the action that represents the
- primary Open Graph object associated with the action; this object will be displayed in the
- preview portion of the share dialog.
- @param clientState An NSDictionary that's passed through when the completion handler
- is called. This is useful for the app to maintain state about the share request that
- was made so as to have appropriate action when the handler is called. May be nil.
- @param handler A completion handler that may be called when the status update is
- complete. May be nil. If non-nil, the handler will always be called asynchronously.
- @return An FBAppCall object that will also be passed into the provided
- FBAppCallCompletionHandler.
- @discussion A non-nil FBAppCall object is only returned if the corresponding
- canPresentMessageDialogWithOpenGraphActionParams method is also returning YES for the same params.
- */
- + (FBAppCall *)presentMessageDialogWithOpenGraphAction:(id<FBOpenGraphAction>)action
- actionType:(NSString *)actionType
- previewPropertyName:(NSString *)previewPropertyName
- clientState:(NSDictionary *)clientState
- handler:(FBDialogAppCallCompletionHandler)handler;
- /*!
- @abstract
- Presents a dialog in the Facebook Messenger app that allows the user to send the
- supplied photo(s). No session is required, and the app does not need to be authorized
- to call this.
- Note that this will perform an app switch to the Messenger app, and will cause the
- current app to be suspended. When the share is complete, the Messenger app will redirect
- to a url of the form "fb{APP_ID}://" that the application must handle. The app should
- then call [FBAppCall handleOpenURL:sourceApplication:fallbackHandler:] to trigger
- the appropriate handling. Note that FBAppCall will first try to call the completion
- handler associated with this method, but since during an app switch, the calling app
- may be suspended or killed, the app must also give a fallbackHandler to the
- handleOpenURL: method in FBAppCall.
- @param params The parameters for the Message Dialog
- @param clientState An NSDictionary that's passed through when the completion handler
- is called. This is useful for the app to maintain state about the share request that
- was made so as to have appropriate action when the handler is called. May be nil.
- @param handler A completion handler that may be called when the status update is
- complete. May be nil. If non-nil, the handler will always be called asynchronously.
- @return An FBAppCall object that will also be passed into the provided
- FBAppCallCompletionHandler.
- @discussion A non-nil FBAppCall object is only returned if the corresponding
- `canPresentMessageDialogWithPhotos` method is also returning YES.
- */
- + (FBAppCall *)presentMessageDialogWithPhotoParams:(FBPhotoParams *)params
- clientState:(NSDictionary *)clientState
- handler:(FBDialogAppCallCompletionHandler)handler;
- /*!
- @abstract
- Presents a dialog in the Facebook Messenger app that allows the user to send the
- supplied photo(s). No session is required, and the app does not need to be authorized
- to call this.
- Note that this will perform an app switch to the Messenger app, and will cause the
- current app to be suspended. When the share is complete, the Messenger app will redirect
- to a url of the form "fb{APP_ID}://" that the application must handle. The app should
- then call [FBAppCall handleOpenURL:sourceApplication:fallbackHandler:] to trigger
- the appropriate handling. Note that FBAppCall will first try to call the completion
- handler associated with this method, but since during an app switch, the calling app
- may be suspended or killed, the app must also give a fallbackHandler to the
- handleOpenURL: method in FBAppCall.
- @param photos An NSArray containing UIImages to be shared.
- @param handler A completion handler that may be called when the status update is
- complete. May be nil. If non-nil, the handler will always be called asynchronously.
- @return An FBAppCall object that will also be passed into the provided
- FBAppCallCompletionHandler.
- @discussion A non-nil FBAppCall object is only returned if the corresponding
- `canPresentMessageDialogWithPhotos` method is also returning YES.
- */
- + (FBAppCall *)presentMessageDialogWithPhotos:(NSArray *)photos
- handler:(FBDialogAppCallCompletionHandler)handler;
- /*!
- @abstract
- Presents a dialog in the Facebook Messenger app that allows the user to send the
- supplied photo(s). No session is required, and the app does not need to be authorized
- to call this.
- Note that this will perform an app switch to the Messenger app, and will cause the
- current app to be suspended. When the share is complete, the Messenger app will redirect
- to a url of the form "fb{APP_ID}://" that the application must handle. The app should
- then call [FBAppCall handleOpenURL:sourceApplication:fallbackHandler:] to trigger
- the appropriate handling. Note that FBAppCall will first try to call the completion
- handler associated with this method, but since during an app switch, the calling app
- may be suspended or killed, the app must also give a fallbackHandler to the
- handleOpenURL: method in FBAppCall.
- @param photos An NSArray containing UIImages to be shared.
- @param clientState An NSDictionary that's passed through when the completion handler
- is called. This is useful for the app to maintain state about the share request that
- was made so as to have appropriate action when the handler is called. May be nil.
- @param handler A completion handler that may be called when the status update is
- complete. May be nil. If non-nil, the handler will always be called asynchronously.
- @return An FBAppCall object that will also be passed into the provided
- FBAppCallCompletionHandler.
- @discussion A non-nil FBAppCall object is only returned if the corresponding
- `canPresentMessageDialogWithPhotos` method is also returning YES.
- */
- + (FBAppCall *)presentMessageDialogWithPhotos:(NSArray *)photos
- clientState:(NSDictionary *)clientState
- handler:(FBDialogAppCallCompletionHandler)handler;
- /*!
- @abstract
- Presents a dialog in the Facebook Messenger app that allows the user to share a status
- update that may include text, images, or URLs. No session is required, and the app
- does not need to be authorized to call this.
- Note that this will perform an app switch to the Messenger app, and will cause the
- current app to be suspended. When the share is complete, the Messenger app will redirect
- to a url of the form "fb{APP_ID}://" that the application must handle. The app should
- then call [FBAppCall handleOpenURL:sourceApplication:fallbackHandler:] to trigger
- the appropriate handling. Note that FBAppCall will first try to call the completion
- handler associated with this method, but since during an app switch, the calling app
- may be suspended or killed, the app must also give a fallbackHandler to the
- handleOpenURL: method in FBAppCall.
- @param params The parameters for the Message Dialog. The "friends" and "place" properties
- will be ignored as the Facebook Messenger app does not support tagging.
- @param clientState An NSDictionary that's passed through when the completion handler
- is called. This is useful for the app to maintain state about the share request that
- was made so as to have appropriate action when the handler is called. May be nil.
- @param handler A completion handler that may be called when the status update is
- complete. May be nil. If non-nil, the handler will always be called asynchronously.
- @return An FBAppCall object that will also be passed into the provided
- FBAppCallCompletionHandler.
- @discussion A non-nil FBAppCall object is only returned if the corresponding
- `canPresentMessageDialogWithParams:` method is also returning YES for the same params.
- */
- + (FBAppCall *)presentMessageDialogWithParams:(FBLinkShareParams *)params
- clientState:(NSDictionary *)clientState
- handler:(FBDialogAppCallCompletionHandler)handler;
- /*!
- @abstract
- Presents a dialog in the Facebook Messenger app that allows the user to share the
- supplied link. No session is required, and the app does not need to be authorized
- to call this.
- Note that this will perform an app switch to the Messenger app, and will cause the
- current app to be suspended. When the share is complete, the Messenger app will redirect
- to a url of the form "fb{APP_ID}://" that the application must handle. The app should
- then call [FBAppCall handleOpenURL:sourceApplication:fallbackHandler:] to trigger
- the appropriate handling. Note that FBAppCall will first try to call the completion
- handler associated with this method, but since during an app switch, the calling app
- may be suspended or killed, the app must also give a fallbackHandler to the
- handleOpenURL: method in FBAppCall.
- @param link The URL link to be attached to the post.
- @param handler A completion handler that may be called when the status update is
- complete. May be nil. If non-nil, the handler will always be called asynchronously.
- @return An FBAppCall object that will also be passed into the provided
- FBAppCallCompletionHandler.
- @discussion A non-nil FBAppCall object is only returned if the corresponding
- canPresentMessageDialogWithParams method is also returning YES for the same params.
- */
- + (FBAppCall *)presentMessageDialogWithLink:(NSURL *)link
- handler:(FBDialogAppCallCompletionHandler)handler;
- /*!
- @abstract
- Presents a dialog in the Facebook Messenger app that allows the user to share the
- supplied link. No session is required, and the app does not need to be authorized
- to call this.
- Note that this will perform an app switch to the Messenger app, and will cause the
- current app to be suspended. When the share is complete, the Messenger app will redirect
- to a url of the form "fb{APP_ID}://" that the application must handle. The app should
- then call [FBAppCall handleOpenURL:sourceApplication:fallbackHandler:] to trigger
- the appropriate handling. Note that FBAppCall will first try to call the completion
- handler associated with this method, but since during an app switch, the calling app
- may be suspended or killed, the app must also give a fallbackHandler to the
- handleOpenURL: method in FBAppCall.
- @param link The URL link to be attached to the post.
- @param name The name, or title associated with the link. May be nil.
- @param handler A completion handler that may be called when the status update is
- complete. May be nil. If non-nil, the handler will always be called asynchronously.
- @return An FBAppCall object that will also be passed into the provided
- FBAppCallCompletionHandler.
- @discussion A non-nil FBAppCall object is only returned if the corresponding
- canPresentMessageDialogWithParams method is also returning YES for the same params.
- */
- + (FBAppCall *)presentMessageDialogWithLink:(NSURL *)link
- name:(NSString *)name
- handler:(FBDialogAppCallCompletionHandler)handler;
- /*!
- @abstract
- Presents a dialog in the Facebook Messenger app that allows the user to share the
- supplied link. No session is required, and the app does not need to be authorized
- to call this.
- Note that this will perform an app switch to the Messenger app, and will cause the
- current app to be suspended. When the share is complete, the Messenger app will redirect
- to a url of the form "fb{APP_ID}://" that the application must handle. The app should
- then call [FBAppCall handleOpenURL:sourceApplication:fallbackHandler:] to trigger
- the appropriate handling. Note that FBAppCall will first try to call the completion
- handler associated with this method, but since during an app switch, the calling app
- may be suspended or killed, the app must also give a fallbackHandler to the
- handleOpenURL: method in FBAppCall.
- @param link The URL link to be attached to the post.
- @param name The name, or title associated with the link. May be nil.
- @param caption The caption to be used with the link. May be nil.
- @param description The description associated with the link. May be nil.
- @param picture The link to a thumbnail to associate with the link. May be nil.
- @param clientState An NSDictionary that's passed through when the completion handler
- is called. This is useful for the app to maintain state about the share request that
- was made so as to have appropriate action when the handler is called. May be nil.
- @param handler A completion handler that may be called when the status update is
- complete. May be nil. If non-nil, the handler will always be called asynchronously.
- @return An FBAppCall object that will also be passed into the provided
- FBAppCallCompletionHandler.
- @discussion A non-nil FBAppCall object is only returned if the corresponding
- canPresentMessageDialogWithParams method is also returning YES for the same params.
- */
- + (FBAppCall *)presentMessageDialogWithLink:(NSURL *)link
- name:(NSString *)name
- caption:(NSString *)caption
- description:(NSString *)description
- picture:(NSURL *)picture
- clientState:(NSDictionary *)clientState
- handler:(FBDialogAppCallCompletionHandler)handler;
- @end
|