From 50da3cce002f960c78b42c88d21f234bf83492d5 Mon Sep 17 00:00:00 2001 From: Israel Soto Date: Wed, 6 May 2015 22:29:27 -0500 Subject: [PATCH] [facebookios] Update binding and sample to version 4.1.0 --- facebookios/binding/ApiDefinition.cs | 528 ++++++++++++------ facebookios/binding/Makefile | 4 +- .../binding/Properties/AssemblyInfo.cs | 2 +- .../FacebookiOSSample/AppDelegate.cs | 7 +- .../FacebookiOSSample/DVCActions.cs | 116 ++-- .../FacebookiOSSample/DVCLogIn.cs | 19 +- .../FacebookiOSSample/Info.plist | 2 +- 7 files changed, 436 insertions(+), 242 deletions(-) diff --git a/facebookios/binding/ApiDefinition.cs b/facebookios/binding/ApiDefinition.cs index c80024f0..034afcfe 100644 --- a/facebookios/binding/ApiDefinition.cs +++ b/facebookios/binding/ApiDefinition.cs @@ -8,7 +8,8 @@ namespace Facebook.CoreKit { - interface AccessTokenDidChangeEventArgs { + interface AccessTokenDidChangeEventArgs + { [Export ("FBSDKAccessTokenChangeNewKey")] AccessToken NewToken { get; } @@ -20,11 +21,12 @@ interface AccessTokenDidChangeEventArgs { } // @interface FBSDKAccessToken : NSObject - [BaseType (typeof (NSObject), Name = "FBSDKAccessToken")] - interface AccessToken : Copying, INSSecureCoding { + [BaseType (typeof(NSObject), Name = "FBSDKAccessToken")] + interface AccessToken : Copying, INSSecureCoding + { // extern NSString *const FBSDKAccessTokenDidChangeNotification; - [Notification (typeof (AccessTokenDidChangeEventArgs))] + [Notification (typeof(AccessTokenDidChangeEventArgs))] [Field ("FBSDKAccessTokenDidChangeNotification", "__Internal")] NSString DidChangeNotification { get; } @@ -82,12 +84,18 @@ interface AccessToken : Copying, INSSecureCoding { [Static] [Export ("currentAccessToken")] AccessToken CurrentAccessToken { get; set; } + + // + (void)refreshCurrentAccessToken:(FBSDKGraphRequestHandler)completionHandler; + [Static] + [Export ("refreshCurrentAccessToken:")] + void RefreshCurrentAccessToken (GraphRequestHandler completionHandler); } // @interface FBSDKAppEvents : NSObject [DisableDefaultCtor] - [BaseType (typeof (NSObject), Name = "FBSDKAppEvents")] - interface AppEvents { + [BaseType (typeof(NSObject), Name = "FBSDKAppEvents")] + interface AppEvents + { // extern NSString *const FBSDKAppEventsLoggingResultNotification; [Notification] @@ -268,8 +276,9 @@ interface AppEvents { // @interface FBSDKApplicationDelegate : NSObject [DisableDefaultCtor] - [BaseType (typeof (NSObject), Name = "FBSDKApplicationDelegate")] - interface ApplicationDelegate { + [BaseType (typeof(NSObject), Name = "FBSDKApplicationDelegate")] + interface ApplicationDelegate + { // +(instancetype)sharedInstance; [Static] @@ -287,12 +296,13 @@ interface ApplicationDelegate { // @interface FBSDKAppLinkResolver : NSObject [DisableDefaultCtor] - [BaseType (typeof (NSObject), Name = "FBSDKAppLinkResolver")] - interface AppLinkResolver : AppLinkResolving { + [BaseType (typeof(NSObject), Name = "FBSDKAppLinkResolver")] + interface AppLinkResolver : AppLinkResolving + { // - (BFTask *)appLinksFromURLsInBackground:(NSArray *)urls; [Export ("appLinksFromURLsInBackground:")] - Task AppLinksInBackground (NSUrl [] urls); + Task AppLinksInBackground (NSUrl[] urls); // + (instancetype)resolver; [Static] @@ -301,12 +311,13 @@ interface AppLinkResolver : AppLinkResolving { } // typedef void (^FBSDKDeferredAppLinkHandler)(NSURL *, NSError *); - delegate void DeferredAppLinkHandler (NSUrl url, NSError error); + delegate void DeferredAppLinkHandler (NSUrl url,NSError error); // @interface FBSDKAppLinkUtility : NSObject [DisableDefaultCtor] - [BaseType (typeof (NSObject), Name = "FBSDKAppLinkUtility")] - interface AppLinkUtility { + [BaseType (typeof(NSObject), Name = "FBSDKAppLinkUtility")] + interface AppLinkUtility + { // +(void)fetchDeferredAppLink:(FBSDKDeferredAppLinkHandler)handler; [Static] @@ -316,15 +327,17 @@ interface AppLinkUtility { } // @interface FBSDKButton : UIButton - [BaseType (typeof (UIButton), Name = "FBSDKButton")] - interface Button { + [BaseType (typeof(UIButton), Name = "FBSDKButton")] + interface Button + { [Export ("initWithFrame:")] IntPtr Constructor (CGRect frame); } [Static] - interface Errors { + interface Errors + { // extern NSString *const FBSDKErrorDomain; [Field ("FBSDKErrorDomain", "__Internal")] @@ -378,21 +391,26 @@ interface Errors { // @protocol FBSDKErrorRecoveryAttempting [Model] [Protocol] - [BaseType (typeof (NSObject), Name = "FBSDKErrorRecoveryAttempting")] - interface ErrorRecoveryAttempting { + [BaseType (typeof(NSObject), Name = "FBSDKErrorRecoveryAttempting")] + interface ErrorRecoveryAttempting + { // @required -(void)attemptRecoveryFromError:(NSError *)error optionIndex:(NSUInteger)recoveryOptionIndex delegate:(id)delegate didRecoverSelector:(SEL)didRecoverSelector contextInfo:(void *)contextInfo; [Abstract] [Export ("attemptRecoveryFromError:optionIndex:delegate:didRecoverSelector:contextInfo:")] unsafe void AttemptRecovery (NSError error, nuint recoveryOptionIndex, NSObject aDelegate, Selector didRecoverSelector, NSObject contextInfo); } - interface ICopying { } + interface ICopying + { + + } // @protocol FBSDKCopying [Model] [Protocol] - [BaseType (typeof (NSObject), Name = "FBSDKCopying")] - interface Copying : INSCopying { + [BaseType (typeof(NSObject), Name = "FBSDKCopying")] + interface Copying : INSCopying + { // @required -(id)copy; [New] [Abstract] @@ -400,13 +418,17 @@ interface Copying : INSCopying { NSObject Copy (); } - interface IGraphErrorRecoveryProcessorDelegate { } + interface IGraphErrorRecoveryProcessorDelegate + { + + } // @protocol FBSDKGraphErrorRecoveryProcessorDelegate [Model] [Protocol] - [BaseType (typeof (NSObject), Name = "FBSDKGraphErrorRecoveryProcessorDelegate")] - interface GraphErrorRecoveryProcessorDelegate { + [BaseType (typeof(NSObject), Name = "FBSDKGraphErrorRecoveryProcessorDelegate")] + interface GraphErrorRecoveryProcessorDelegate + { // @required -(void)processorDidAttemptRecovery:(FBSDKGraphErrorRecoveryProcessor *)processor didRecover:(BOOL)didRecover error:(NSError *)error; [Abstract] @@ -419,8 +441,9 @@ interface GraphErrorRecoveryProcessorDelegate { } // @interface FBSDKGraphErrorRecoveryProcessor : NSObject - [BaseType (typeof (NSObject), Name = "FBSDKGraphErrorRecoveryProcessor")] - interface GraphErrorRecoveryProcessor { + [BaseType (typeof(NSObject), Name = "FBSDKGraphErrorRecoveryProcessor")] + interface GraphErrorRecoveryProcessor + { // @property (readonly, nonatomic, strong) id delegate; [Export ("delegate", ArgumentSemantic.Strong)] @@ -437,8 +460,9 @@ interface GraphErrorRecoveryProcessor { // @interface FBSDKGraphRequest : NSObject [DisableDefaultCtor] - [BaseType (typeof (NSObject), Name = "FBSDKGraphRequest")] - interface GraphRequest { + [BaseType (typeof(NSObject), Name = "FBSDKGraphRequest")] + interface GraphRequest + { // -(instancetype)initWithGraphPath:(NSString *)graphPath parameters:(NSDictionary *)parameters; [Export ("initWithGraphPath:parameters:")] @@ -482,15 +506,19 @@ interface GraphRequest { } // typedef void (^FBSDKGraphRequestHandler)(FBSDKGraphRequestConnection *id, NSError *); - delegate void GraphRequestHandler (GraphRequestConnection connection, NSObject result, NSError error); + delegate void GraphRequestHandler (GraphRequestConnection connection,NSObject result,NSError error); - interface IGraphRequestConnectionDelegate { } + interface IGraphRequestConnectionDelegate + { + + } // @protocol FBSDKGraphRequestConnectionDelegate [Model] [Protocol] - [BaseType (typeof (NSObject), Name = "FBSDKGraphRequestConnectionDelegate")] - interface GraphRequestConnectionDelegate { + [BaseType (typeof(NSObject), Name = "FBSDKGraphRequestConnectionDelegate")] + interface GraphRequestConnectionDelegate + { // @optional -(void)requestConnectionWillBeginLoading:(FBSDKGraphRequestConnection *)connection; [EventArgs ("GraphRequestConnectionWillBeginLoading")] @@ -517,11 +545,12 @@ interface GraphRequestConnectionDelegate { } // @interface FBSDKGraphRequestConnection : NSObject - [BaseType (typeof (NSObject), + [BaseType (typeof(NSObject), Name = "FBSDKGraphRequestConnection", Delegates = new [] { "Delegate" }, - Events = new [] { typeof (GraphRequestConnectionDelegate) })] - interface GraphRequestConnection { + Events = new [] { typeof(GraphRequestConnectionDelegate) })] + interface GraphRequestConnection + { // extern NSString *const FBSDKNonJSONResponseProperty; [Field ("FBSDKNonJSONResponseProperty", "__Internal")] @@ -571,7 +600,7 @@ interface GraphRequestConnection { // @interface FBSDKGraphRequestDataAttachment : NSObject [DisableDefaultCtor] - [BaseType (typeof (NSObject), Name = "FBSDKGraphRequestDataAttachment")] + [BaseType (typeof(NSObject), Name = "FBSDKGraphRequestDataAttachment")] interface GraphRequestDataAttachment { // -(instancetype)initWithData:(NSData *)data filename:(NSString *)filename contentType:(NSString *)contentType __attribute__((objc_designated_initializer)); @@ -594,8 +623,9 @@ interface GraphRequestDataAttachment // @protocol FBSDKMutableCopying [Model] [Protocol] - [BaseType (typeof (NSObject), Name = "FBSDKMutableCopying")] - interface MutableCopying : Copying, INSMutableCopying { + [BaseType (typeof(NSObject), Name = "FBSDKMutableCopying")] + interface MutableCopying : Copying, INSMutableCopying + { // @required -(id)mutableCopy; [New] @@ -604,7 +634,8 @@ interface MutableCopying : Copying, INSMutableCopying { NSObject MutableCopy (); } - interface ProfileDidChangeEventArgs { + interface ProfileDidChangeEventArgs + { [Export ("FBSDKProfileChangeOldKey")] Profile OldProfile { get; } @@ -614,11 +645,12 @@ interface ProfileDidChangeEventArgs { // @interface FBSDKProfile : NSObject [DisableDefaultCtor] - [BaseType (typeof (NSObject), Name = "FBSDKProfile")] - interface Profile : INSCopying, INSSecureCoding { + [BaseType (typeof(NSObject), Name = "FBSDKProfile")] + interface Profile : INSCopying, INSSecureCoding + { // extern NSString *const FBSDKProfileDidChangeNotification; - [Notification (typeof (ProfileDidChangeEventArgs))] + [Notification (typeof(ProfileDidChangeEventArgs))] [Field ("FBSDKProfileDidChangeNotification", "__Internal")] NSString DidChangeNotification { get; } @@ -681,7 +713,7 @@ interface Profile : INSCopying, INSSecureCoding { } // @interface FBSDKProfilePictureView : UIView - [BaseType (typeof (UIView), Name = "FBSDKProfilePictureView")] + [BaseType (typeof(UIView), Name = "FBSDKProfilePictureView")] interface ProfilePictureView { [Export ("initWithFrame:")] @@ -701,7 +733,8 @@ interface ProfilePictureView } [Static] - interface LoggingBehavior { + interface LoggingBehavior + { // extern NSString *const FBSDKLoggingBehaviorAccessTokens; [Field ("FBSDKLoggingBehaviorAccessTokens", "__Internal")] @@ -746,8 +779,9 @@ interface LoggingBehavior { // @interface FBSDKSettings : NSObject [DisableDefaultCtor] - [BaseType (typeof (NSObject), Name = "FBSDKSettings")] - interface Settings { + [BaseType (typeof(NSObject), Name = "FBSDKSettings")] + interface Settings + { // +(NSString *)appID; // +(void)setAppID:(NSString *)appID; @@ -824,10 +858,42 @@ interface Settings { string LegacyUserDefaultTokenInformationKeyName { get; set; } } + delegate void TestUsersManagerRetrieveTestAccountTokensHandler (AccessToken[] tokens,NSError error); + delegate void TestUsersManagerRemoveTestAccountHandler (NSError error); + // @interface FBSDKUtility : NSObject [DisableDefaultCtor] - [BaseType (typeof (NSObject), Name = "FBSDKUtility")] - interface Utility { + [BaseType (typeof(NSObject), Name = "FBSDKTestUsersManager")] + interface TestUsersManager + { + + // +(instancetype)sharedInstanceForAppID:(NSString *)appID appSecret:(NSString *)appSecret; + [Static] + [Export ("sharedInstanceForAppID:appSecret:")] + TestUsersManager SharedInstance (string appID, string appSecret); + + // -(void)requestTestAccountTokensWithArraysOfPermissions:(NSArray *)arraysOfPermissions createIfNotFound:(BOOL)createIfNotFound completionHandler:(FBSDKTestUsersManagerRetrieveTestAccountTokensHandler)handler; + [Export ("requestTestAccountTokensWithArraysOfPermissions:createIfNotFound:completionHandler:")] + void RequestTestAccount (string[] arraysOfPermissions, bool createIfNotFound, TestUsersManagerRetrieveTestAccountTokensHandler handler); + + // -(void)addTestAccountWithPermissions:(NSSet *)permissions completionHandler:(FBSDKTestUsersManagerRetrieveTestAccountTokensHandler)handler; + [Export ("addTestAccountWithPermissions:completionHandler:")] + void AddTestAccount (NSSet permissions, TestUsersManagerRetrieveTestAccountTokensHandler handler); + + // -(void)removeTestAccount:(NSString *)userId completionHandler:(FBSDKTestUsersManagerRemoveTestAccountHandler)handler; + [Export ("removeTestAccount:completionHandler:")] + void RemoveTestAccount (string userId, TestUsersManagerRemoveTestAccountHandler handler); + + // -(void)makeFriendsWithFirst:(FBSDKAccessToken *)first second:(FBSDKAccessToken *)second callback:(void (^)(NSError *))callback; + [Export ("makeFriendsWithFirst:second:callback:")] + void MakeFriends (AccessToken first, AccessToken second, TestUsersManagerRemoveTestAccountHandler callback); + } + + // @interface FBSDKUtility : NSObject + [DisableDefaultCtor] + [BaseType (typeof(NSObject), Name = "FBSDKUtility")] + interface Utility + { // +(NSDictionary *)dictionaryWithQueryString:(NSString *)queryString; [Static] @@ -853,7 +919,7 @@ interface Utility { #region Facebook.Bolts // This just binds what is needed to work - [BaseType (typeof (NSObject), Name = "BFTask")] + [BaseType (typeof(NSObject), Name = "BFTask")] interface Task { @@ -876,11 +942,14 @@ interface Task bool IsCompleted { get; } } - interface IAppLinkResolving { } + interface IAppLinkResolving + { + + } [Model] [Protocol] - [BaseType (typeof (NSObject), Name = "BFAppLinkResolving")] + [BaseType (typeof(NSObject), Name = "BFAppLinkResolving")] interface AppLinkResolving { @@ -896,11 +965,12 @@ interface AppLinkResolving namespace Facebook.LoginKit { // @interface FBSDKLoginButton : FBSDKButton - [BaseType (typeof (CoreKit.Button), + [BaseType (typeof(CoreKit.Button), Name = "FBSDKLoginButton", Delegates = new [] { "Delegate" }, - Events = new [] { typeof (LoginButtonDelegate) })] - interface LoginButton { + Events = new [] { typeof(LoginButtonDelegate) })] + interface LoginButton + { [Export ("initWithFrame:")] IntPtr Constructor (CGRect frame); @@ -941,13 +1011,17 @@ interface LoginButton { TooltipColorStyle TooltipColorStyle { get; set; } } - interface ILoginButtonDelegate { } + interface ILoginButtonDelegate + { + + } // @protocol FBSDKLoginButtonDelegate [Model] [Protocol] - [BaseType (typeof (NSObject), Name = "FBSDKLoginButtonDelegate")] - interface LoginButtonDelegate { + [BaseType (typeof(NSObject), Name = "FBSDKLoginButtonDelegate")] + interface LoginButtonDelegate + { // @required -(void)loginButton:(FBSDKLoginButton *)loginButton didCompleteWithResult:(FBSDKLoginManagerLoginResult *)result error:(NSError *)error; [Abstract] @@ -965,12 +1039,13 @@ interface LoginButtonDelegate { } // typedef void (^FBSDKLoginManagerRequestTokenHandler)(FBSDKLoginManagerLoginResult *NSError *); - delegate void LoginManagerRequestTokenHandler (LoginManagerLoginResult result, NSError error); - delegate void LoginManagerRenewSystemCredentialsHandler (ACAccountCredentialRenewResult credentials, NSError error); + delegate void LoginManagerRequestTokenHandler (LoginManagerLoginResult result,NSError error); + delegate void LoginManagerRenewSystemCredentialsHandler (ACAccountCredentialRenewResult credentials,NSError error); // @interface FBSDKLoginManager : NSObject - [BaseType (typeof (NSObject), Name = "FBSDKLoginManager")] - interface LoginManager { + [BaseType (typeof(NSObject), Name = "FBSDKLoginManager")] + interface LoginManager + { // @property (assign, nonatomic) FBSDKDefaultAudience defaultAudience; [Export ("defaultAudience", ArgumentSemantic.Assign)] @@ -983,12 +1058,12 @@ interface LoginManager { // -(void)logInWithReadPermissions:(NSArray *)permissions handler:(FBSDKLoginManagerRequestTokenHandler)handler; [Async] [Export ("logInWithReadPermissions:handler:")] - void LogInWithReadPermissions ([NullAllowed] string [] permissions, LoginManagerRequestTokenHandler handler); + void LogInWithReadPermissions ([NullAllowed] string[] permissions, LoginManagerRequestTokenHandler handler); // -(void)logInWithPublishPermissions:(NSArray *)permissions handler:(FBSDKLoginManagerRequestTokenHandler)handler; [Async] [Export ("logInWithPublishPermissions:handler:")] - void LogInWithPublishPermissions ([NullAllowed] string [] permissions, LoginManagerRequestTokenHandler handler); + void LogInWithPublishPermissions ([NullAllowed] string[] permissions, LoginManagerRequestTokenHandler handler); // -(void)logOut; [Export ("logOut")] @@ -1002,8 +1077,9 @@ interface LoginManager { } // @interface FBSDKLoginManagerLoginResult : NSObject - [BaseType (typeof (NSObject), Name = "FBSDKLoginManagerLoginResult")] - interface LoginManagerLoginResult { + [BaseType (typeof(NSObject), Name = "FBSDKLoginManagerLoginResult")] + interface LoginManagerLoginResult + { // @property (copy, nonatomic) FBSDKAccessToken * token; [NullAllowed] @@ -1030,11 +1106,12 @@ interface LoginManagerLoginResult { } // @interface FBSDKLoginTooltipView : FBSDKTooltipView - [BaseType (typeof (TooltipView), + [BaseType (typeof(TooltipView), Name = "FBSDKLoginTooltipView", Delegates = new [] { "Delegate" }, - Events = new [] { typeof (LoginTooltipViewDelegate) })] - interface LoginTooltipView { + Events = new [] { typeof(LoginTooltipViewDelegate) })] + interface LoginTooltipView + { [Export ("initWithFrame:")] IntPtr Constructor (CGRect frame); @@ -1049,13 +1126,17 @@ interface LoginTooltipView { bool ForceDisplay { get; set; } } - interface ILoginTooltipViewDelegate { } + interface ILoginTooltipViewDelegate + { + + } // @protocol FBSDKLoginTooltipViewDelegate [Model] [Protocol] - [BaseType (typeof (NSObject), Name = "FBSDKLoginTooltipViewDelegate")] - interface LoginTooltipViewDelegate { + [BaseType (typeof(NSObject), Name = "FBSDKLoginTooltipViewDelegate")] + interface LoginTooltipViewDelegate + { // @optional -(BOOL)loginTooltipView:(FBSDKLoginTooltipView *)view shouldAppear:(BOOL)appIsEligible; [DelegateName ("LoginTooltipViewShouldAppear")] @@ -1075,8 +1156,9 @@ interface LoginTooltipViewDelegate { } // @interface FBSDKTooltipView : UIView - [BaseType (typeof (UIView), Name = "FBSDKTooltipView")] - interface TooltipView { + [BaseType (typeof(UIView), Name = "FBSDKTooltipView")] + interface TooltipView + { [Export ("initWithFrame:")] IntPtr Constructor (CGRect frame); @@ -1119,14 +1201,16 @@ namespace Facebook.MessengerShareKit { // @interface FBSDKMessengerBroadcastContext : FBSDKMessengerContext [BaseType (typeof(MessengerContext), Name = "FBSDKMessengerBroadcastContext")] - interface MessengerBroadcastContext { + interface MessengerBroadcastContext + { } // @interface FBSDKMessengerShareButton : NSObject [DisableDefaultCtor] - [BaseType (typeof (NSObject), Name = "FBSDKMessengerShareButton")] - interface MessengerShareButton { + [BaseType (typeof(NSObject), Name = "FBSDKMessengerShareButton")] + interface MessengerShareButton + { // +(UIButton *)rectangularButtonWithStyle:(FBSDKMessengerShareButtonStyle)style; [Static] @@ -1145,14 +1229,16 @@ interface MessengerShareButton { } // @interface FBSDKMessengerContext : NSObject - [BaseType (typeof (NSObject), Name = "FBSDKMessengerContext")] - interface MessengerContext : INSSecureCoding { + [BaseType (typeof(NSObject), Name = "FBSDKMessengerContext")] + interface MessengerContext : INSSecureCoding + { } // @interface FBSDKMessengerShareOptions : NSObject - [BaseType (typeof (NSObject), Name = "FBSDKMessengerShareOptions")] - interface MessengerShareOptions { + [BaseType (typeof(NSObject), Name = "FBSDKMessengerShareOptions")] + interface MessengerShareOptions + { // @property (readwrite, copy, nonatomic) NSString * metadata; [Export ("metadata", ArgumentSemantic.Copy)] @@ -1171,8 +1257,9 @@ interface MessengerShareOptions { // @interface FBSDKMessengerSharer : NSObject [DisableDefaultCtor] - [BaseType (typeof (NSObject), Name = "FBSDKMessengerSharer")] - interface MessengerSharer { + [BaseType (typeof(NSObject), Name = "FBSDKMessengerSharer")] + interface MessengerSharer + { // +(FBSDKMessengerPlatformCapability)messengerPlatformCapabilities; [Static] @@ -1240,13 +1327,17 @@ interface MessengerSharer { void ShareAudio ([NullAllowed] NSData audioData, [NullAllowed] MessengerShareOptions options); } - interface IMessengerUrlHandlerDelegate { } + interface IMessengerUrlHandlerDelegate + { + + } // @protocol FBSDKMessengerURLHandlerDelegate [Model] [Protocol] - [BaseType (typeof (NSObject), Name = "FBSDKMessengerURLHandlerDelegate")] - interface MessengerUrlHandlerDelegate { + [BaseType (typeof(NSObject), Name = "FBSDKMessengerURLHandlerDelegate")] + interface MessengerUrlHandlerDelegate + { // @optional -(void)messengerURLHandler:(FBSDKMessengerURLHandler *)messengerURLHandler didHandleReplyWithContext:(FBSDKMessengerURLHandlerReplyContext *)context; [EventArgs ("MessengerUrlHandlerReplyHandled")] @@ -1268,11 +1359,12 @@ interface MessengerUrlHandlerDelegate { } // @interface FBSDKMessengerURLHandler : NSObject - [BaseType (typeof (NSObject), + [BaseType (typeof(NSObject), Name = "FBSDKMessengerURLHandler", Delegates = new [] { "Delegate" }, - Events = new [] { typeof (MessengerUrlHandlerDelegate) })] - interface MessengerUrlHandler { + Events = new [] { typeof(MessengerUrlHandlerDelegate) })] + interface MessengerUrlHandler + { // -(BOOL)canOpenURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication; [Export ("canOpenURL:sourceApplication:")] @@ -1289,20 +1381,15 @@ interface MessengerUrlHandler { } // @interface FBSDKMessengerURLHandlerCancelContext : FBSDKMessengerContext - [BaseType (typeof (MessengerContext), Name = "FBSDKMessengerURLHandlerCancelContext")] - interface MessengerUrlHandlerCancelContext { + [BaseType (typeof(MessengerContext), Name = "FBSDKMessengerURLHandlerCancelContext")] + interface MessengerUrlHandlerCancelContext + { } -// // @interface FBSDKMessengerURLHandlerCancelShareContext : FBSDKMessengerContext -// [BaseType (typeof (MessengerContext))] -// interface FBSDKMessengerURLHandlerCancelShareContext { -// -// } - // @interface FBSDKMessengerURLHandlerOpenFromComposerContext : FBSDKMessengerContext [DisableDefaultCtor] - [BaseType (typeof (MessengerContext), Name = "FBSDKMessengerURLHandlerOpenFromComposerContext")] + [BaseType (typeof(MessengerContext), Name = "FBSDKMessengerURLHandlerOpenFromComposerContext")] interface MessengerUrlHandlerOpenFromComposerContext { @@ -1316,7 +1403,7 @@ interface MessengerUrlHandlerOpenFromComposerContext } // @interface FBSDKMessengerURLHandlerReplyContext : FBSDKMessengerContext - [BaseType (typeof (MessengerContext), Name = "FBSDKMessengerURLHandlerReplyContext")] + [BaseType (typeof(MessengerContext), Name = "FBSDKMessengerURLHandlerReplyContext")] interface MessengerUrlHandlerReplyContext { // @property (readonly, copy, nonatomic) NSString * metadata; @@ -1332,11 +1419,12 @@ interface MessengerUrlHandlerReplyContext namespace Facebook.ShareKit { // @interface FBSDKAppGroupAddDialog : NSObject - [BaseType (typeof (NSObject), + [BaseType (typeof(NSObject), Name = "FBSDKAppGroupAddDialog", Delegates = new [] { "Delegate" }, - Events = new [] { typeof (AppGroupAddDialogDelegate) })] - interface AppGroupAddDialog { + Events = new [] { typeof(AppGroupAddDialogDelegate) })] + interface AppGroupAddDialog + { // +(instancetype)showWithContent:(FBSDKAppGroupContent *)content delegate:(id)delegate; [Static] @@ -1366,13 +1454,17 @@ interface AppGroupAddDialog { bool Validate (out NSError error); } - interface IAppGroupAddDialogDelegate { } + interface IAppGroupAddDialogDelegate + { + + } // @protocol FBSDKAppGroupAddDialogDelegate [Model] [Protocol] - [BaseType (typeof (NSObject), Name = "FBSDKAppGroupAddDialogDelegate")] - interface AppGroupAddDialogDelegate { + [BaseType (typeof(NSObject), Name = "FBSDKAppGroupAddDialogDelegate")] + interface AppGroupAddDialogDelegate + { // @required -(void)appGroupAddDialog:(FBSDKAppGroupAddDialog *)appGroupAddDialog didCompleteWithResults:(NSDictionary *)results; [Abstract] @@ -1397,8 +1489,9 @@ interface AppGroupAddDialogDelegate { } // @interface FBSDKAppGroupContent : NSObject - [BaseType (typeof (NSObject), Name = "FBSDKAppGroupContent")] - interface AppGroupContent : CoreKit.Copying, INSSecureCoding { + [BaseType (typeof(NSObject), Name = "FBSDKAppGroupContent")] + interface AppGroupContent : CoreKit.Copying, INSSecureCoding + { // @property (copy, nonatomic) NSString * groupDescription; [Export ("groupDescription", ArgumentSemantic.Copy)] @@ -1422,11 +1515,12 @@ interface AppGroupContent : CoreKit.Copying, INSSecureCoding { } // @interface FBSDKAppGroupJoinDialog : NSObject - [BaseType (typeof (NSObject), + [BaseType (typeof(NSObject), Name = "FBSDKAppGroupJoinDialog", Delegates = new [] { "Delegate" }, - Events = new [] { typeof (AppGroupJoinDialogDelegate) })] - interface AppGroupJoinDialog { + Events = new [] { typeof(AppGroupJoinDialogDelegate) })] + interface AppGroupJoinDialog + { // +(instancetype)showWithGroupID:(NSString *)groupID delegate:(id)delegate; [Static] @@ -1455,13 +1549,17 @@ interface AppGroupJoinDialog { bool Validate (out NSError error); } - interface IAppGroupJoinDialogDelegate { } + interface IAppGroupJoinDialogDelegate + { + + } // @protocol FBSDKAppGroupJoinDialogDelegate [Model] [Protocol] - [BaseType (typeof (NSObject), Name = "FBSDKAppGroupJoinDialogDelegate")] - interface AppGroupJoinDialogDelegate { + [BaseType (typeof(NSObject), Name = "FBSDKAppGroupJoinDialogDelegate")] + interface AppGroupJoinDialogDelegate + { // @required -(void)appGroupJoinDialog:(FBSDKAppGroupJoinDialog *)appGroupJoinDialog didCompleteWithResults:(NSDictionary *)results; [Abstract] @@ -1486,12 +1584,9 @@ interface AppGroupJoinDialogDelegate { } // @interface FBSDKAppInviteContent : NSObject - [BaseType (typeof (NSObject), Name = "FBSDKAppInviteContent")] - interface AppInviteContent : CoreKit.Copying, INSSecureCoding { - - // -(instancetype)initWithAppLinkURL:(NSURL *)appLinkURL __attribute__((objc_designated_initializer)); - [Export ("initWithAppLinkURL:")] - IntPtr Constructor ([NullAllowed] NSUrl appLinkURL); + [BaseType (typeof(NSObject), Name = "FBSDKAppInviteContent")] + interface AppInviteContent : CoreKit.Copying, INSSecureCoding + { // @property (copy, nonatomic) NSURL * appLinkURL; [NullAllowed] @@ -1509,10 +1604,10 @@ interface AppInviteContent : CoreKit.Copying, INSSecureCoding { } // @interface FBSDKAppInviteDialog : NSObject - [BaseType (typeof (NSObject), + [BaseType (typeof(NSObject), Name = "FBSDKAppInviteDialog", Delegates = new [] { "Delegate" }, - Events = new [] { typeof (AppInviteDialogDelegate) })] + Events = new [] { typeof(AppInviteDialogDelegate) })] interface AppInviteDialog { // +(instancetype)showWithContent:(FBSDKAppInviteContent *)content delegate:(id)delegate; @@ -1543,13 +1638,17 @@ interface AppInviteDialog bool Validate (out NSError error); } - interface IAppInviteDialogDelegate { } + interface IAppInviteDialogDelegate + { + + } // @protocol FBSDKAppInviteDialogDelegate [Model] [Protocol] - [BaseType (typeof (NSObject), Name = "FBSDKAppInviteDialogDelegate")] - interface AppInviteDialogDelegate { + [BaseType (typeof(NSObject), Name = "FBSDKAppInviteDialogDelegate")] + interface AppInviteDialogDelegate + { // @required -(void)appInviteDialog:(FBSDKAppInviteDialog *)appInviteDialog didCompleteWithResults:(NSDictionary *)results; [Abstract] @@ -1567,8 +1666,9 @@ interface AppInviteDialogDelegate { } // @interface FBSDKGameRequestContent : NSObject - [BaseType (typeof (NSObject), Name = "FBSDKGameRequestContent")] - interface GameRequestContent : CoreKit.Copying, INSSecureCoding { + [BaseType (typeof(NSObject), Name = "FBSDKGameRequestContent")] + interface GameRequestContent : CoreKit.Copying, INSSecureCoding + { // @property (assign, nonatomic) FBSDKGameRequestActionType actionType; [Export ("actionType", ArgumentSemantic.Assign)] @@ -1610,11 +1710,12 @@ interface GameRequestContent : CoreKit.Copying, INSSecureCoding { } // @interface FBSDKGameRequestDialog : NSObject - [BaseType (typeof (NSObject), + [BaseType (typeof(NSObject), Name = "FBSDKGameRequestDialog", Delegates = new [] { "Delegate" }, - Events = new [] { typeof (GameRequestDialogDelegate) })] - interface GameRequestDialog { + Events = new [] { typeof(GameRequestDialogDelegate) })] + interface GameRequestDialog + { // +(instancetype)showWithContent:(FBSDKGameRequestContent *)content delegate:(id)delegate; [Static] @@ -1648,12 +1749,15 @@ interface GameRequestDialog { bool Validate (out NSError error); } - interface IGameRequestDialogDelegate { } + interface IGameRequestDialogDelegate + { + + } // @protocol FBSDKGameRequestDialogDelegate [Model] [Protocol] - [BaseType (typeof (NSObject), Name = "FBSDKGameRequestDialogDelegate")] + [BaseType (typeof(NSObject), Name = "FBSDKGameRequestDialogDelegate")] interface GameRequestDialogDelegate { @@ -1680,8 +1784,9 @@ interface GameRequestDialogDelegate } // @interface FBSDKLikeButton : FBSDKButton - [BaseType (typeof (CoreKit.Button), Name = "FBSDKLikeButton")] - interface LikeButton : Liking { + [BaseType (typeof(CoreKit.Button), Name = "FBSDKLikeButton")] + interface LikeButton : Liking + { [Export ("initWithFrame:")] IntPtr Constructor (CGRect frame); @@ -1692,8 +1797,9 @@ interface LikeButton : Liking { } // @interface FBSDKLikeControl : UIControl - [BaseType (typeof (UIControl), Name = "FBSDKLikeControl")] - interface LikeControl : Liking { + [BaseType (typeof(UIControl), Name = "FBSDKLikeControl")] + interface LikeControl : Liking + { [Export ("initWithFrame:")] IntPtr Constructor (CGRect frame); @@ -1723,13 +1829,17 @@ interface LikeControl : Liking { bool SoundEnabled { [Bind ("isSoundEnabled")] get; set; } } - interface ILiking { } + interface ILiking + { + + } // @protocol FBSDKLiking [Model] [Protocol] - [BaseType (typeof (NSObject), Name = "FBSDKLiking")] - interface Liking { + [BaseType (typeof(NSObject), Name = "FBSDKLiking")] + interface Liking + { // @required @property (copy, nonatomic) NSString * objectID; [Export ("objectID")] @@ -1748,8 +1858,9 @@ interface Liking { // @interface FBSDKMessageDialog : NSObject [DisableDefaultCtor] - [BaseType (typeof (NSObject), Name = "FBSDKMessageDialog")] - interface MessageDialog : SharingDialog { + [BaseType (typeof(NSObject), Name = "FBSDKMessageDialog")] + interface MessageDialog : SharingDialog + { // +(instancetype)showWithContent:(id)content delegate:(id)delegate; [Static] @@ -1758,8 +1869,9 @@ interface MessageDialog : SharingDialog { } // @interface FBSDKSendButton : FBSDKButton - [BaseType (typeof (CoreKit.Button), Name = "FBSDKSendButton")] - interface SendButton : SharingButton { + [BaseType (typeof(CoreKit.Button), Name = "FBSDKSendButton")] + interface SendButton : SharingButton + { [Export ("initWithFrame:")] IntPtr Constructor (CGRect frame); @@ -1767,8 +1879,9 @@ interface SendButton : SharingButton { // @interface FBSDKShareAPI : NSObject [DisableDefaultCtor] - [BaseType (typeof (NSObject), Name = "FBSDKShareAPI")] - interface ShareAPI : Sharing { + [BaseType (typeof(NSObject), Name = "FBSDKShareAPI")] + interface ShareAPI : Sharing + { // extern NSString *const FBSDKShareErrorDomain; [Field ("FBSDKShareErrorDomain", "__Internal")] @@ -1783,6 +1896,10 @@ interface ShareAPI : Sharing { [Export ("createObjectsWithClientToken", ArgumentSemantic.Assign)] bool CreateObjectsWithClientToken { get; set; } + // @property (nonatomic, copy) NSString *message; + [Export ("message", ArgumentSemantic.Copy)] + string Message { get; set; } + // -(BOOL)canShare; [Export ("canShare")] bool CanShare (); @@ -1797,8 +1914,9 @@ interface ShareAPI : Sharing { } // @interface FBSDKShareButton : FBSDKButton - [BaseType (typeof (CoreKit.Button), Name = "FBSDKShareButton")] - interface ShareButton : SharingButton { + [BaseType (typeof(CoreKit.Button), Name = "FBSDKShareButton")] + interface ShareButton : SharingButton + { [Export ("initWithFrame:")] IntPtr Constructor (CGRect frame); @@ -1806,8 +1924,9 @@ interface ShareButton : SharingButton { // @interface FBSDKShareDialog : NSObject [DisableDefaultCtor] - [BaseType (typeof (NSObject), Name = "FBSDKShareDialog")] - interface ShareDialog : SharingDialog { + [BaseType (typeof(NSObject), Name = "FBSDKShareDialog")] + interface ShareDialog : SharingDialog + { // +(instancetype)showFromViewController:(UIViewController *)viewController withContent:(id)content delegate:(id)delegate; [Static] @@ -1826,7 +1945,8 @@ interface ShareDialog : SharingDialog { // @interface FBSDKShareLinkContent : NSObject [BaseType (typeof(NSObject), Name = "FBSDKShareLinkContent")] - interface ShareLinkContent : SharingContent { + interface ShareLinkContent : SharingContent + { // @property (copy, nonatomic) NSString * contentDescription; [Export ("contentDescription", ArgumentSemantic.Copy)] @@ -1848,8 +1968,9 @@ interface ShareLinkContent : SharingContent { // @interface FBSDKShareOpenGraphAction : FBSDKShareOpenGraphValueContainer [DisableDefaultCtor] - [BaseType (typeof (ShareOpenGraphValueContainer), Name = "FBSDKShareOpenGraphAction")] - interface ShareOpenGraphAction : CoreKit.Copying, INSSecureCoding { + [BaseType (typeof(ShareOpenGraphValueContainer), Name = "FBSDKShareOpenGraphAction")] + interface ShareOpenGraphAction : CoreKit.Copying, INSSecureCoding + { // +(instancetype)actionWithType:(NSString *)actionType object:(FBSDKShareOpenGraphObject *)object key:(NSString *)key; [Static] @@ -1876,8 +1997,9 @@ interface ShareOpenGraphAction : CoreKit.Copying, INSSecureCoding { } // @interface FBSDKShareOpenGraphContent : NSObject - [BaseType (typeof (NSObject), Name = "FBSDKShareOpenGraphContent")] - interface ShareOpenGraphContent : SharingContent { + [BaseType (typeof(NSObject), Name = "FBSDKShareOpenGraphContent")] + interface ShareOpenGraphContent : SharingContent + { // @property (copy, nonatomic) FBSDKShareOpenGraphAction * action; [NullAllowed] @@ -1895,8 +2017,9 @@ interface ShareOpenGraphContent : SharingContent { // @interface FBSDKShareOpenGraphObject : FBSDKShareOpenGraphValueContainer [DisableDefaultCtor] - [BaseType (typeof (ShareOpenGraphValueContainer), Name = "FBSDKShareOpenGraphObject")] - interface ShareOpenGraphObject : CoreKit.Copying, INSSecureCoding { + [BaseType (typeof(ShareOpenGraphValueContainer), Name = "FBSDKShareOpenGraphObject")] + interface ShareOpenGraphObject : CoreKit.Copying, INSSecureCoding + { // +(instancetype)objectWithProperties:(NSDictionary *)properties; [Static] @@ -1908,15 +2031,19 @@ interface ShareOpenGraphObject : CoreKit.Copying, INSSecureCoding { bool IsEqualToShareOpenGraphObject (ShareOpenGraphObject aObject); } - interface IShareOpenGraphValueContaining { } + interface IShareOpenGraphValueContaining + { + + } - delegate void ShareOpenGraphValueContainingEnumerateHandle (string key, NSObject id, ref bool stop); + delegate void ShareOpenGraphValueContainingEnumerateHandle (string key,NSObject id,ref bool stop); // @protocol FBSDKShareOpenGraphValueContaining [Model] [Protocol] - [BaseType (typeof (NSObject), Name = "FBSDKShareOpenGraphValueContaining")] - interface ShareOpenGraphValueContaining : INSSecureCoding { + [BaseType (typeof(NSObject), Name = "FBSDKShareOpenGraphValueContaining")] + interface ShareOpenGraphValueContaining : INSSecureCoding + { // @required -(NSArray *)arrayForKey:(NSString *)key; [Abstract] @@ -1971,7 +2098,7 @@ interface ShareOpenGraphValueContaining : INSSecureCoding { // @required -(void)setArray:(NSArray *)array forKey:(NSString *)key; [Abstract] [Export ("setArray:forKey:")] - void SetArray (NSObject [] array, string key); + void SetArray (NSObject[] array, string key); // @required -(void)setNumber:(NSNumber *)number forKey:(NSString *)key; [Abstract] @@ -2010,15 +2137,17 @@ interface ShareOpenGraphValueContaining : INSSecureCoding { } // @interface FBSDKShareOpenGraphValueContainer : NSObject - [BaseType (typeof (NSObject), Name = "FBSDKShareOpenGraphValueContainer")] - interface ShareOpenGraphValueContainer : ShareOpenGraphValueContaining { + [BaseType (typeof(NSObject), Name = "FBSDKShareOpenGraphValueContainer")] + interface ShareOpenGraphValueContainer : ShareOpenGraphValueContaining + { } // @interface FBSDKSharePhoto : NSObject [DisableDefaultCtor] - [BaseType (typeof (NSObject), Name = "FBSDKSharePhoto")] - interface SharePhoto : CoreKit.Copying, INSSecureCoding { + [BaseType (typeof(NSObject), Name = "FBSDKSharePhoto")] + interface SharePhoto : CoreKit.Copying, INSSecureCoding + { // +(instancetype)photoWithImage:(UIImage *)image userGenerated:(BOOL)userGenerated; [Static] @@ -2047,11 +2176,16 @@ interface SharePhoto : CoreKit.Copying, INSSecureCoding { // -(BOOL)isEqualToSharePhoto:(FBSDKSharePhoto *)photo; [Export ("isEqualToSharePhoto:")] bool IsEqualToSharePhoto (SharePhoto photo); + + // @property (nonatomic, copy) NSString *caption; + [Export ("caption", ArgumentSemantic.Copy)] + string Caption { get; set; } } // @interface FBSDKSharePhotoContent : NSObject - [BaseType (typeof (NSObject), Name = "FBSDKSharePhotoContent")] - interface SharePhotoContent : SharingContent { + [BaseType (typeof(NSObject), Name = "FBSDKSharePhotoContent")] + interface SharePhotoContent : SharingContent + { // @property (copy, nonatomic) NSArray * photos; [NullAllowed] @@ -2065,8 +2199,9 @@ interface SharePhotoContent : SharingContent { // @interface FBSDKShareVideo : NSObject [DisableDefaultCtor] - [BaseType (typeof (NSObject), Name = "FBSDKShareVideo")] - interface ShareVideo : CoreKit.Copying, INSSecureCoding { + [BaseType (typeof(NSObject), Name = "FBSDKShareVideo")] + interface ShareVideo : CoreKit.Copying, INSSecureCoding + { // +(instancetype)videoWithVideoURL:(NSURL *)videoURL; [Static] @@ -2084,8 +2219,9 @@ interface ShareVideo : CoreKit.Copying, INSSecureCoding { } // @interface FBSDKShareVideoContent : NSObject - [BaseType (typeof (NSObject), Name = "FBSDKShareVideoContent")] - interface ShareVideoContent : SharingContent { + [BaseType (typeof(NSObject), Name = "FBSDKShareVideoContent")] + interface ShareVideoContent : SharingContent + { // @property (copy, nonatomic) FBSDKSharePhoto * previewPhoto; [NullAllowed] @@ -2102,13 +2238,17 @@ interface ShareVideoContent : SharingContent { bool IsEqualToShareVideoContent (ShareVideoContent content); } - interface ISharing { } + interface ISharing + { + + } // @protocol FBSDKSharing [Model] [Protocol] - [BaseType (typeof (NSObject), Name = "FBSDKSharing")] - interface Sharing { + [BaseType (typeof(NSObject), Name = "FBSDKSharing")] + interface Sharing + { // @required @property (nonatomic, weak) id delegate; [Export ("delegate")] @@ -2136,13 +2276,17 @@ interface Sharing { bool ValidateWithError (out NSError errorRef); } - interface ISharingDialog { } + interface ISharingDialog + { + + } // @protocol FBSDKSharingDialog [Model] [Protocol] - [BaseType (typeof (NSObject), Name = "FBSDKSharingDialog")] - interface SharingDialog : Sharing { + [BaseType (typeof(NSObject), Name = "FBSDKSharingDialog")] + interface SharingDialog : Sharing + { // @required -(BOOL)canShow; [Abstract] @@ -2155,13 +2299,17 @@ interface SharingDialog : Sharing { bool Show (); } - interface ISharingDelegate { } + interface ISharingDelegate + { + + } // @protocol FBSDKSharingDelegate [Model] [Protocol] - [BaseType (typeof (NSObject), Name = "FBSDKSharingDelegate")] - interface SharingDelegate { + [BaseType (typeof(NSObject), Name = "FBSDKSharingDelegate")] + interface SharingDelegate + { // @required -(void)sharer:(id)sharer didCompleteWithResults:(NSDictionary *)results; [Abstract] @@ -2179,13 +2327,17 @@ interface SharingDelegate { void DidCancel (ISharing sharer); } - interface ISharingButton { } + interface ISharingButton + { + + } // @protocol FBSDKSharingButton [Model] [Protocol] - [BaseType (typeof (NSObject), Name = "FBSDKSharingButton")] - interface SharingButton { + [BaseType (typeof(NSObject), Name = "FBSDKSharingButton")] + interface SharingButton + { // @required @property (copy, nonatomic) id shareContent; [Export ("shareContent")] @@ -2195,13 +2347,17 @@ interface SharingButton { void SetShareContent ([NullAllowed] ISharingContent shareContent); } - interface ISharingContent { } + interface ISharingContent + { + + } // @protocol FBSDKSharingContent [Model] [Protocol] - [BaseType (typeof (NSObject), Name = "FBSDKSharingContent")] - interface SharingContent : CoreKit.Copying, INSSecureCoding { + [BaseType (typeof(NSObject), Name = "FBSDKSharingContent")] + interface SharingContent : CoreKit.Copying, INSSecureCoding + { // @required @property (copy, nonatomic) NSURL * contentURL; [Export ("contentURL")] @@ -2215,7 +2371,7 @@ interface SharingContent : CoreKit.Copying, INSSecureCoding { string [] GetPeopleIds (); [Export ("setPeopleIDs:")] - void SetPeopleIds ([NullAllowed] string [] peolpleId); + void SetPeopleIds ([NullAllowed] string[] peolpleId); // @required @property (copy, nonatomic) NSString * placeID; [Export ("placeID")] diff --git a/facebookios/binding/Makefile b/facebookios/binding/Makefile index a9df568a..10334619 100644 --- a/facebookios/binding/Makefile +++ b/facebookios/binding/Makefile @@ -1,6 +1,6 @@ MONOXBUILD=/Library/Frameworks/Mono.framework/Commands/xbuild -DATE=20150402 -VERSION=4.0.1 +DATE=20150430 +VERSION=4.1.0 all: Facebook-Unified.dll diff --git a/facebookios/binding/Properties/AssemblyInfo.cs b/facebookios/binding/Properties/AssemblyInfo.cs index 668971f5..84621907 100644 --- a/facebookios/binding/Properties/AssemblyInfo.cs +++ b/facebookios/binding/Properties/AssemblyInfo.cs @@ -25,7 +25,7 @@ // The form "{Major}.{Minor}.*" will automatically update the build and revision, // and "{Major}.{Minor}.{Build}.*" will update just the revision. -[assembly: AssemblyVersion ("4.0.1.3")] +[assembly: AssemblyVersion ("4.1.0")] // The following attributes are used to specify the signing key for the assembly, // if desired. See the Mono documentation for more information about signing. diff --git a/facebookios/samples/FacebookiOSSample/FacebookiOSSample/AppDelegate.cs b/facebookios/samples/FacebookiOSSample/FacebookiOSSample/AppDelegate.cs index b47fa1c9..a8779d3b 100644 --- a/facebookios/samples/FacebookiOSSample/FacebookiOSSample/AppDelegate.cs +++ b/facebookios/samples/FacebookiOSSample/FacebookiOSSample/AppDelegate.cs @@ -5,6 +5,7 @@ #if __UNIFIED__ using Foundation; using UIKit; + #else using MonoTouch.Foundation; using MonoTouch.UIKit; @@ -21,8 +22,8 @@ namespace FacebookiOSSample { - // The UIApplicationDelegate for the application. This class is responsible for launching the - // User Interface of the application, as well as listening (and optionally responding) to + // The UIApplicationDelegate for the application. This class is responsible for launching the + // User Interface of the application, as well as listening (and optionally responding) to // application events from iOS. [Register ("AppDelegate")] public partial class AppDelegate : UIApplicationDelegate @@ -38,7 +39,7 @@ public partial class AppDelegate : UIApplicationDelegate private const string DisplayName = "IFaceTouch"; // - // This method is invoked when the application has loaded and is ready to run. In this + // This method is invoked when the application has loaded and is ready to run. In this // method you should instantiate the window, load the UI into it and then make the window // visible. // diff --git a/facebookios/samples/FacebookiOSSample/FacebookiOSSample/DVCActions.cs b/facebookios/samples/FacebookiOSSample/FacebookiOSSample/DVCActions.cs index aadfdfe5..759bf2bf 100644 --- a/facebookios/samples/FacebookiOSSample/FacebookiOSSample/DVCActions.cs +++ b/facebookios/samples/FacebookiOSSample/FacebookiOSSample/DVCActions.cs @@ -9,6 +9,7 @@ using UIKit; using CoreLocation; using CoreGraphics; + #else using MonoTouch.Foundation; using MonoTouch.UIKit; @@ -36,6 +37,7 @@ public partial class DVCActions : DialogViewController, ISharingDelegate, IAppIn string helloId = null; bool isXamarinShared = false; string sharedId = null; + AccessToken currentAccessToken = AccessToken.CurrentAccessToken; // So you can share your Facebook app, you need to create an AppLink: // https://developers.facebook.com/docs/app-invites/ios#app_links @@ -49,7 +51,7 @@ public DVCActions () : base (UITableViewStyle.Grouped, null, true) // Create menu options with Monotouch.Dialog Root = new RootElement ("Menu") { - new Section (){ + new Section () { new UIViewElement ("", pictureView, true) { Flags = UIViewElement.CellFlags.DisableSelection | UIViewElement.CellFlags.Transparent, } @@ -102,12 +104,19 @@ void ShareUrl () void DeleteSharedPost () { if (!isXamarinShared) { - new UIAlertView ("Error", "Please Share \"Xamarin.com\" to your wall first", null, "Ok", null).Show(); + new UIAlertView ("Error", "Please Share \"Xamarin.com\" to your wall first", null, "Ok", null).Show (); + return; + } + + // Verify if you have permissions to delete things from user wall, + // if not, ask to user if he/she wants to let your app to delete things for them + if (!currentAccessToken.HasGranted ("publish_actions")) { + AskPermissions ("Delete Shared Post", "Would you like to let this app to delete your last shared post for you?", new [] { "publish_actions" }, PostHello); return; } // Use GraphRequest to delete the last shared post - var request = new GraphRequest (sharedId, null, AccessToken.CurrentAccessToken.TokenString, null, "DELETE"); + var request = new GraphRequest (sharedId, null, currentAccessToken.TokenString, null, "DELETE"); var requestConnection = new GraphRequestConnection (); // Handle the result of the request @@ -135,55 +144,47 @@ void PostHello () } // Verify if you have permissions to post into user wall, - // if not, ask to user if he/she wants to let your app post thing for them - if (!AccessToken.CurrentAccessToken.Permissions.Contains ("publish_actions")) { - var alertView = new UIAlertView ("Post Hello", "Would you like to let this app to post a \"Hello\" for you?", null, "Maybe later", new [] { "Ok" }); - alertView.Clicked += (sender, e) => { - if (e.ButtonIndex == 1) - return; + // if not, ask to user if he/she wants to let your app post things for them + if (!currentAccessToken.HasGranted ("publish_actions")) { + AskPermissions ("Post Hello", "Would you like to let this app to post a \"Hello\" for you?", new [] { "publish_actions" }, PostHello); + return; + } - // If they let you post thing, ask a new loggin with publish permissions - var login = new LoginManager (); - login.LogInWithPublishPermissions (new [] { "publish_actions" }, (result, error) => { - if (error != null) { - new UIAlertView ("Error...", error.Description, null, "Ok", null).Show (); - return; - } - - PostHello (); - }); - }; - alertView.Show (); - } else { - // Once you have the permissions, you can publish into user wall - var request = new GraphRequest ("me/feed", new NSDictionary ("message", "Hello!"), AccessToken.CurrentAccessToken.TokenString, null, "POST"); - var requestConnection = new GraphRequestConnection (); - - // Handle the result of the request - requestConnection.AddRequest (request, (connection, result, error) => { - if (error != null) { - new UIAlertView ("Error...", error.Description, null, "Ok", null).Show (); - return; - } + // Once you have the permissions, you can publish into user wall + var request = new GraphRequest ("me/feed", new NSDictionary ("message", "Hello!"), AccessToken.CurrentAccessToken.TokenString, null, "POST"); + var requestConnection = new GraphRequestConnection (); - helloId = (result as NSDictionary)["id"].ToString (); - new UIAlertView ("Success!!", "Posted Hello in your wall, MsgId: " + helloId, null, "Ok", null).Show (); - isHelloPosted = true; - }); - requestConnection.Start (); - } + // Handle the result of the request + requestConnection.AddRequest (request, (connection, result, error) => { + if (error != null) { + new UIAlertView ("Error...", error.Description, null, "Ok", null).Show (); + return; + } + + helloId = (result as NSDictionary) ["id"].ToString (); + new UIAlertView ("Success!!", "Posted Hello in your wall, MsgId: " + helloId, null, "Ok", null).Show (); + isHelloPosted = true; + }); + requestConnection.Start (); } // Delete the "Hello!" post from user wall void DeleteHelloPost () { if (!isHelloPosted) { - new UIAlertView ("Error", "Please Post \"Hello\" to your wall first", null, "Ok", null).Show(); + new UIAlertView ("Error", "Please Post \"Hello\" to your wall first", null, "Ok", null).Show (); + return; + } + + // Verify if you have permissions to delete things from user wall, + // if not, ask to user if he/she wants to let your app to delete things for them + if (!currentAccessToken.HasGranted ("publish_actions")) { + AskPermissions ("Delete Hello Post", "Would you like to let this app to delete your \"Hello\" post for you?", new [] { "publish_actions" }, PostHello); return; } // Use GraphRequest to delete the Hello! post - var request = new GraphRequest (helloId, null, AccessToken.CurrentAccessToken.TokenString, null, "DELETE"); + var request = new GraphRequest (helloId, null, currentAccessToken.TokenString, null, "DELETE"); var requestConnection = new GraphRequestConnection (); // Handle the result of the request @@ -208,12 +209,40 @@ void InviteFriends () AppInviteDialog.Show (content, this); } + void AskPermissions (string title, string message, string[] permissions, Action successHandler) + { + var alertView = new UIAlertView (title, message, null, "Maybe later", new [] { "Ok" }); + alertView.Clicked += (sender, e) => { + if (e.ButtonIndex == 0) + return; + + // If they let you post thing, ask a new loggin with publish permissions + var login = new LoginManager (); + + login.LogInWithPublishPermissions (permissions, (result, error) => { + if (error != null) { + new UIAlertView ("Error...", error.Description, null, "Ok", null).Show (); + return; + } + + if (result.IsCancelled) { + new UIAlertView ("The request was cancelled", "If you are using a Test App Id, please, make sure that your account have an Administrator role at:\thttps://developers.facebook.com/apps/appid/roles/", null, "OK", null).Show (); + return; + } + + currentAccessToken = result.Token; + successHandler (); + }); + }; + alertView.Show (); + } + #region ISharingDelegate Implement public void DidComplete (ISharing sharer, NSDictionary results) { - if (results.ContainsKey (new NSString ("postId"))) - { + Console.WriteLine (results); + if (results.ContainsKey (new NSString ("postId"))) { sharedId = results ["postId"].ToString (); new UIAlertView ("Success!!", "Successfully posted to Facebook!", null, "Ok", null).Show (); isXamarinShared = true; @@ -236,8 +265,7 @@ public void DidCancel (ISharing sharer) public void DidComplete (AppInviteDialog appInviteDialog, NSDictionary results) { - Console.WriteLine (results); - if (results["completionGesture"] != null && results["completionGesture"].ToString () != "cancel") + if (results ["completionGesture"] != null && results ["completionGesture"].ToString () != "cancel") new UIAlertView ("Success!!", "Successfully invited to some friends to use your app!", null, "Ok", null).Show (); } diff --git a/facebookios/samples/FacebookiOSSample/FacebookiOSSample/DVCLogIn.cs b/facebookios/samples/FacebookiOSSample/FacebookiOSSample/DVCLogIn.cs index df0962fa..31fcc8fe 100644 --- a/facebookios/samples/FacebookiOSSample/FacebookiOSSample/DVCLogIn.cs +++ b/facebookios/samples/FacebookiOSSample/FacebookiOSSample/DVCLogIn.cs @@ -8,6 +8,7 @@ using UIKit; using CoreLocation; using CoreGraphics; + #else using MonoTouch.Foundation; using MonoTouch.UIKit; @@ -32,10 +33,14 @@ public partial class DVCLogIn : DialogViewController LoginButton loginView; ProfilePictureView pictureView; - // For extensive list of available extended permissions refer to + // For extensive list of available extended permissions refer to // https://developers.facebook.com/docs/reference/api/permissions/ - string [] extendedPermissions = new [] { "user_about_me", "read_stream"}; - string [] publishPermissions = new [] { "publish_stream" }; + string[] extendedPermissions = new [] { + "public_profile", + "email", + "user_friends" + }; + string[] publishPermissions = new [] { "" }; public DVCLogIn () : base (UITableViewStyle.Grouped, null, true) { @@ -55,12 +60,16 @@ public DVCLogIn () : base (UITableViewStyle.Grouped, null, true) } }); + AccessToken.Notifications.ObserveDidChange ((sender, e) => { + Console.WriteLine (e.NewToken.Permissions); + }); + // If you use Native login behavior, you will get all read and publish permisions // otherwise, set the Read and Publish permissions you want to get loginView = new LoginButton (new CGRect (51, 0, 218, 46)) { LoginBehavior = LoginBehavior.Native, - // ReadPermissions = extendedPermissions, - // PublishPermissions = publishPermissions + ReadPermissions = extendedPermissions, +// PublishPermissions = publishPermissions }; // Handle actions once the user is logged in diff --git a/facebookios/samples/FacebookiOSSample/FacebookiOSSample/Info.plist b/facebookios/samples/FacebookiOSSample/FacebookiOSSample/Info.plist index 15eab995..377b0ca1 100644 --- a/facebookios/samples/FacebookiOSSample/FacebookiOSSample/Info.plist +++ b/facebookios/samples/FacebookiOSSample/FacebookiOSSample/Info.plist @@ -13,7 +13,7 @@ CFBundleURLSchemes - fb454287177934330 + fb765057006871425