Esempio n. 1
0
        /// <summary>
        /// Logs the user out of the given provider.
        /// Supported platforms: Facebook, Twitter, Google+
        ///
        /// NOTE: This operation requires a successful login.
        /// </summary>
        /// <param name="provider">The provider to log out from.</param>
        public static void Logout(Provider provider)
        {
            SocialProvider targetProvider = GetSocialProvider(provider);

            if (targetProvider == null)
            {
                return;
            }

            if (targetProvider.IsNativelyImplemented())
            {
                //fallback to native
                instance._logout(provider);
            }

            else
            {
                ProfileEvents.OnLogoutStarted(provider);
                targetProvider.Logout(
                    /* success */ () => {
                    UserProfile userProfile = GetStoredUserProfile(provider);
                    if (userProfile != null)
                    {
                        RemoveUserProfile(userProfile);
                    }
                    ProfileEvents.OnLogoutFinished(provider);
                },
                    /* fail */ (string message) => { ProfileEvents.OnLogoutFailed(provider, message); }
                    );
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Handles an <c>onLogoutFinished</c> event
        /// </summary>
        /// <param name="message">
        /// Will contain a numeric representation of <c>Provider</c></param>
        public void onLogoutFinished(String message)
        {
            SoomlaUtils.LogDebug(TAG, "SOOMLA/UNITY onLogoutFinished");

            JSONObject eventJson = new JSONObject(message);

            Provider provider = Provider.fromInt((int)(eventJson["provider"].n));

            ProfileEvents.OnLogoutFinished(provider);
        }