Пример #1
0
 /// <summary>
 /// See docs in <see cref="SoomlaProfile.UpdateStatus"/>
 /// </summary>
 /// <param name="status">Status to post.</param>
 /// <param name="success">Callback function that is called if the status update was successful.</param>
 /// <param name="fail">Callback function that is called if the status update failed.</param>
 public void UpdateStatus(string status, SocialActionSuccess success, SocialActionFailed fail)
 {
     checkPublishPermission(() => {
         var formData = new Dictionary <string, string>
         {
             { "message", status }
         };
         FB.API("/me/feed", HttpMethod.POST,
                (IGraphResult postFeedResult) => {
             if (postFeedResult.Error != null)
             {
                 SoomlaUtils.LogDebug(TAG, "UpdateStatusCallback[result.Error]:" + postFeedResult.Error);
                 fail(postFeedResult.Error);
             }
             else
             {
                 SoomlaUtils.LogDebug(TAG, "UpdateStatusCallback[result.Text]:" + postFeedResult.RawResult);
                 SoomlaUtils.LogDebug(TAG, "UpdateStatusCallback[result.Texture]:" + postFeedResult.Texture);
                 success();
             }
         }, formData);
     }, (string errorMessage) => {
         fail(errorMessage);
     });
 }
Пример #2
0
 /// <summary>
 /// See docs in <see cref="SoomlaProfile.UpdateStoryDialog"/>
 /// </summary>
 /// <param name="name">The name (title) of the story.</param>
 /// <param name="caption">A caption.</param>
 /// <param name="link">A link to a web page.</param>
 /// <param name="pictureUrl">A link to an image on the web.</param>
 /// <param name="success">Callback function that is called if the story update was successful.</param>
 /// <param name="fail">Callback function that is called if the story update failed.</param>
 /// <param name="cancel">Callback function that is called if the story update was cancelled.</param>
 public override void UpdateStoryDialog(string name, string caption, string description, string link, string picture,
                                        SocialActionSuccess success, SocialActionFailed fail, SocialActionCancel cancel)
 {
     FB.Feed(
         link: link,
         linkName: name,
         linkCaption: caption,
         linkDescription: description,
         picture: picture,
         callback: (FBResult result) => {
         if (result.Error != null)
         {
             fail(result.Error);
         }
         else
         {
             SoomlaUtils.LogDebug(TAG, "FeedCallback[result.Text]:" + result.Text);
             SoomlaUtils.LogDebug(TAG, "FeedCallback[result.Texture]:" + result.Texture);
             var responseObject = Json.Deserialize(result.Text) as Dictionary <string, object>;
             object obj         = 0;
             if (responseObject.TryGetValue("cancelled", out obj))
             {
                 cancel();
             }
             else
             {
                 success();
             }
         }
     });
 }
Пример #3
0
 /// <summary>
 /// See docs in <see cref="SoomlaProfile.UpdateStatus"/>
 /// </summary>
 /// <param name="link">Link to post.</param>
 /// <param name="success">Callback function that is called if the status update was successful.</param>
 /// <param name="fail">Callback function that is called if the status update failed.</param>
 public void UpdateStatusDialog(string link, SocialActionSuccess success, SocialActionFailed fail)
 {
     FB.FeedShare(
         link: new Uri(link),
         callback: (IShareResult result) => {
         if (result.Error != null)
         {
             fail(result.Error);
         }
         else
         {
             SoomlaUtils.LogDebug(TAG, "FeedCallback[result.Text]:" + result.RawResult);
             var responseObject = Json.Deserialize(result.RawResult) as Dictionary <string, object>;
             object obj         = 0;
             success();
         }
     });
 }
		/// <summary>
		/// See docs in <see cref="SoomlaProfile.UpdateStoryDialog"/>
		/// </summary>
		/// <param name="name">The name (title) of the story.</param>
		/// <param name="caption">A caption.</param>
		/// <param name="link">A link to a web page.</param>
		/// <param name="pictureUrl">A link to an image on the web.</param>
		/// <param name="success">Callback function that is called if the story update was successful.</param>
		/// <param name="fail">Callback function that is called if the story update failed.</param>
		/// <param name="cancel">Callback function that is called if the story update was cancelled.</param>
		public override void UpdateStoryDialog(string name, string caption, string description, string link, string picture, 
		                                       SocialActionSuccess success, SocialActionFailed fail, SocialActionCancel cancel) {
			FB.FeedShare(
				link: new Uri(link),
				linkName: name,
				linkCaption: caption,
				linkDescription: description,
				picture: new Uri(picture),
				callback: (IShareResult result) => {
				
					if (result.Error != null) {
						fail(result.Error);
					}
					else {
						SoomlaUtils.LogDebug(TAG, "FeedCallback[result.Text]:"+result.RawResult);
					var responseObject = Json.Deserialize(result.RawResult) as Dictionary<string, object>;
						object obj = 0;
						if (responseObject.TryGetValue("cancelled", out obj)) {
							cancel();
						}
						else {
							success();
						}
					}
				});
			}
		/// <summary>
		/// See docs in <see cref="SoomlaProfile.UpdateStatus"/>
		/// </summary>
		/// <param name="link">Link to post.</param>
		/// <param name="success">Callback function that is called if the status update was successful.</param>
		/// <param name="fail">Callback function that is called if the status update failed.</param>
		public override void UpdateStatusDialog(string link, SocialActionSuccess success, SocialActionFailed fail) {
			FB.FeedShare(
				link: new Uri(link),
				callback: (IShareResult result) => {
				
				if (result.Error != null) {
					fail(result.Error);
				}
				else {
					SoomlaUtils.LogDebug(TAG, "FeedCallback[result.Text]:"+result.RawResult);
					var responseObject = Json.Deserialize(result.RawResult) as Dictionary<string, object>;
					object obj = 0;
					success();						
				}				
			});
		}
Пример #6
0
 /// <summary>
 /// See docs in <see cref="SoomlaProfile.UploadImage"/>
 /// </summary>
 public override void UploadImage(byte[] texBytes, string fileName, string message, SocialActionSuccess success, SocialActionFailed fail, SocialActionCancel cancel)
 {
 }
Пример #7
0
 /// <summary>
 /// See docs in <see cref="SoomlaProfile.UpdateStatusDialog"/>
 /// </summary>
 public override void UpdateStatusDialog(string link, SocialActionSuccess success, SocialActionFailed fail)
 {
 }
Пример #8
0
 /// <summary>
 /// See docs in <see cref="SoomlaProfile.UpdateStory"/>
 /// </summary>
 public override void UpdateStory(string message, string name, string caption,
                                  string link, string pictureUrl, SocialActionSuccess success, SocialActionFailed fail, SocialActionCancel cancel)
 {
 }
Пример #9
0
        /// <summary>
        /// See docs in <see cref="SoomlaProfile.UpdateStatus"/>
        /// </summary>
        /// <param name="status">Status to post.</param>
        /// <param name="success">Callback function that is called if the status update was successful.</param>
        /// <param name="fail">Callback function that is called if the status update failed.</param>
        public override void UpdateStatus(string status, SocialActionSuccess success, SocialActionFailed fail)
        {
            var formData = new Dictionary<string, string>
            {
                { "message", status }
            };
            FB.API ("/me/feed", Facebook.HttpMethod.POST,
                    (FBResult result) => {

                        if (result.Error != null) {
                            SoomlaUtils.LogDebug(TAG, "UpdateStatusCallback[result.Error]:"+result.Error);
                            fail(result.Error);
                        }
                        else {
                            SoomlaUtils.LogDebug(TAG, "UpdateStatusCallback[result.Text]:"+result.Text);
                            SoomlaUtils.LogDebug(TAG, "UpdateStatusCallback[result.Texture]:"+result.Texture);
                            success();
                        }

                    }
                    , formData);
        }
		/// <summary>
		/// See docs in <see cref="SoomlaProfile.UpdateStatusDialog"/>
		/// </summary>
		public override void UpdateStatusDialog(string link, SocialActionSuccess success, SocialActionFailed fail) {}
Пример #11
0
 /// <summary>
 /// See docs in <see cref="SoomlaProfile.UpdateStory"/>
 /// </summary>
 /// <param name="message">A message that will be shown along with the story.</param>
 /// <param name="name">The name (title) of the story.</param>
 /// <param name="caption">A caption.</param>
 /// <param name="link">A link to a web page.</param>
 /// <param name="pictureUrl">A link to an image on the web.</param>
 /// <param name="success">Callback function that is called if the story update was successful.</param>
 /// <param name="fail">Callback function that is called if the story update failed.</param>
 /// <param name="cancel">Callback function that is called if the story update was cancelled.</param>
 public override void UpdateStory(string message, string name, string caption, string description,
                                  string link, string pictureUrl, SocialActionSuccess success, SocialActionFailed fail, SocialActionCancel cancel)
 {
     checkPermission("publish_actions", () => {
         var formData = new Dictionary <string, string>
         {
             { "message", message },
             { "name", name },
             { "caption", caption },
             { "description", description },
             { "link", link },
             { "picture", pictureUrl }
         };
         FB.API("/me/feed", Facebook.HttpMethod.POST,
                (FBResult postFeedResult) => {
             if (postFeedResult.Error != null)
             {
                 SoomlaUtils.LogDebug(TAG, "UpdateStatusCallback[result.Error]:" + postFeedResult.Error);
                 fail(postFeedResult.Error);
             }
             else
             {
                 SoomlaUtils.LogDebug(TAG, "UpdateStatusCallback[result.Text]:" + postFeedResult.Text);
                 SoomlaUtils.LogDebug(TAG, "UpdateStatusCallback[result.Texture]:" + postFeedResult.Texture);
                 success();
             }
         }, formData);
     }, (string errorMessage) => {
         fail(errorMessage);
     });
 }
Пример #12
0
 /// <summary>
 /// See docs in <see cref="SoomlaProfile.UpdateStory"/>
 /// </summary>
 public abstract void UpdateStory(string message, string name, string caption, string description,
                                  string link, string pictureUrl, SocialActionSuccess success, SocialActionFailed fail, SocialActionCancel cancel);
Пример #13
0
 /// <summary>
 /// See docs in <see cref="SoomlaProfile.UpdateStatusDialog"/>
 /// </summary>
 public abstract void UpdateStatusDialog(string link, SocialActionSuccess success, SocialActionFailed fail);
Пример #14
0
		/// <summary>
		/// See docs in <see cref="SoomlaProfile.UpdateStatusDialog"/>
		/// </summary>
		public abstract void UpdateStatusDialog(string link, SocialActionSuccess success, SocialActionFailed fail);
Пример #15
0
        /// <summary>
        /// See docs in <see cref="SoomlaProfile.UpdateStory"/>
        /// </summary>
        /// <param name="message">A message that will be shown along with the story.</param>
        /// <param name="name">The name (title) of the story.</param>
        /// <param name="caption">A caption.</param>
        /// <param name="link">A link to a web page.</param>
        /// <param name="pictureUrl">A link to an image on the web.</param>
        /// <param name="success">Callback function that is called if the story update was successful.</param>
        /// <param name="fail">Callback function that is called if the story update failed.</param>
        /// <param name="cancel">Callback function that is called if the story update was cancelled.</param>
        public override void UpdateStory(string message, string name, string caption,
                                         string link, string pictureUrl, SocialActionSuccess success, SocialActionFailed fail, SocialActionCancel cancel)
        {
//			checkPermission("publish_actions", ()=> {
            FB.Feed(
                link: link,
                linkName: name,
                linkCaption: caption,
                linkDescription: message,
                picture: pictureUrl,
                callback: (FBResult result) => {
                if (result.Error != null)
                {
                    fail(result.Error);
                }
                else
                {
                    SoomlaUtils.LogDebug(TAG, "FeedCallback[result.Text]:" + result.Text);
                    SoomlaUtils.LogDebug(TAG, "FeedCallback[result.Texture]:" + result.Texture);
                    var responseObject = Json.Deserialize(result.Text) as Dictionary <string, object>;
                    object obj         = 0;
                    if (responseObject.TryGetValue("cancelled", out obj))
                    {
                        cancel();
                    }
                    else     /*if (responseObject.TryGetValue ("id", out obj))*/
                    {
                        success();
                    }
                }
            });
//			}, (string errorMessage)=>{
//				fail(message);
//            });
        }
Пример #16
0
        /// <summary>
        /// See docs in <see cref="SoomlaProfile.UploadImage"/>
        /// </summary>
        /// <param name="tex2D">Texture2D for image.</param>
        /// <param name="fileName">Name of image file.</param>
        /// <param name="message">Message to post with the image.</param>
        /// <param name="success">Callback function that is called if the image upload was successful.</param>
        /// <param name="fail">Callback function that is called if the image upload failed.</param>
        /// <param name="cancel">Callback function that is called if the image upload was cancelled.</param>
        public override void UploadImage(byte[] texBytes, string fileName, string message, SocialActionSuccess success, SocialActionFailed fail, SocialActionCancel cancel)
        {
            checkPermission("publish_actions", () => {
                var wwwForm = new WWWForm();
                wwwForm.AddBinaryData("image", texBytes, fileName);
                wwwForm.AddField("message", message);

                FB.API("/me/photos", Facebook.HttpMethod.POST,
                       (FBResult result) => {
                    if (result.Error != null)
                    {
                        SoomlaUtils.LogDebug(TAG, "UploadImageCallback[result.Error]: " + result.Error);
                        fail(result.Error);
                    }
                    else
                    {
                        SoomlaUtils.LogDebug(TAG, "UploadImageCallback[result.Text]: " + result.Text);
                        SoomlaUtils.LogDebug(TAG, "UploadImageCallback[result.Texture]: " + result.Texture);
                        var responseObject = Json.Deserialize(result.Text) as Dictionary <string, object>;
                        object obj         = 0;
                        if (responseObject.TryGetValue("cancelled", out obj))
                        {
                            cancel();
                        }
                        else /*if (responseObject.TryGetValue ("id", out obj))*/
                        {
                            success();
                        }
                    }
                }, wwwForm);
            }, (string errorMessage) => {
                fail(message);
            });
        }
		/// <summary>
		/// See docs in <see cref="SoomlaProfile.UpdateStoryDialog"/>
		/// </summary>
		public override void UpdateStoryDialog(string name, string caption, string description, string link, string picture, 
		                                       SocialActionSuccess success, SocialActionFailed fail, SocialActionCancel cancel) {}
Пример #18
0
        /// <summary>
        /// See docs in <see cref="SoomlaProfile.UpdateStory"/>
        /// </summary>
        /// <param name="message">A message that will be shown along with the story.</param>
        /// <param name="name">The name (title) of the story.</param>
        /// <param name="caption">A caption.</param>
        /// <param name="link">A link to a web page.</param>
        /// <param name="pictureUrl">A link to an image on the web.</param>
        /// <param name="success">Callback function that is called if the story update was successful.</param>
        /// <param name="fail">Callback function that is called if the story update failed.</param>
        /// <param name="cancel">Callback function that is called if the story update was cancelled.</param>
        public override void UpdateStory(string message, string name, string caption,
		                                 string link, string pictureUrl, SocialActionSuccess success, SocialActionFailed fail, SocialActionCancel cancel)
        {
            FB.Feed(
                link: link,
                linkName: name,
                linkCaption: caption,
                linkDescription: message,
                picture: pictureUrl,
                callback: (FBResult result) => {

                        if (result.Error != null) {
                            fail(result.Error);
                        }
                        else {
                            SoomlaUtils.LogDebug(TAG, "FeedCallback[result.Text]:"+result.Text);
                            SoomlaUtils.LogDebug(TAG, "FeedCallback[result.Texture]:"+result.Texture);
                            var responseObject = Json.Deserialize(result.Text) as Dictionary<string, object>;
                            object obj = 0;
                            if (responseObject.TryGetValue("cancelled", out obj)) {
                                cancel();
                            }
                            else /*if (responseObject.TryGetValue ("id", out obj))*/ {
                                success();
                            }
                        }

                    }

                );
        }
Пример #19
0
        //		public delegate void FeedFailed(string message);
        //		public delegate void FeedSuccess(List<String> feeds);

        /// <summary>
        /// See docs in <see cref="SoomlaProfile.UpdateStatus"/>
        /// </summary>
        public abstract void UpdateStatus(string status, SocialActionSuccess success, SocialActionFailed fail);
Пример #20
0
 /// <summary>
 /// See docs in <see cref="SoomlaProfile.UpdateStatus"/>
 /// </summary>
 public override void UpdateStatus(string status, SocialActionSuccess success, SocialActionFailed fail)
 {
 }
		/// <summary>
		/// See docs in <see cref="SoomlaProfile.UpdateStatus"/>
		/// </summary>
		public override void UpdateStatus(string status, SocialActionSuccess success, SocialActionFailed fail) {}
Пример #22
0
 /// <summary>
 /// See docs in <see cref="SoomlaProfile.UpdateStoryDialog"/>
 /// </summary>
 public override void UpdateStoryDialog(string name, string caption, string description, string link, string picture,
                                        SocialActionSuccess success, SocialActionFailed fail, SocialActionCancel cancel)
 {
 }
Пример #23
0
        /// <summary>
        /// See docs in <see cref="SoomlaProfile.UpdateStatus"/>
        /// </summary>
        /// <param name="status">Status to post.</param>
        /// <param name="success">Callback function that is called if the status update was successful.</param>
        /// <param name="fail">Callback function that is called if the status update failed.</param>
        public override void UpdateStatus(string status, SocialActionSuccess success, SocialActionFailed fail)
        {
            checkPermission("publish_action");
            var formData = new Dictionary <string, string>
            {
                { "message", status }
            };

            FB.API("/me/feed", Facebook.HttpMethod.POST,
                   (FBResult result) => {
                if (result.Error != null)
                {
                    SoomlaUtils.LogDebug(TAG, "UpdateStatusCallback[result.Error]:" + result.Error);
                    fail(result.Error);
                }
                else
                {
                    SoomlaUtils.LogDebug(TAG, "UpdateStatusCallback[result.Text]:" + result.Text);
                    SoomlaUtils.LogDebug(TAG, "UpdateStatusCallback[result.Texture]:" + result.Texture);
                    success();
                }
            }
                   , formData);
        }
		/// <summary>
		/// See docs in <see cref="SoomlaProfile.UpdateStatus"/>
		/// </summary>
		/// <param name="status">Status to post.</param>
		/// <param name="success">Callback function that is called if the status update was successful.</param>
		/// <param name="fail">Callback function that is called if the status update failed.</param>
		public override void UpdateStatus(string status, SocialActionSuccess success, SocialActionFailed fail) {
			checkPublishPermission( ()=> {
				var formData = new Dictionary<string, string>
				{
					{ "message", status }
				};
				FB.API ("/me/feed", HttpMethod.POST, 
				        (IGraphResult postFeedResult) => {
					
					if (postFeedResult.Error != null) {
						SoomlaUtils.LogDebug(TAG, "UpdateStatusCallback[result.Error]:"+postFeedResult.Error);
						fail(postFeedResult.Error);
					} else {
						SoomlaUtils.LogDebug(TAG, "UpdateStatusCallback[result.Text]:"+postFeedResult.RawResult);
                        SoomlaUtils.LogDebug(TAG, "UpdateStatusCallback[result.Texture]:"+postFeedResult.Texture);
                        success();
                    }
                }, formData);
			}, (string errorMessage)=>{
				fail(errorMessage);
            });
        }
Пример #25
0
 //        public delegate void FeedFailed(string message);
 //        public delegate void FeedSuccess(List<String> feeds);
 /// <summary>
 /// See docs in <see cref="SoomlaProfile.UpdateStatus"/>
 /// </summary>
 public abstract void UpdateStatus(string status, SocialActionSuccess success, SocialActionFailed fail);
		/// <summary>
		/// See docs in <see cref="SoomlaProfile.UpdateStory"/>
		/// </summary>
		/// <param name="message">A message that will be shown along with the story.</param>
		/// <param name="name">The name (title) of the story.</param>
		/// <param name="caption">A caption.</param>
		/// <param name="link">A link to a web page.</param>
		/// <param name="pictureUrl">A link to an image on the web.</param>
		/// <param name="success">Callback function that is called if the story update was successful.</param>
		/// <param name="fail">Callback function that is called if the story update failed.</param>
		/// <param name="cancel">Callback function that is called if the story update was cancelled.</param>
		public override void UpdateStory(string message, string name, string caption, string description,
		                                 string link, string pictureUrl, SocialActionSuccess success, SocialActionFailed fail, SocialActionCancel cancel) {
			checkPublishPermission( ()=> {
				var formData = new Dictionary<string, string>
				{
					{ "message", message },
					{ "name", name },
					{ "caption", caption },
					{ "description", description },
					{ "link", link },
					{ "picture", pictureUrl }
				};
				FB.API ("/me/feed", HttpMethod.POST, 
				        (IGraphResult postFeedResult) => {
					
					if (postFeedResult.Error != null) {
						SoomlaUtils.LogDebug(TAG, "UpdateStatusCallback[result.Error]:"+postFeedResult.Error);
						fail(postFeedResult.Error);
					} else {
						SoomlaUtils.LogDebug(TAG, "UpdateStatusCallback[result.Text]:"+postFeedResult.RawResult);
						SoomlaUtils.LogDebug(TAG, "UpdateStatusCallback[result.Texture]:"+postFeedResult.Texture);
						success();
					}
				}, formData);
			}, (string errorMessage)=>{
				fail(errorMessage);
			});
		}
Пример #27
0
        /// <summary>
        /// See docs in <see cref="SoomlaProfile.UpdateStory"/>
        /// </summary>
        public abstract void UpdateStory(string message, string name, string caption, 
		                                 string link, string pictureUrl, SocialActionSuccess success, SocialActionFailed fail, SocialActionCancel cancel);
			/// <summary>
			/// See docs in <see cref="SoomlaProfile.UploadImage"/>
			/// </summary>
			/// <param name="tex2D">Texture2D for image.</param>
			/// <param name="fileName">Name of image file.</param>
		/// <param name="message">Message to post with the image.</param>
		/// <param name="success">Callback function that is called if the image upload was successful.</param>
		/// <param name="fail">Callback function that is called if the image upload failed.</param>
		/// <param name="cancel">Callback function that is called if the image upload was cancelled.</param>
		public override void UploadImage(byte[] texBytes, string fileName, string message, SocialActionSuccess success, SocialActionFailed fail, SocialActionCancel cancel) {
			
			checkPublishPermission( ()=> {
				var wwwForm = new WWWForm();
				wwwForm.AddBinaryData("image", texBytes, fileName);
				wwwForm.AddField("message", message);
				
				FB.API("/me/photos", HttpMethod.POST, 
				       (IGraphResult result) => {
					
					if (result.Error != null) {
						SoomlaUtils.LogDebug(TAG, "UploadImageCallback[result.Error]: "+result.Error);
						fail(result.Error);
					}
					else {
						SoomlaUtils.LogDebug(TAG, "UploadImageCallback[result.Text]: "+result.RawResult);
						SoomlaUtils.LogDebug(TAG, "UploadImageCallback[result.Texture]: "+result.Texture);
						var responseObject = Json.Deserialize(result.RawResult) as Dictionary<string, object>;
						object obj = 0;
                        if (responseObject.TryGetValue("cancelled", out obj)) {
                            cancel();
                        }
                        else /*if (responseObject.TryGetValue ("id", out obj))*/ {
                            success();
                        }
                    }
                    
                }, wwwForm);
			}, (string errorMessage)=>{
				fail(message);
            });
        }
Пример #29
0
 /// <summary>
 /// See docs in <see cref="SoomlaProfile.UploadImage"/>
 /// </summary>
 public abstract void UploadImage(byte[] texBytes, string fileName, string message, SocialActionSuccess success, SocialActionFailed fail, SocialActionCancel cancel);