login method

Future<V2TimCallback> login({
  1. required String userID,
  2. required String userSig,
})

Implementation

Future<V2TimCallback> login(
    {required String userID, required String userSig}) async {
  try {
    LoginParams loginParams = LoginParams()
      ..userID = userID
      ..userSig = userSig;
    final resLogin = await wrappedPromiseToFuture(
        V2TIMManagerWeb.timWeb!.login(loginParams));
    if (resLogin.code == 0) {
      loginUserID = loginParams.userID;
      await completer.future;
      return CommonUtils.returnSuccessWithDesc('login success');
    }

    return CommonUtils.returnSuccessWithDesc('login failed');
  } catch (err) {
    return CommonUtils.returnError(err);
  }
}