import 'dart:developer' as developer; import 'package:flutter/foundation.dart' show kIsWeb; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'app.dart'; import 'core/auth/auth_controller.dart'; import 'core/config/url_strategy.dart'; import 'version.g.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); // Enable semantics tree on web for accessibility and automation tools. // This exposes widget identifiers to browser automation (Puppeteer, etc.) if (kIsWeb) { SemanticsBinding.instance.ensureSemantics(); } // Use path-based URLs on web (no-op on mobile/desktop) configureUrlStrategy(); debugPrint('🪣 ${AppVersion.name} v${AppVersion.fullVersion}'); // Initialize auth before starting the app. // This handles OIDC callback and silent auth on web. // If it returns false, we're redirecting and shouldn't continue. final authReady = await AuthController.initialize(); if (!authReady) { developer.log('Auth redirecting, not starting app', name: 'tatlock_ui'); return; // Don't run the app - browser is redirecting } runApp(const ProviderScope(child: TatlockApp())); }