Compare commits
3 Commits
210da71d50
...
89c5e1aa6c
Author | SHA1 | Date | |
---|---|---|---|
89c5e1aa6c | |||
f4fb846855 | |||
9a9287bd20 |
@@ -1,5 +1,8 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<application
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
|
||||||
|
|
||||||
|
<application
|
||||||
android:label="covas_mobile_new"
|
android:label="covas_mobile_new"
|
||||||
android:name="${applicationName}"
|
android:name="${applicationName}"
|
||||||
android:icon="@mipmap/ic_launcher">
|
android:icon="@mipmap/ic_launcher">
|
||||||
@@ -15,6 +18,7 @@
|
|||||||
android:theme="@style/LaunchTheme"
|
android:theme="@style/LaunchTheme"
|
||||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
||||||
android:hardwareAccelerated="true"
|
android:hardwareAccelerated="true"
|
||||||
|
android:enableOnBackInvokedCallback="true"
|
||||||
android:windowSoftInputMode="adjustResize">
|
android:windowSoftInputMode="adjustResize">
|
||||||
<!-- Specifies an Android theme to apply to this Activity as soon as
|
<!-- Specifies an Android theme to apply to this Activity as soon as
|
||||||
the Android process has started. This theme is visible to the user
|
the Android process has started. This theme is visible to the user
|
||||||
|
@@ -6,21 +6,28 @@ import 'pages/LoginDemo.dart';
|
|||||||
import 'locale_provider.dart'; // <-- à adapter selon ton arborescence
|
import 'locale_provider.dart'; // <-- à adapter selon ton arborescence
|
||||||
import 'package:covas_mobile/gen_l10n/app_localizations.dart';
|
import 'package:covas_mobile/gen_l10n/app_localizations.dart';
|
||||||
import 'classes/notification_service.dart';
|
import 'classes/notification_service.dart';
|
||||||
|
import 'classes/auth_service.dart';
|
||||||
|
import 'pages/ListItemMenu.dart';
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
await MobileAds.instance.initialize();
|
await MobileAds.instance.initialize();
|
||||||
await NotificationService.initialize();
|
await NotificationService.initialize();
|
||||||
|
final AuthService _authService = AuthService();
|
||||||
|
|
||||||
|
final loggedIn = await _authService.isLoggedIn();
|
||||||
|
|
||||||
runApp(
|
runApp(
|
||||||
ChangeNotifierProvider(
|
ChangeNotifierProvider(
|
||||||
create: (_) => LocaleProvider(),
|
create: (_) => LocaleProvider(),
|
||||||
child: MyApp(),
|
child: MyApp(isLoggedIn: loggedIn),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
class MyApp extends StatelessWidget {
|
class MyApp extends StatelessWidget {
|
||||||
|
final bool isLoggedIn;
|
||||||
|
const MyApp({Key? key, required this.isLoggedIn}) : super(key: key);
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final localeProvider = Provider.of<LocaleProvider>(
|
final localeProvider = Provider.of<LocaleProvider>(
|
||||||
@@ -30,7 +37,7 @@ class MyApp extends StatelessWidget {
|
|||||||
locale: localeProvider.locale, // <-- utilise la locale courante
|
locale: localeProvider.locale, // <-- utilise la locale courante
|
||||||
supportedLocales: L10n.all,
|
supportedLocales: L10n.all,
|
||||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||||
home: LoginDemo(),
|
home: isLoggedIn ? ListItemMenu() : LoginDemo(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -105,6 +105,11 @@ class _MapboxPagesState extends State<MapboxPages> with ShowAlertDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _getUserLocation() async {
|
Future<void> _getUserLocation() async {
|
||||||
|
await dotenv.load(fileName: ".env");
|
||||||
|
|
||||||
|
// Set the access token globally
|
||||||
|
mapbox.MapboxOptions.setAccessToken(
|
||||||
|
dotenv.env['MAPBOX_ACCESS_TOKEN'] ?? '');
|
||||||
try {
|
try {
|
||||||
bool serviceEnabled = await geo.Geolocator.isLocationServiceEnabled();
|
bool serviceEnabled = await geo.Geolocator.isLocationServiceEnabled();
|
||||||
if (!serviceEnabled) return;
|
if (!serviceEnabled) return;
|
||||||
|
Reference in New Issue
Block a user