Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

怎样配置点击其他登录方式前提醒先同意用户协议(在不关闭一键登录页的前提下) #32

Open
toknT opened this issue Dec 27, 2023 · 0 comments

Comments

@toknT
Copy link

toknT commented Dec 27, 2023

Platforms

Android

Description

全屏模式,点击其他登录方式前,先提醒同意用户协议.

My code

Future<void> _aliSmsOnEvent(AuthResponseModel responseModel) async {
    final AuthResultCode resultCode = AuthResultCode.fromCode(
      responseModel.resultCode!,
    );
    switch (resultCode) {
      case AuthResultCode.success:
        if (responseModel.token != null && responseModel.token!.isNotEmpty) {
          String aliAuthToken = responseModel.token ?? '';
          if (aliAuthToken != '') {
            _loginViaPhone(aliAuthToken);
          } else {
            showToast(context: context, message: '登录出错');
          }
        }
        break;
      case AuthResultCode.envCheckSuccess:
        setState(() {
          _isSupportAliSimLogin = true;
        });
        break;
      case AuthResultCode.onCustomViewTap:
        print(responseModel.msg);
        if (_hasCheckAgreement == false) {
          showToast(context: context, message: '先同意用户协议');
          return;
        }
        switch (responseModel.msg) {
          case '2':
            _loginViaWechat();
            break;
          case '3':
            _loginViaApple();
            break;
          case '4':
            _loginViaSmsCode();
            break;
        }
        break;
      case AuthResultCode.loginControllerClickCheckBoxBtn:
        _hasCheckAgreement = !_hasCheckAgreement;
        break;
      default:
        print('ali sim auth event:');
        print(responseModel.innerCode);
        print(responseModel.toString());
        break;
    }
  }

  bool _hasCheckAgreement = false;

Try do it

目前在onCustomViewTap判断_hasCheckAgreement是否同意的但全屏登录页还是会被自动关闭

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant