/// <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); } ); } }
/// <summary> /// Handles an <c>onLogoutStarted</c> event /// </summary> /// <param name="message"> /// Will contain a numeric representation of <c>Provider</c></param> public void onLogoutStarted(String message) { SoomlaUtils.LogDebug(TAG, "SOOMLA/UNITY onLogoutStarted"); JSONObject eventJson = new JSONObject(message); Provider provider = Provider.fromInt((int)(eventJson["provider"].n)); ProfileEvents.OnLogoutStarted(provider); }