1
0
forked from baron/baron-sso

userfront gateway 분리.

This commit is contained in:
Lectom C Han
2026-01-30 16:14:20 +09:00
parent 35552943d7
commit 1db7ce8f10
8 changed files with 302 additions and 99 deletions

View File

@@ -21,6 +21,7 @@ class _QRScanScreenState extends State<QRScanScreen> {
bool _isScanned = false;
bool _isCheckingSession = false;
bool _isProcessing = false;
bool _isRequestingCamera = false;
bool? _isSuccess;
String? _resultMessage;
@@ -100,10 +101,7 @@ class _QRScanScreenState extends State<QRScanScreen> {
}
if (sessionToken == null && !usesCookie) {
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('로그인이 필요합니다.'), backgroundColor: Colors.red),
);
context.pop();
context.go('/signin?notice=qr_login_required');
}
return;
}
@@ -148,6 +146,28 @@ class _QRScanScreenState extends State<QRScanScreen> {
controller.start();
}
Future<void> _requestCameraPermission() async {
if (_isRequestingCamera) return;
setState(() => _isRequestingCamera = true);
try {
await controller.start();
} catch (e) {
_log.warning('Camera permission request failed: $e');
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('카메라 권한 요청에 실패했습니다. 브라우저/OS 설정을 확인해주세요.'),
backgroundColor: Colors.red,
),
);
}
} finally {
if (mounted) {
setState(() => _isRequestingCamera = false);
}
}
}
Widget _buildResultView() {
final success = _isSuccess == true;
final icon = success ? Icons.check_circle_outline : Icons.error_outline;
@@ -207,13 +227,30 @@ class _QRScanScreenState extends State<QRScanScreen> {
controller: controller,
onDetect: _onDetect,
errorBuilder: (context, error) {
final isPermissionDenied = error.errorCode ==
MobileScannerErrorCode.permissionDenied;
return Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Icon(Icons.error, color: Colors.red, size: 50),
const SizedBox(height: 10),
Text('Camera Error: ${error.errorCode}'),
Text(
isPermissionDenied
? '카메라 권한이 필요합니다.'
: '카메라 오류: ${error.errorCode}',
),
const SizedBox(height: 12),
FilledButton(
onPressed: _isRequestingCamera
? null
: _requestCameraPermission,
child: Text(
_isRequestingCamera
? '요청 중...'
: '카메라 권한 요청하기',
),
),
],
),
);