virtual protected void InvokeCredentialInfoMethod(string providerName, int handle, string methodName, string forcingMappingKey = null) { bool hasAdapter = AuthAdapterManager.Instance.CreateIDPAdapter(providerName); if (hasAdapter == true) { AuthAdapterManager.Instance.GetIDPCredentialInfo(providerName, (credentialInfo, adapterError) => { if (Gamebase.IsSuccess(adapterError) == true) { GamebaseExtraDataHandler.RegisterExtraData(handle, providerName); if (methodName.Equals("Login", StringComparison.Ordinal) == true) { Login(credentialInfo, handle); } else if (methodName.Equals("AddMapping", StringComparison.Ordinal) == true) { AddMapping(credentialInfo, handle); } else if (methodName.Equals("AddMappingForcibly", StringComparison.Ordinal) == true) { AddMappingForcibly(credentialInfo, forcingMappingKey, handle); } } else { var callback = GamebaseCallbackHandler.GetCallback <GamebaseCallback.GamebaseDelegate <GamebaseResponse.Auth.AuthToken> >(handle); if (callback == null) { return; } AuthAdapterManager.Instance.IDPLogout(providerName); callback(null, new GamebaseError(GamebaseErrorCode.AUTH_IDP_LOGIN_FAILED, "AndroidGamebaseAuth", error: adapterError)); } }); } else { GamebaseLog.Debug("Call native method", this); if (methodName.Equals("Login", StringComparison.Ordinal) == true) { CallNativeLogin(providerName, handle); } else if (methodName.Equals("AddMapping", StringComparison.Ordinal) == true) { CallNativeMapping(providerName, handle); } else if (methodName.Equals("AddMappingForcibly", StringComparison.Ordinal) == true) { CallNativeMappingForcibly(providerName, forcingMappingKey, handle); } } }
virtual public void RemoveMapping(string providerName, int handle) { var vo = new NativeRequest.Auth.RemoveMapping(); vo.providerName = providerName; GamebaseExtraDataHandler.RegisterExtraData(handle, providerName); string jsonData = JsonMapper.ToJson(new UnityMessage(GamebaseAuth.AUTH_API_REMOVE_MAPPING, handle: handle, jsonData: JsonMapper.ToJson(vo), gameObjectName: GamebaseUnitySDK.ObjectName, requestMethodName: "OnAsyncEvent")); messageSender.GetAsync(jsonData); }
virtual protected void OnRemoveMapping(NativeMessage message) { GamebaseError error = message.GetGamebaseError(); string providerName = GamebaseExtraDataHandler.GetExtraData(message.handle); GamebaseExtraDataHandler.UnregisterExtraData(message.handle); if (Gamebase.IsSuccess(error) == true) { AuthAdapterManager.Instance.IDPLogout(providerName); } }