Ejemplo n.º 1
0
        @Override
        public void OnGetStWithPasswd(
            String userAccount,
            long dwSrcAppid,
            int dwMainSigMap,
            long dwSubDstAppid,
            String userPasswd,
            WUserSigInfo userSigInfo,
            int ret,
            ErrMsg errMsg) {
          switch (ret) {
            case util.S_GET_IMAGE:
              {
              }
              break;

            case util.S_GET_SMS:
              {
              }
              break;

            case util.S_SUCCESS:
              {
                loginSuccess(userAccount);
              }
              break;

            case util.S_BABYLH_EXPIRED:
            case util.S_LH_EXPIRED:
              {
              }
              break;

            default:
              WtloginUtil.setUin(null);
              // 取消菊花
              dismissProDialog();
              ToastUtil.ShowLongToast(
                  GTOctopusActivity.this, errMsg.getTitle() + "," + errMsg.getMessage());
              finish();
          }
        }
Ejemplo n.º 2
0
  /* 进行验证码验证,或者进行快速登录的回调,这两个是进行快速登录可能遇到的情况 */
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    String userAccount = "";
    ErrMsg errMsg = null;
    WUserSigInfo userSigInfo = null;
    switch (requestCode) {
      case WtloginUtil.REQ_VCODE:
        {
          if (data == null) break;
          Bundle bundle = data.getExtras();
          if (bundle == null) break;
          userAccount = bundle.getString("ACCOUNT");
          errMsg = (ErrMsg) bundle.getParcelable("ERRMSG");
          userSigInfo = (WUserSigInfo) bundle.getParcelable("USERSIG");

          if (resultCode == util.S_SUCCESS) {
            // 转菊花,等待产品列表获取结果
            showProDialog(
                getString(R.string.pi_octopus_pull_products),
                getString(R.string.pi_octopus_pull_products_content));
            loginSuccess(userAccount);
          } else if (resultCode == util.S_LH_EXPIRED || resultCode == util.S_BABYLH_EXPIRED) {
            Ticket ticket = WtloginHelper.GetUserSigInfoTicket(userSigInfo, SigType.WLOGIN_LHSIG);
            finish();
            ToastUtil.ShowLongToast(
                GTApp.getContext(),
                "lhsig=" + util.buf_to_string(ticket._sig) + " errMsg=" + errMsg);
          } else {
            finish();
            ToastUtil.ShowLongToast(GTApp.getContext(), "errMsg=" + errMsg);
          }
        }
        break;
      case WtloginUtil.REQ_QLOGIN: // 快速登录返回
        try {
          if (data == null) { // 这种情况下用户多半是直接按了返回按钮,没有进行快速登录;快速登录失败可提醒用户输入密码登录
            break;
          }

          WUserSigInfo sigInfo = WtloginUtil.getSigInfo(data);
          if (sigInfo == null) {
            ToastUtil.ShowLongToast(GTApp.getContext(), R.string.pi_octopus_login_user_quickerror);
            break;
          }

          WtloginUtil.setUin(sigInfo.uin);

          // 转菊花,等待产品列表获取结果
          showProDialog(
              getString(R.string.pi_octopus_pull_products),
              getString(R.string.pi_octopus_pull_products_content));

          // 快速登录只是从手Q换取了A1票据,A1则相当于用户密码,在此仍需要再发起一次A1换票的流程,才能拿到目标票据
          WtloginUtil.getStWithPasswd(sigInfo);
          // 换票据成功后会触发wtloginListener的监听
        } catch (Exception e) {
          util.printException(e);
        }
        break;
      default:
        break;
    }
  }