- Configure production API URL (biz.payfrit.com) as default - Add INTERNET permission to AndroidManifest for API calls - Remove login requirement from restaurant selection (allow anonymous browsing) - Add enhanced logging for beacon scanning diagnostics - Add splash screen logging for auth flow debugging Technical changes: - api.dart: Default baseUrl to production instead of throwing error - restaurant_select_screen.dart: Remove userId requirement for browsing - beacon_scan_screen.dart: Replace debugPrint with print for better log capture - splash_screen.dart: Add diagnostic logging for auth restoration - AndroidManifest.xml: Add INTERNET permission Known issue: - Beacon detection not working - app receives beacon data from API (3 beacons) but BLE scanning not detecting physical beacons. Needs investigation of: * Physical beacon UUID configuration * Android BLE permissions at runtime * Beacon plugin initialization 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
73 lines
2 KiB
Dart
73 lines
2 KiB
Dart
import "dart:async";
|
||
import "package:flutter/material.dart";
|
||
import "package:provider/provider.dart";
|
||
|
||
import "../app/app_router.dart";
|
||
import "../app/app_state.dart";
|
||
import "../services/api.dart";
|
||
import "../services/auth_storage.dart";
|
||
|
||
class SplashScreen extends StatefulWidget {
|
||
const SplashScreen({super.key});
|
||
|
||
@override
|
||
State<SplashScreen> createState() => _SplashScreenState();
|
||
}
|
||
|
||
class _SplashScreenState extends State<SplashScreen> {
|
||
Timer? _timer;
|
||
|
||
@override
|
||
void initState() {
|
||
super.initState();
|
||
print('[Splash] 🚀 SplashScreen initState called');
|
||
|
||
_timer = Timer(const Duration(milliseconds: 2400), () async {
|
||
print('[Splash] ⏰ Timer fired, starting navigation logic');
|
||
if (!mounted) return;
|
||
|
||
// Check for saved authentication credentials
|
||
print('[Splash] 🔐 Checking for saved auth credentials...');
|
||
final credentials = await AuthStorage.loadAuth();
|
||
if (credentials != null) {
|
||
print('[Splash] ✅ Found saved credentials: UserID=${credentials.userId}');
|
||
// Restore authentication state
|
||
Api.setAuthToken(credentials.token);
|
||
final appState = context.read<AppState>();
|
||
appState.setUserId(credentials.userId);
|
||
} else {
|
||
print('[Splash] ℹ️ No saved credentials found');
|
||
}
|
||
|
||
if (!mounted) return;
|
||
|
||
// Always go to beacon scan first - allows browsing without login
|
||
print('[Splash] 📡 Navigating to beacon scan screen');
|
||
Navigator.of(context).pushReplacementNamed(AppRoutes.beaconScan);
|
||
});
|
||
}
|
||
|
||
@override
|
||
void dispose() {
|
||
_timer?.cancel();
|
||
super.dispose();
|
||
}
|
||
|
||
@override
|
||
Widget build(BuildContext context) {
|
||
return const Scaffold(
|
||
backgroundColor: Colors.black,
|
||
body: Center(
|
||
child: Text(
|
||
"PAYFRIT",
|
||
style: TextStyle(
|
||
color: Colors.white,
|
||
fontSize: 38,
|
||
fontWeight: FontWeight.w800,
|
||
letterSpacing: 3,
|
||
),
|
||
),
|
||
),
|
||
);
|
||
}
|
||
}
|