From f056961d8e4d9e6a1c66110360cd544daba1cd3f Mon Sep 17 00:00:00 2001 From: Dmitry Date: Thu, 11 Dec 2025 21:10:01 +0300 Subject: [PATCH] telegram --- .../presentation/pages/auth/sign_in_with_telegram.dart | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mnemo_cards_web_v2/lib/presentation/pages/auth/sign_in_with_telegram.dart b/mnemo_cards_web_v2/lib/presentation/pages/auth/sign_in_with_telegram.dart index ae0012a..d25f006 100644 --- a/mnemo_cards_web_v2/lib/presentation/pages/auth/sign_in_with_telegram.dart +++ b/mnemo_cards_web_v2/lib/presentation/pages/auth/sign_in_with_telegram.dart @@ -44,8 +44,8 @@ class _SignInWithTelegramState extends State { super.dispose(); } - Future _loginWithTelegram() async { - final code = _telegramCodeController.text.trim(); + Future _loginWithTelegram({String? codeParam}) async { + final code = codeParam ?? _telegramCodeController.text.trim(); if (code.isEmpty) { widget.onError('Введите код авторизации'); @@ -191,15 +191,15 @@ class _SignInWithTelegramState extends State { widget.onError('Срок действия кода истёк. Сгенерируйте новый.'); } else if (status.isConsumed) { _stopCodePolling(); - } else if (status.isReadyForLogin && !_autoLoginAttempted && mounted) { + } else if (status.isReadyForLogin) { log('Auto-login triggered for code: ${status.code}', name: 'SignInWithTelegram'); _autoLoginAttempted = true; // Small delay to ensure UI updates are processed before navigation - await Future.delayed(const Duration(milliseconds: 100)); + // await Future.delayed(const Duration(milliseconds: 100)); if (mounted) { - await _loginWithTelegram(); + await _loginWithTelegram(codeParam: status.code); } } } catch (e, s) {