public void LoginToVroidHub(Action <IRenderer> onResponse, Action <Account> onLoggedIn) { if (_model.IsAuthorized()) { GetAccountInfo(onResponse, onLoggedIn); return; } // modelを操作 _auth.AuthorizeWithExistAccount((bool isSuccess) => { if (!isSuccess) { _model.AuthorizationState = LoginModel.State.AUTHORIZATION_CODE_REQUESTED; onResponse(new LoginViewRenderer(_model)); _browser = BrowserAuthorize.GenerateInstance(_sdkConfig); _browser.OpenBrowser(AfterAuthentication(onResponse, onLoggedIn)); } else { _model.AuthorizationState = LoginModel.State.AUTHORIZED; GetAccountInfo(onResponse, onLoggedIn); } }, (error) => { _model.AuthorizationState = LoginModel.State.CONNECTION_FAILED; onResponse(new LoginViewRenderer(_model)); }); }
void OnLoginButtonClicked() { Authentication.Instance.AuthorizeWithExistAccount((bool isAuthSuccess) => { if (isAuthSuccess) { AuthSuccessed(); } else { codeField.SetActive(true); browserAuthorize.OpenBrowser(AfterBrowserAuthorize); } }, (System.Exception e) => { codeField.SetActive(true); browserAuthorize.OpenBrowser(AfterBrowserAuthorize); }); }