public virtual void RequestAuth(AuthSuccessCallback success_callback, AuthFailCallback fail_callback, bool reset_auth = false) { // Override this method. //mAuthSuccessCallback = success_callback; //mAuthFailCallback = fail_callback; InvokeAuthFailCallback(ERROR_NOT_INITIALIZED); }
protected virtual void InvokeAuthFailCallback(string error_code) { if (mAuthFailCallback != null) { mAuthFailCallback.Invoke(error_code); } mAuthSuccessCallback = null; mAuthFailCallback = null; }
protected virtual void InvokeAuthSuccessCallback(int user_id, string login_token) { if (mAuthSuccessCallback != null) { mAuthSuccessCallback.Invoke(user_id, login_token); } mAuthSuccessCallback = null; mAuthFailCallback = null; }
public override void RequestAuth(AuthSuccessCallback success_callback, AuthFailCallback fail_callback, bool reset_auth = false) { mAuthSuccessCallback = success_callback; mAuthFailCallback = fail_callback; if (FB.IsLoggedIn && AccessToken.CurrentAccessToken != null) { RequestLogin(ProviderId, AccessToken.CurrentAccessToken.UserId, AccessToken.CurrentAccessToken.TokenString, reset_auth); return; } FacebookProvider.InstanceInitializationComplete -= OnFacebookProviderInitializationComplete; FacebookProvider.InstanceInitializationComplete += OnFacebookProviderInitializationComplete; InvokeAuthFailCallback(AuthProvider.ERROR_NOT_INITIALIZED); }
public override void RequestAuth(AuthSuccessCallback success_callback, AuthFailCallback fail_callback, bool reset_auth = false) { mAuthSuccessCallback = success_callback; mAuthFailCallback = fail_callback; string auth_login = PlayerPrefs.GetString(SnipePrefs.AUTH_UID); string auth_token = PlayerPrefs.GetString(SnipePrefs.AUTH_KEY); if (!string.IsNullOrEmpty(auth_login) && !string.IsNullOrEmpty(auth_token)) { RequestLogin(ProviderId, auth_login, auth_token, reset_auth); } else { InvokeAuthFailCallback(ERROR_NOT_INITIALIZED); } }
public override void RequestAuth(AuthSuccessCallback success_callback, AuthFailCallback fail_callback, bool reset_auth = false) { mAuthSuccessCallback = success_callback; mAuthFailCallback = fail_callback; #if UNITY_IOS if (AppleGameCenterProvider.InstanceInitialized) { string gc_login = AppleGameCenterProvider.Instance.PlayerProfile.Id; if (!string.IsNullOrEmpty(gc_login)) { mLoginSignatureCallback = (data) => { Debug.Log("[AppleGameCenterAuthProvider] RequestAuth - LoginSignatureCallback"); data["messageType"] = REQUEST_USER_LOGIN; data["login"] = gc_login; if (reset_auth) { data["resetInternalAuth"] = reset_auth; } SingleRequestClient.Request(SnipeConfig.Instance.auth, data, OnAuthLoginResponse); }; generateIdentityVerificationSignature(VerificationSignatureGeneratorCallback); return; } } else { AppleGameCenterProvider.InstanceInitializationComplete -= OnAppleGameCenterProviderInitializationComplete; AppleGameCenterProvider.InstanceInitializationComplete += OnAppleGameCenterProviderInitializationComplete; } #endif InvokeAuthFailCallback(AuthProvider.ERROR_NOT_INITIALIZED); }
public override void RequestAuth(AuthSuccessCallback success_callback, AuthFailCallback fail_callback, bool reset_auth = false) { mAuthSuccessCallback = success_callback; mAuthFailCallback = fail_callback; #if UNITY_ANDROID if (GooglePlayProvider.InstanceInitialized) { string google_login = GooglePlayProvider.Instance.PlayerProfile.Id; if (!string.IsNullOrEmpty(google_login)) { GooglePlayProvider.Instance.GetServerAuthToken((google_token) => { Debug.Log("[GooglePlayAuthProvider] google_token : " + (string.IsNullOrEmpty(google_token) ? "empty" : "ok")); if (string.IsNullOrEmpty(google_token)) { InvokeAuthFailCallback(AuthProvider.ERROR_NOT_INITIALIZED); } else { RequestLogin(ProviderId, google_login, google_token, reset_auth); } }); return; } } else { GooglePlayProvider.InstanceInitializationComplete -= OnGooglePlayProviderInitializationComplete; GooglePlayProvider.InstanceInitializationComplete += OnGooglePlayProviderInitializationComplete; } #endif InvokeAuthFailCallback(AuthProvider.ERROR_NOT_INITIALIZED); }
public override void RequestAuth(AuthSuccessCallback success_callback, AuthFailCallback fail_callback, bool reset_auth = false) { mAuthSuccessCallback = success_callback; mAuthFailCallback = fail_callback; void advertising_id_callback(string advertising_id, bool tracking_enabled, string error) { Debug.Log($"[AdvertisingIdAuthProvider] advertising_id : {advertising_id} , error : {error}"); AdvertisingId = advertising_id; if (CheckAdvertisingId(advertising_id)) { RequestLogin(ProviderId, advertising_id, "", reset_auth); } else { Debug.Log("[AdvertisingIdAuthProvider] advertising_id is invalid"); InvokeAuthFailCallback(AuthProvider.ERROR_NOT_INITIALIZED); } } if (!Application.RequestAdvertisingIdentifierAsync(advertising_id_callback)) { if (DeviceIdFallbackEnabled && SystemInfo.unsupportedIdentifier != SystemInfo.deviceUniqueIdentifier) { advertising_id_callback(SystemInfo.deviceUniqueIdentifier, false, ""); } else { Debug.Log("[AdvertisingIdAuthProvider] advertising id is not supported on this platform"); InvokeAuthFailCallback(AuthProvider.ERROR_NOT_INITIALIZED); } } }
public virtual void Dispose() { mAuthSuccessCallback = null; mAuthFailCallback = null; }