signIn method

  1. @override
Future<User?> signIn(
  1. String mail,
  2. String pass,
  3. SessionTypes type
)
override

Implementation

@override
Future<User?> signIn(String mail, String pass, SessionTypes type) async {
  try {
    var ret;
    switch (type) {
      case SessionTypes.GOOGLE:
        ret = await _googleLogin();
        break;
      case SessionTypes.APPLE:
        ret = await _appleLogin();
        break;
      case SessionTypes.CUSTOM:
        ret = await _customLogin(mail, pass);
        break;
      default:
        throw Exception("$type did not handle in sign in");
    }

    return ret;
  } on PlatformException catch (pe) {
    if (pe.code == OP_CANCELED) {
      throw ModCancelledException();
    } else {
      throw pe;
    }
  } on INetworkException catch (e) {
    ModLogger.e(error: e);
    rethrow;
  } on Exception catch (e) {
    ModLogger.e(error: e);

    throw e;
  }
}