Add Android support with configurable server URL and location permissions
- Add shared_preferences for persisting server URL - Add SettingsService and PlatformService - Add server URL input field on non-web platforms - Make ApiConfig baseUrl configurable at runtime - Add Android location permissions (ACCESS_FINE/COURSE_LOCATION, INTERNET) - Request location permission on login and map init - Fix geo_id type: use String instead of int (UUID format) - Align share_service with API spec: remove unique_id, use share_id only - Fix watch endpoint response: last_update instead of created_at - Add error handling with SnackBars for geo operations - Wrap login screen in SingleChildScrollView for keyboard handling - Update map tile layer with userAgentPackageName for OSM
This commit is contained in:
+13
-4
@@ -1,22 +1,31 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'config/api.dart';
|
||||
import 'providers/auth_provider.dart';
|
||||
import 'providers/map_provider.dart';
|
||||
import 'providers/share_provider.dart';
|
||||
import 'screens/login_screen.dart';
|
||||
import 'screens/map_screen.dart';
|
||||
import 'services/settings_service.dart';
|
||||
|
||||
void main() {
|
||||
runApp(const MyApp());
|
||||
void main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
final settings = SettingsService();
|
||||
await settings.initialize();
|
||||
ApiConfig.setBaseUrl(settings.baseUrl);
|
||||
runApp(MyApp(settingsService: settings));
|
||||
}
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({super.key});
|
||||
final SettingsService settingsService;
|
||||
|
||||
const MyApp({super.key, required this.settingsService});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MultiProvider(
|
||||
providers: [
|
||||
Provider.value(value: settingsService),
|
||||
ChangeNotifierProvider(create: (_) => AuthProvider()),
|
||||
ChangeNotifierProvider(create: (_) => MapProvider()),
|
||||
ChangeNotifierProvider(create: (_) => ShareProvider()),
|
||||
@@ -37,4 +46,4 @@ class MyApp extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user