signIn method
구글 로그인 실행
Implementation
@override
Future<AuthResult> signIn() async {
try {
if (!_initialized) await initialize();
// 먼저 조용한 로그인 시도
var account =
await GoogleSignIn.instance.attemptLightweightAuthentication();
// 실패하면 전체 로그인 플로우
if (account == null) {
if (!GoogleSignIn.instance.supportsAuthenticate()) {
return ErrorMapper.toFailure(
AuthProvider.google,
KAuthError.fromCode(ErrorCodes.platformNotSupported),
);
}
account = await GoogleSignIn.instance.authenticate();
}
return _buildResult(account);
} on GoogleSignInException catch (e) {
return ErrorMapper.toFailure(AuthProvider.google, ErrorMapper.google(e));
} catch (e) {
return ErrorMapper.handleException(
AuthProvider.google,
e,
operation: '로그인',
errorCode: ErrorCodes.googleSignInFailed,
);
}
}