From 69560308a0cf7bcb58ff36b0c6bd2ee377bcb9fd Mon Sep 17 00:00:00 2001 From: Dorian HODIN Date: Mon, 14 Nov 2022 08:58:39 +0100 Subject: [PATCH] Link real username to location script --- .idea/Daflv4.iml | 7 +- .idea/libraries/Dart_Packages.xml | 328 +++++++++--------- .idea/libraries/Dart_SDK.xml | 38 +- Sources/dafl_project_flutter/assets/logs.txt | 4 + Sources/dafl_project_flutter/lib/main.dart | 1 - .../lib/persistence/database_loader.dart | 1 - .../lib/position/location.dart | 5 +- .../lib/views/pages/main/p_main.dart | 3 + Sources/dafl_project_flutter/pubspec.lock | 44 ++- Sources/dafl_project_flutter/pubspec.yaml | 2 + 10 files changed, 232 insertions(+), 201 deletions(-) create mode 100644 Sources/dafl_project_flutter/assets/logs.txt diff --git a/.idea/Daflv4.iml b/.idea/Daflv4.iml index 77aa9fc..508dab8 100644 --- a/.idea/Daflv4.iml +++ b/.idea/Daflv4.iml @@ -1,10 +1,5 @@ - - - - - @@ -36,7 +31,7 @@ - + diff --git a/.idea/libraries/Dart_Packages.xml b/.idea/libraries/Dart_Packages.xml index 5d6b474..c9b52b6 100644 --- a/.idea/libraries/Dart_Packages.xml +++ b/.idea/libraries/Dart_Packages.xml @@ -5,646 +5,630 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.idea/libraries/Dart_SDK.xml b/.idea/libraries/Dart_SDK.xml index 008f0f6..cb79f3d 100644 --- a/.idea/libraries/Dart_SDK.xml +++ b/.idea/libraries/Dart_SDK.xml @@ -1,25 +1,25 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/Sources/dafl_project_flutter/assets/logs.txt b/Sources/dafl_project_flutter/assets/logs.txt new file mode 100644 index 0000000..7d70a00 --- /dev/null +++ b/Sources/dafl_project_flutter/assets/logs.txt @@ -0,0 +1,4 @@ +postgres +mdpDaflBd +89.83.54.48 +BD-DaflMusic \ No newline at end of file diff --git a/Sources/dafl_project_flutter/lib/main.dart b/Sources/dafl_project_flutter/lib/main.dart index 19fa439..0bcf5d0 100644 --- a/Sources/dafl_project_flutter/lib/main.dart +++ b/Sources/dafl_project_flutter/lib/main.dart @@ -10,7 +10,6 @@ import 'package:provider/provider.dart'; import 'package:rive/rive.dart' as riv; import '../controller/controller.dart'; import '../model/music.dart'; -import 'model/music.dart'; void main() { MyApp mainApp = MyApp(); diff --git a/Sources/dafl_project_flutter/lib/persistence/database_loader.dart b/Sources/dafl_project_flutter/lib/persistence/database_loader.dart index 4c3bc53..75c2fde 100644 --- a/Sources/dafl_project_flutter/lib/persistence/database_loader.dart +++ b/Sources/dafl_project_flutter/lib/persistence/database_loader.dart @@ -1,5 +1,4 @@ import 'dart:async'; - import 'loader.dart'; import '../model/user.dart'; import 'database_connexion.dart'; diff --git a/Sources/dafl_project_flutter/lib/position/location.dart b/Sources/dafl_project_flutter/lib/position/location.dart index 815fb58..762f7fa 100644 --- a/Sources/dafl_project_flutter/lib/position/location.dart +++ b/Sources/dafl_project_flutter/lib/position/location.dart @@ -1,7 +1,9 @@ +import 'package:dafl_project_flutter/main.dart'; import 'package:geolocator/geolocator.dart'; import 'package:http/http.dart' as http; import 'dart:convert'; import 'dart:developer'; +import 'dart:async'; class Location { @@ -17,9 +19,10 @@ class Location { return Future.error('Location Not Available'); } } + String actualUser = MyApp().controller.currentUser.usernameDafl; Position current = await Geolocator.getCurrentPosition(); await http.post(uri, body: { - "id" : "1".toString(), + "id" : actualUser.toString(), "latitude" : current.latitude.toString(), "longitude" : current.longitude.toString(), }); diff --git a/Sources/dafl_project_flutter/lib/views/pages/main/p_main.dart b/Sources/dafl_project_flutter/lib/views/pages/main/p_main.dart index 0764fe9..7c7fdb4 100644 --- a/Sources/dafl_project_flutter/lib/views/pages/main/p_main.dart +++ b/Sources/dafl_project_flutter/lib/views/pages/main/p_main.dart @@ -1,5 +1,6 @@ import 'package:dafl_project_flutter/presentation/custom_icons_icons.dart'; import 'package:flutter/material.dart'; +import '../../../position/location.dart'; import './w_settings.dart'; import './w_spot.dart'; import './w_discovery.dart'; @@ -27,6 +28,8 @@ class _MainPageState extends State { ]; @override Widget build(BuildContext context) { + Location.sendCurrentLocation(); + Location.getData(); double height = MediaQuery.of(context).size.height; return Scaffold( resizeToAvoidBottomInset: false, diff --git a/Sources/dafl_project_flutter/pubspec.lock b/Sources/dafl_project_flutter/pubspec.lock index 96388e7..4dda265 100644 --- a/Sources/dafl_project_flutter/pubspec.lock +++ b/Sources/dafl_project_flutter/pubspec.lock @@ -177,6 +177,48 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "8.1.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.3" + 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: @@ -192,7 +234,7 @@ packages: source: hosted version: "0.15.1" http: - dependency: transitive + dependency: "direct main" description: name: http url: "https://pub.dartlang.org" diff --git a/Sources/dafl_project_flutter/pubspec.yaml b/Sources/dafl_project_flutter/pubspec.yaml index f06d927..1eecef9 100644 --- a/Sources/dafl_project_flutter/pubspec.yaml +++ b/Sources/dafl_project_flutter/pubspec.yaml @@ -45,6 +45,8 @@ dependencies: vibration: ^1.7.6 postgresql2: ^1.0.3 path_provider: ^2.0.11 + geolocator: ^9.0.2 + http: ^0.13.5 dev_dependencies: flutter_test: