telegram
Some checks failed
Deploy Mnemo Cards / Deploy Backend (push) Waiting to run
Deploy Mnemo Cards / Deploy Web App (push) Blocked by required conditions
Deploy Mnemo Cards / Final Verification (push) Blocked by required conditions
Web App CI / test (push) Has been cancelled
Web App CI / build (push) Has been cancelled

This commit is contained in:
Dmitry 2025-12-11 21:10:01 +03:00
parent 391c54fb15
commit f056961d8e

View file

@ -44,8 +44,8 @@ class _SignInWithTelegramState extends State<SignInWithTelegram> {
super.dispose(); super.dispose();
} }
Future<void> _loginWithTelegram() async { Future<void> _loginWithTelegram({String? codeParam}) async {
final code = _telegramCodeController.text.trim(); final code = codeParam ?? _telegramCodeController.text.trim();
if (code.isEmpty) { if (code.isEmpty) {
widget.onError('Введите код авторизации'); widget.onError('Введите код авторизации');
@ -191,15 +191,15 @@ class _SignInWithTelegramState extends State<SignInWithTelegram> {
widget.onError('Срок действия кода истёк. Сгенерируйте новый.'); widget.onError('Срок действия кода истёк. Сгенерируйте новый.');
} else if (status.isConsumed) { } else if (status.isConsumed) {
_stopCodePolling(); _stopCodePolling();
} else if (status.isReadyForLogin && !_autoLoginAttempted && mounted) { } else if (status.isReadyForLogin) {
log('Auto-login triggered for code: ${status.code}', name: 'SignInWithTelegram'); log('Auto-login triggered for code: ${status.code}', name: 'SignInWithTelegram');
_autoLoginAttempted = true; _autoLoginAttempted = true;
// Small delay to ensure UI updates are processed before navigation // Small delay to ensure UI updates are processed before navigation
await Future.delayed(const Duration(milliseconds: 100)); // await Future<void>.delayed(const Duration(milliseconds: 100));
if (mounted) { if (mounted) {
await _loginWithTelegram(); await _loginWithTelegram(codeParam: status.code);
} }
} }
} catch (e, s) { } catch (e, s) {