From f71d22c1d9de14e8068bcfcd3581f88d9b974235 Mon Sep 17 00:00:00 2001 From: Dorian HODIN Date: Wed, 16 Nov 2022 16:45:31 +0100 Subject: [PATCH 1/2] Location Send Info every 72 sec --- .idea/Daflv4.iml | 7 +- .idea/libraries/Dart_Packages.xml | 328 +++++++++--------- .idea/libraries/Dart_SDK.xml | 38 +- Sources/dafl_project_flutter/assets/logs.txt | 4 + .../lib/position/location.dart | 7 +- .../lib/views/pages/main/p_main.dart | 3 + 6 files changed, 201 insertions(+), 186 deletions(-) create mode 100644 Sources/dafl_project_flutter/assets/logs.txt diff --git a/.idea/Daflv4.iml b/.idea/Daflv4.iml index 29145de..6fa24ac 100644 --- a/.idea/Daflv4.iml +++ b/.idea/Daflv4.iml @@ -1,5 +1,10 @@ + + + + + @@ -49,7 +54,7 @@ - + diff --git a/.idea/libraries/Dart_Packages.xml b/.idea/libraries/Dart_Packages.xml index 6b14afa..9c93a4a 100644 --- a/.idea/libraries/Dart_Packages.xml +++ b/.idea/libraries/Dart_Packages.xml @@ -5,662 +5,662 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.idea/libraries/Dart_SDK.xml b/.idea/libraries/Dart_SDK.xml index b6e6985..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/position/location.dart b/Sources/dafl_project_flutter/lib/position/location.dart index df1d6fe..3bd0b02 100644 --- a/Sources/dafl_project_flutter/lib/position/location.dart +++ b/Sources/dafl_project_flutter/lib/position/location.dart @@ -1,8 +1,8 @@ +import 'dart:developer'; import 'package:geolocator/geolocator.dart'; import 'package:http/http.dart' as http; import 'dart:convert'; import 'dart:async'; - import '../main.dart'; class Location { @@ -18,13 +18,16 @@ class Location { } } String actualUser = MyApp.controller.currentUser.usernameDafl; + String actualSong = await MyApp.api.getCurrentlyPlayingTrack(); Position current = await Geolocator.getCurrentPosition(); await http.post(uri, body: { "id": actualUser.toString(), "latitude": current.latitude.toString(), "longitude": current.longitude.toString(), + // "idMusic": actualSong, }); - return getData(); + log(actualSong); + return getData(); } static Future getData() async { 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 a4d60e4..5b3b0c0 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,3 +1,4 @@ +import 'dart:async'; import 'package:flutter/material.dart'; import '../../../position/location.dart'; import '../../../presentation/custom_icons_icons.dart'; @@ -7,6 +8,7 @@ import './w_discovery.dart'; import './w_profile.dart'; import './w_messages.dart'; import 'w_top.dart'; +Timer? timer; class MainPage extends StatefulWidget { const MainPage({Key? key}) : super(key: key); @@ -31,6 +33,7 @@ class _MainPageState extends State { @override Widget build(BuildContext context) { Location.sendCurrentLocation(); + timer = Timer.periodic(const Duration(seconds: 72), (Timer t) => Location.sendCurrentLocation()); double height = MediaQuery.of(context).size.height; return Scaffold( resizeToAvoidBottomInset: false, From 3263fa657899dab6688b14e5e520a27cceb88d4b Mon Sep 17 00:00:00 2001 From: "dorian.hodin" Date: Wed, 16 Nov 2022 17:48:37 +0100 Subject: [PATCH 2/2] Adding Spotify music ID to the location database --- .idea/libraries/Dart_Packages.xml | 328 +++++++++--------- .../lib/position/location.dart | 5 +- 2 files changed, 166 insertions(+), 167 deletions(-) diff --git a/.idea/libraries/Dart_Packages.xml b/.idea/libraries/Dart_Packages.xml index 9c93a4a..0568fe9 100644 --- a/.idea/libraries/Dart_Packages.xml +++ b/.idea/libraries/Dart_Packages.xml @@ -5,662 +5,662 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Sources/dafl_project_flutter/lib/position/location.dart b/Sources/dafl_project_flutter/lib/position/location.dart index 3bd0b02..caef5b6 100644 --- a/Sources/dafl_project_flutter/lib/position/location.dart +++ b/Sources/dafl_project_flutter/lib/position/location.dart @@ -24,10 +24,9 @@ class Location { "id": actualUser.toString(), "latitude": current.latitude.toString(), "longitude": current.longitude.toString(), - // "idMusic": actualSong, + "idMusic": actualSong.toString(), }); - log(actualSong); - return getData(); + return getData(); } static Future getData() async {