Show Google sign-in diagnostics

This commit is contained in:
zsolt 2026-08-13 02:00:05 +02:00
parent ac9c9de753
commit eb3d7cd446

View File

@ -147,6 +147,8 @@ class _AccountsPageState extends State<AccountsPage> {
try { try {
if (!initialized) { if (!initialized) {
final configuredClientId = await _loadGoogleServerClientId();
runtimeServerClientId = configuredClientId?.trim();
await _ensureGoogleInitialized(); await _ensureGoogleInitialized();
initialized = true; initialized = true;
} }
@ -155,13 +157,15 @@ class _AccountsPageState extends State<AccountsPage> {
await _loadGoogleCalendars(promptIfNecessary: true); await _loadGoogleCalendars(promptIfNecessary: true);
} catch (error) { } catch (error) {
if (!mounted) return; if (!mounted) return;
setState(() { final friendlyMessage = _friendlyGoogleError(
loadingCalendars = false;
statusMessage = _friendlyGoogleError(
'Google bejelentkez\u00e9s nem siker\u00fclt', 'Google bejelentkez\u00e9s nem siker\u00fclt',
error, error,
); );
setState(() {
loadingCalendars = false;
statusMessage = friendlyMessage;
}); });
await _showGoogleErrorDialog(friendlyMessage);
} }
} }
@ -176,6 +180,27 @@ class _AccountsPageState extends State<AccountsPage> {
return '$prefix: $raw'; return '$prefix: $raw';
} }
Future<void> _showGoogleErrorDialog(String message) async {
if (!mounted) return;
await showDialog<void>(
context: context,
builder: (context) => AlertDialog(
title: const Text('Google bel\u00e9p\u00e9s nem indult el'),
content: Text(
'$message\n\n'
'A v\u00e1rt m\u0171k\u00f6d\u00e9s az, hogy a Google saj\u00e1t bel\u00e9p\u00e9si/enged\u00e9lyez\u00e9si ablaka ny\u00edlik meg. '
'Ehhez az appnak el\u0151re regisztr\u00e1lt Google konfigur\u00e1ci\u00f3 kell, \u00e9s az eszk\u00f6z\u00f6n Google Play Services / Google fi\u00f3k is sz\u00fcks\u00e9ges.',
),
actions: [
TextButton(
onPressed: () => Navigator.pop(context),
child: const Text('Rendben'),
),
],
),
);
}
Future<void> _ensureGoogleInitialized() async { Future<void> _ensureGoogleInitialized() async {
final clientId = runtimeServerClientId; final clientId = runtimeServerClientId;
if (clientId == null || clientId.isEmpty) { if (clientId == null || clientId.isEmpty) {