From 53da73ff926370333a20b70ad7c63932413d47b2 Mon Sep 17 00:00:00 2001 From: dohodin Date: Sat, 29 Oct 2022 23:00:43 +0200 Subject: [PATCH] Commit newPhpFile --- .idea/libraries/Dart_Packages.xml | 500 ++++++++++++++++++ .idea/libraries/Dart_SDK.xml | 38 +- .../android/app/src/main/AndroidManifest.xml | 2 + .../lib/model/location.dart | 34 -- .../Flutter/GeneratedPluginRegistrant.swift | 4 +- Sources/dafl_project_flutter/pubspec.lock | 63 ++- Sources/dafl_project_flutter/pubspec.yaml | 5 +- .../test/widget_test.dart | 2 +- .../flutter/generated_plugin_registrant.cc | 3 + .../windows/flutter/generated_plugins.cmake | 1 + Sources/phpLocation/location.php | 19 + 11 files changed, 592 insertions(+), 79 deletions(-) create mode 100644 .idea/libraries/Dart_Packages.xml create mode 100644 Sources/phpLocation/location.php diff --git a/.idea/libraries/Dart_Packages.xml b/.idea/libraries/Dart_Packages.xml new file mode 100644 index 0000000..13e875a --- /dev/null +++ b/.idea/libraries/Dart_Packages.xml @@ -0,0 +1,500 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Dart_SDK.xml b/.idea/libraries/Dart_SDK.xml index cb79f3d..4c005e4 100644 --- a/.idea/libraries/Dart_SDK.xml +++ b/.idea/libraries/Dart_SDK.xml @@ -1,25 +1,25 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/Sources/dafl_project_flutter/android/app/src/main/AndroidManifest.xml b/Sources/dafl_project_flutter/android/app/src/main/AndroidManifest.xml index 50184a8..9c05673 100644 --- a/Sources/dafl_project_flutter/android/app/src/main/AndroidManifest.xml +++ b/Sources/dafl_project_flutter/android/app/src/main/AndroidManifest.xml @@ -31,4 +31,6 @@ android:name="flutterEmbedding" android:value="2" /> + + diff --git a/Sources/dafl_project_flutter/lib/model/location.dart b/Sources/dafl_project_flutter/lib/model/location.dart index 33a92a6..ea73494 100644 --- a/Sources/dafl_project_flutter/lib/model/location.dart +++ b/Sources/dafl_project_flutter/lib/model/location.dart @@ -1,37 +1,3 @@ import 'package:flutter/services.dart'; -import 'package:location/location.dart'; -class Location { - late Location _location; - bool _serviceEnabled = false; - PermissionStatus? _grantedPermission; - Location() { - _location = Location(); - } - - Future _checkPermission() async { - if (await _checkService()){ - _grantedPermission = await _location.hasPermission(); - if(_grantedPermission == PermissionStatus.denied){ - _grantedPermission = await _location.requestPermission(); - } - } - return _grantedPermission == PermissionStatus.granted; - } - - Future _checkService() async { - try{ - _serviceEnabled = await _location.serviceEnabled(); - if (!_serviceEnabled){ - _serviceEnabled= await _location.requestService(); - } - } on PlatformException catch (error){ - print('Error code : ${error.code} et le message d\' erreur : ${error.message}'); - _serviceEnabled = false; - await _checkService(); - - } - return _serviceEnabled; - } -} diff --git a/Sources/dafl_project_flutter/macos/Flutter/GeneratedPluginRegistrant.swift b/Sources/dafl_project_flutter/macos/Flutter/GeneratedPluginRegistrant.swift index 6b401e5..977f380 100644 --- a/Sources/dafl_project_flutter/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/Sources/dafl_project_flutter/macos/Flutter/GeneratedPluginRegistrant.swift @@ -5,8 +5,8 @@ import FlutterMacOS import Foundation -import location +import geolocator_apple func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { - LocationPlugin.register(with: registry.registrar(forPlugin: "LocationPlugin")) + GeolocatorPlugin.register(with: registry.registrar(forPlugin: "GeolocatorPlugin")) } diff --git a/Sources/dafl_project_flutter/pubspec.lock b/Sources/dafl_project_flutter/pubspec.lock index 268bd1b..ef0eda8 100644 --- a/Sources/dafl_project_flutter/pubspec.lock +++ b/Sources/dafl_project_flutter/pubspec.lock @@ -163,6 +163,48 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.1" + geolocator: + dependency: "direct main" + description: + name: geolocator + url: "https://pub.dartlang.org" + source: hosted + version: "9.0.2" + geolocator_android: + dependency: transitive + description: + name: geolocator_android + url: "https://pub.dartlang.org" + source: hosted + version: "4.1.4" + geolocator_apple: + dependency: transitive + description: + name: geolocator_apple + url: "https://pub.dartlang.org" + source: hosted + version: "2.2.2" + geolocator_platform_interface: + dependency: transitive + description: + name: geolocator_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "4.0.7" + geolocator_web: + dependency: transitive + description: + name: geolocator_web + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.6" + geolocator_windows: + dependency: transitive + description: + name: geolocator_windows + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.1" graphs: dependency: transitive description: @@ -219,27 +261,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.0" - location: - dependency: "direct main" - description: - name: location - url: "https://pub.dartlang.org" - source: hosted - version: "4.4.0" - location_platform_interface: - dependency: transitive - description: - name: location_platform_interface - url: "https://pub.dartlang.org" - source: hosted - version: "2.3.0" - location_web: - dependency: transitive - description: - name: location_web - url: "https://pub.dartlang.org" - source: hosted - version: "3.1.1" matcher: dependency: transitive description: diff --git a/Sources/dafl_project_flutter/pubspec.yaml b/Sources/dafl_project_flutter/pubspec.yaml index 9f51600..c09213a 100644 --- a/Sources/dafl_project_flutter/pubspec.yaml +++ b/Sources/dafl_project_flutter/pubspec.yaml @@ -42,8 +42,9 @@ dependencies: animations: ^2.0.7 fluttertoast: ^8.1.1 vibration: ^1.7.6 - location: ^4.2.0 - geocoding: ^2.0.1 + geolocator: ^9.0.2 + geocoding: ^2.0.5 + dev_dependencies: flutter_test: diff --git a/Sources/dafl_project_flutter/test/widget_test.dart b/Sources/dafl_project_flutter/test/widget_test.dart index 74abdb4..c894ad9 100644 --- a/Sources/dafl_project_flutter/test/widget_test.dart +++ b/Sources/dafl_project_flutter/test/widget_test.dart @@ -13,7 +13,7 @@ import 'package:dafl_project_flutter/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. - await tester.pumpWidget(const MyApp()); + await tester.pumpWidget(MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); diff --git a/Sources/dafl_project_flutter/windows/flutter/generated_plugin_registrant.cc b/Sources/dafl_project_flutter/windows/flutter/generated_plugin_registrant.cc index 8b6d468..1ece8f2 100644 --- a/Sources/dafl_project_flutter/windows/flutter/generated_plugin_registrant.cc +++ b/Sources/dafl_project_flutter/windows/flutter/generated_plugin_registrant.cc @@ -6,6 +6,9 @@ #include "generated_plugin_registrant.h" +#include void RegisterPlugins(flutter::PluginRegistry* registry) { + GeolocatorWindowsRegisterWithRegistrar( + registry->GetRegistrarForPlugin("GeolocatorWindows")); } diff --git a/Sources/dafl_project_flutter/windows/flutter/generated_plugins.cmake b/Sources/dafl_project_flutter/windows/flutter/generated_plugins.cmake index b93c4c3..7f101a7 100644 --- a/Sources/dafl_project_flutter/windows/flutter/generated_plugins.cmake +++ b/Sources/dafl_project_flutter/windows/flutter/generated_plugins.cmake @@ -3,6 +3,7 @@ # list(APPEND FLUTTER_PLUGIN_LIST + geolocator_windows ) list(APPEND FLUTTER_FFI_PLUGIN_LIST diff --git a/Sources/phpLocation/location.php b/Sources/phpLocation/location.php new file mode 100644 index 0000000..3c8c0cd --- /dev/null +++ b/Sources/phpLocation/location.php @@ -0,0 +1,19 @@ + \ No newline at end of file