/// <summary>
        /// Posts a full story to the user's social page on the given Provider with confirmation dialog.
        /// A story contains a title, description, image and more.
        /// Supported platforms: Facebook (full support),
        /// Twitter and Google+ (partial support - message and link only)
        ///
        /// NOTE: This operation requires a successful login.
        /// </summary>
        /// <param name="provider">The <c>Provider</c> the given story should be posted to.</param>
        /// <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="description">A description.</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="payload">A string to receive when the function returns.</param>
        /// <param name="reward">A <c>Reward</c> to give the user after a successful post.</param>
        /// <param name="customMessage">The message to show in the dialog</param>
        public static void UpdateStoryWithConfirmation(Provider provider, string message, string name,
                                                       string caption, string description, string link, string pictureUrl,
                                                       string payload       = "", Reward reward = null,
                                                       string customMessage = null)
        {
            SocialProvider targetProvider = GetSocialProvider(provider);
            string         userPayload    = (payload == null) ? "" : payload;

            if (targetProvider == null)
            {
                return;
            }


            // TODO: Support showConfirmation
            ProfileEvents.OnSocialActionStarted(provider, SocialActionType.UPDATE_STORY, userPayload);
            targetProvider.UpdateStory(message, name, caption, link, pictureUrl,
                                       /* success */ () => {
                if (reward != null)
                {
                    reward.Give();
                }
                ProfileEvents.OnSocialActionFinished(provider, SocialActionType.UPDATE_STORY, userPayload);
            },
                                       /* fail */ (string error) => { ProfileEvents.OnSocialActionFailed(provider, SocialActionType.UPDATE_STORY, error, userPayload); },
                                       /* cancel */ () => { ProfileEvents.OnSocialActionCancelled(provider, SocialActionType.UPDATE_STORY, userPayload); }
                                       );
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Posts a full story to the user's social page on the given Provider with confirmation dialog.
        /// A story contains a title, description, image and more.
        /// Supported platforms: Facebook (full support),
        /// Twitter and Google+ (partial support - message and link only)
        ///
        /// NOTE: This operation requires a successful login.
        /// </summary>
        /// <param name="provider">The <c>Provider</c> the given story should be posted to.</param>
        /// <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="description">A description.</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="payload">A string to receive when the function returns.</param>
        /// <param name="reward">A <c>Reward</c> to give the user after a successful post.</param>
        /// <param name="customMessage">The message to show in the dialog</param>
        public static void UpdateStoryWithConfirmation(Provider provider, string message, string name,
                                                       string caption, string description, string link, string pictureUrl,
                                                       string payload       = "", Reward reward = null,
                                                       string customMessage = null)
        {
            SocialProvider targetProvider = GetSocialProvider(provider);
            string         userPayload    = (payload == null) ? "" : payload;

            if (targetProvider == null)
            {
                return;
            }

            if (targetProvider.IsNativelyImplemented())
            {
                //fallback to native
                string rewardId = reward != null ? reward.ID: "";
                instance._updateStory(provider, message, name, caption, description, link, pictureUrl,
                                      ProfilePayload.ToJSONObj(userPayload, rewardId).ToString(), true, customMessage);
            }

            else
            {
                // TODO: Support showConfirmation
                ProfileEvents.OnSocialActionStarted(provider, SocialActionType.UPDATE_STORY, userPayload);
                targetProvider.UpdateStory(message, name, caption, link, pictureUrl,
                                           /* success */ () => {
                    if (reward != null)
                    {
                        reward.Give();
                    }
                    ProfileEvents.OnSocialActionFinished(provider, SocialActionType.UPDATE_STORY, userPayload);
                },
                                           /* fail */ (string error) => { ProfileEvents.OnSocialActionFailed(provider, SocialActionType.UPDATE_STORY, error, userPayload); },
                                           /* cancel */ () => { ProfileEvents.OnSocialActionCancelled(provider, SocialActionType.UPDATE_STORY, userPayload); }
                                           );
            }
        }