diff --git a/.idea/libraries/Dart_Packages.xml b/.idea/libraries/Dart_Packages.xml
index d5f3182..bf85fb4 100644
--- a/.idea/libraries/Dart_Packages.xml
+++ b/.idea/libraries/Dart_Packages.xml
@@ -156,6 +156,13 @@
+
+
+
+
+
+
+
@@ -163,6 +170,13 @@
+
+
+
+
+
+
+
@@ -282,6 +296,13 @@
+
+
+
+
+
+
+
@@ -601,6 +622,7 @@
+
@@ -616,6 +638,7 @@
+
@@ -659,6 +682,7 @@
+
diff --git a/Sources/api_redirect/public-html/.well-known/assetlinks.json b/Sources/api_redirect/public-html/.well-known/assetlinks.json
deleted file mode 100644
index 024f0ef..0000000
--- a/Sources/api_redirect/public-html/.well-known/assetlinks.json
+++ /dev/null
@@ -1,14 +0,0 @@
-[
- {
- "relation": [
- "delegate_permission/common.handle_all_urls"
- ],
- "target": {
- "namespace": "android_app",
- "package_name": "com.example.dafl_project_flutter",
- "sha256_cert_fingerprints": [
- "63:51:EF:20:82:10:B9:34:F7:C7:4E:F6:55:D3:41:84:C6:81:30:23:02:50:E9:A3:EB:BB:F7:CF:43:79:A1:6E"
- ]
- }
- }
-]
\ No newline at end of file
diff --git a/Sources/api_redirect/public-html/callback/index.html b/Sources/api_redirect/public-html/callback/index.html
deleted file mode 100644
index 2f3b40c..0000000
--- a/Sources/api_redirect/public-html/callback/index.html
+++ /dev/null
@@ -1 +0,0 @@
-Should callback...
\ No newline at end of file
diff --git a/Sources/dafl_project_flutter/lib/controller/controller.dart b/Sources/dafl_project_flutter/lib/controller/controller.dart
index 408d141..e08e080 100644
--- a/Sources/dafl_project_flutter/lib/controller/controller.dart
+++ b/Sources/dafl_project_flutter/lib/controller/controller.dart
@@ -1,7 +1,5 @@
import 'dart:convert';
import 'package:http/http.dart' as http;
-import '../model/music.dart';
-import '../model/spot.dart';
import '../persistence/database_loader.dart';
import '../persistence/database_saver.dart';
import '../persistence/database_searcher.dart';
@@ -25,19 +23,19 @@ class Controller {
saver.save(userToSave);
}
- Future load(String username, String password) async {
+ load(String username, String password) async {
_changeCurrentUser(await loader.load(username, password));
}
- void _changeCurrentUser(User user) {
+ _changeCurrentUser(User user) {
currentUser = user;
}
- void changeCurrentUsername(String newName) {
+ changeCurrentUsername(String newName) {
currentUser.usernameDafl = newName;
}
- void changeCurrentPassword(String newPass) {
+ changeCurrentPassword(String newPass) {
currentUser.passwDafl = newPass;
}
@@ -78,8 +76,8 @@ class Controller {
].reversed.toList();
}*/
-
- Future sendEmail(User reporter, User reported, String reason, String message) async{
+ Future sendEmail(
+ User reporter, User reported, String reason, String message) async {
const serviceId = 'service_dzyndyb';
const templateId = 'template_idgriw2';
const userId = 'hy7HxL5QGV6gpdqry';
@@ -100,7 +98,7 @@ class Controller {
'reason': reason,
'message': message,
},
- }),
+ }),
);
}
}
diff --git a/Sources/dafl_project_flutter/lib/main.dart b/Sources/dafl_project_flutter/lib/main.dart
index 29ba192..167c516 100644
--- a/Sources/dafl_project_flutter/lib/main.dart
+++ b/Sources/dafl_project_flutter/lib/main.dart
@@ -1,6 +1,5 @@
import 'dart:async';
import 'dart:ui';
-import 'package:fluttertoast/fluttertoast.dart';
import 'dart:math';
import './views/pages/home/p_home.dart';
import './views/pages/main/p_main.dart';
@@ -10,7 +9,6 @@ import 'package:provider/provider.dart';
import 'package:rive/rive.dart' as riv;
import '../controller/controller.dart';
import 'model/spot.dart';
-import 'model/user.dart';
import 'api/api.dart';
import 'dart:developer' as dev;
import 'package:flutter_styled_toast/flutter_styled_toast.dart';
@@ -163,61 +161,55 @@ class CardProvider extends ChangeNotifier {
dev.log("discovery");
showToastWidget(
ClipRRect(
- borderRadius: BorderRadius.circular(25),
- child: new BackdropFilter(
- filter: new ImageFilter.blur(sigmaX: 30.0, sigmaY: 30.0),
- child: new Container(
- width: 300.0,
- height: 70.0,
- decoration: new BoxDecoration(
- color: Colors.grey.shade900.withOpacity(0.7),
- ),
- child: new Center(
- child: Row(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- MyApp.controller.currentUser.discovery
- .contains(MyApp.controller.currentUser.spots.last.music)
- ? Icon(
- Icons.info_rounded,
- size: 40,
- color: Colors.grey,
- )
- : Icon(
- Icons.check_rounded,
- size: 40,
- color: Colors.grey,
- ),
- SizedBox(
- width: 10,
- ),
- MyApp.controller.currentUser.discovery
- .contains(MyApp.controller.currentUser.spots.last.music)
- ? Text(
- "Déjà dans vos discovery",
- style: TextStyle(
- color: Colors.grey,
- fontWeight: FontWeight.bold,
- fontSize: 17),
- )
- : Text(
- "Ajouté à discovery",
- style: TextStyle(
- color: Colors.grey,
- fontWeight: FontWeight.bold,
- fontSize: 17),
- ),
- ],
- )),
- ),
- ),
- ),
+ borderRadius: BorderRadius.circular(25),
+ child: BackdropFilter(
+ filter: ImageFilter.blur(sigmaX: 30.0, sigmaY: 30.0),
+ child: Container(
+ width: 300.0,
+ height: 70.0,
+ decoration: BoxDecoration(
+ color: Colors.grey.shade900.withOpacity(0.7),
+ ),
+ child: Center(
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ MyApp.controller.currentUser.discovery.contains(
+ MyApp.controller.currentUser.spots.last.music)
+ ? const Icon(
+ Icons.info_rounded,
+ size: 40,
+ color: Colors.grey,
+ )
+ : const Icon(
+ Icons.check_rounded,
+ size: 40,
+ color: Colors.grey,
+ ),
+ const SizedBox(
+ width: 10,
+ ),
+ MyApp.controller.currentUser.discovery.contains(
+ MyApp.controller.currentUser.spots.last.music)
+ ? const Text(
+ "Déjà dans vos discovery",
+ style: TextStyle(
+ color: Colors.grey,
+ fontWeight: FontWeight.bold,
+ fontSize: 17),
+ )
+ : const Text("Ajouté à discovery",
+ style: TextStyle(
+ color: Colors.grey,
+ fontWeight: FontWeight.bold,
+ fontSize: 17))
+ ]))))),
context: context,
animation: StyledToastAnimation.fade,
reverseAnimation: StyledToastAnimation.fade,
position: StyledToastPosition.top,
- animDuration: Duration(milliseconds: 400),
- duration: Duration(milliseconds: 1500),
+ animDuration: const Duration(milliseconds: 400),
+ duration: const Duration(milliseconds: 1500),
curve: Curves.linear,
reverseCurve: Curves.linear,
);
@@ -334,7 +326,7 @@ class CardProvider extends ChangeNotifier {
child: ElevatedButton(
onPressed: () {
sendMessage(messageTextField.text,
- MyApp.controller.currentUser.spots.last.user);
+ MyApp.controller.currentUser.spots.last.userId);
},
style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFF3F1DC3),
@@ -364,8 +356,8 @@ class CardProvider extends ChangeNotifier {
);
}
- void sendMessage(String message, User destinataire) {
- dev.log(MyApp.controller.currentUser.spots.last.user.usernameDafl);
+ void sendMessage(String message, String userId) {
+ dev.log(MyApp.controller.currentUser.spots.last.userId);
}
void like(context) {
diff --git a/Sources/dafl_project_flutter/lib/model/conversation.dart b/Sources/dafl_project_flutter/lib/model/conversation.dart
deleted file mode 100644
index 449cd4f..0000000
--- a/Sources/dafl_project_flutter/lib/model/conversation.dart
+++ /dev/null
@@ -1,22 +0,0 @@
-import 'message.dart';
-import 'user.dart';
-import 'dart:developer' as dev;
-
-class Conversation {
- User firstUser;
- User secondUser;
- List messages = [];
-
- Conversation(this.firstUser, this.secondUser);
-
- void addMessage(User sender, String content) {
- messages.add(Message(sender, content));
- }
-
- void displayMessages() {
- dev.log("-----Conversation entre $firstUser et $secondUser-----");
- for (var element in messages) {
- dev.log(element.toString());
- }
- }
-}
diff --git a/Sources/dafl_project_flutter/lib/model/message.dart b/Sources/dafl_project_flutter/lib/model/message.dart
index 5fcd074..65ee12f 100644
--- a/Sources/dafl_project_flutter/lib/model/message.dart
+++ b/Sources/dafl_project_flutter/lib/model/message.dart
@@ -1,12 +1,8 @@
import 'user.dart';
-class Message{
+class Message {
User sender;
String content;
-
- @override
- String toString() => "$sender : $content";
-
Message(this.sender, this.content);
-}
\ No newline at end of file
+}
diff --git a/Sources/dafl_project_flutter/lib/model/spot.dart b/Sources/dafl_project_flutter/lib/model/spot.dart
index 96253c0..d093b7f 100644
--- a/Sources/dafl_project_flutter/lib/model/spot.dart
+++ b/Sources/dafl_project_flutter/lib/model/spot.dart
@@ -1,9 +1,8 @@
import 'music.dart';
-import 'user.dart';
class Spot {
- User user;
+ String userId;
Music music;
- Spot(this.user, this.music);
+ Spot(this.userId, this.music);
}
diff --git a/Sources/dafl_project_flutter/lib/model/user.dart b/Sources/dafl_project_flutter/lib/model/user.dart
index 04eb46d..2b194ec 100644
--- a/Sources/dafl_project_flutter/lib/model/user.dart
+++ b/Sources/dafl_project_flutter/lib/model/user.dart
@@ -1,33 +1,25 @@
import 'dart:async';
-import '../../../api/track.dart';
import '../../../position/location.dart';
import '../exceptions/api_exception.dart';
import '../main.dart';
-import 'conversation.dart';
import 'music.dart';
import 'spot.dart';
-Timer? timer;
-int test=0;
-
class User {
+ Timer? timer;
+ int test = 0;
+
//attributes from DAFL
late int idDafl;
late String usernameDafl;
late String passwDafl;
+ List discovery = [];
+ List spots = [];
//attributes with Spotify API
String? _idSpotify; //use _getIdUser() as kind of a private getter
late Music _currentMusic;
- Set likedUsers = {};
- List discovery = [];
- List waitingConv = [];
- List confirmConv = [];
-
- List spots = [];
- Map conversations = {};
-
//constructors
User(this.usernameDafl, this.passwDafl) {
_actualiseCurrentMusic();
@@ -40,27 +32,8 @@ class User {
return _idSpotify!;
}
- void addDiscovery(Music newmusic) {
- MyApp.controller.currentUser.discovery.add(newmusic);
- }
-
- void like(User liked) {
- likedUsers.add(liked);
- Conversation? conv = liked.conversations[this];
- if (conv == null) {
- conversations[liked] = Conversation(this, liked);
- } else {
- conversations[liked] = conv;
- }
- }
-
- void chat(User recipient, String content) {
- Conversation? conv = conversations[recipient];
- if (conv != null) conv.addMessage(this, content);
- }
-
- void displayConversations() {
- conversations.forEach((k, v) => v.displayMessages());
+ addDiscovery(Music music) {
+ discovery.add(music);
}
_actualiseCurrentMusic() async {
@@ -71,42 +44,28 @@ class User {
}
}
- void listspots (){
- Future? rep;
- int i;
- rep = Location.sendCurrentLocation();
- List> futureMusicList = [];
- List> musicId = [];
+ listSpots() {
+ Future rep = Location.sendCurrentLocation();
+ //ex : dorian-2d2s52a15d2a5,audric-2x5s2az3d1s5wx5s1,lucas-s2a5d25a2a25d
+
rep.then((String result) {
List tab = result.split(",");
- if (tab.isEmpty!=true) {
- for (i = 0; i < tab.length; i++) {
- musicId.add(tab[i].split("-"));
- }
- /*
- for (i = 0; i < musicId.length; i++) {
- // futuretracklist.add(MyApp.api.getTrackInfo(trackid[i][1]));
- }
- futureMusicList[i].then((Music m) {
- for (i = 0; i < futureMusicList.length; i++) {
- discovery.add(m);
- }
- });
+ //ex : [dorian-2d2s52a15d2a5 , audric-2x5s2az3d1s5wx5s1 , lucas-s2a5d25a2a25d]
- */ // EN COMMENTAIRE PARCE QUE ERREUR SINON VU QUE J'AI PAS MUSIC POUR L'INSTANT
+ for (var element in tab) {
+ List tab2 = element.split("-");
+ spots.add(Spot(tab2[0], Music(tab2[1])));
}
- });
+ });
}
- void getListSpots(){
- if (test==0){
- test=1;
- listspots();
- }else{
- timer = Timer.periodic(const Duration(seconds: 72), (Timer t) => listspots());
+ getListSpots() {
+ if (test == 0) {
+ test = 1;
+ listSpots();
+ } else {
+ timer =
+ Timer.periodic(const Duration(seconds: 72), (Timer t) => listSpots());
}
}
-
- @override
- String toString() => "$usernameDafl ($passwDafl)";
}
diff --git a/Sources/dafl_project_flutter/lib/position/location.dart b/Sources/dafl_project_flutter/lib/position/location.dart
index 73e937c..08e441d 100644
--- a/Sources/dafl_project_flutter/lib/position/location.dart
+++ b/Sources/dafl_project_flutter/lib/position/location.dart
@@ -4,8 +4,6 @@ import 'dart:convert';
import 'dart:async';
import '../main.dart';
-
-
class Location {
static Future sendCurrentLocation() async {
Uri uri = Uri.parse("http://89.83.53.34/phpmyadmin/dafldev/insert.php");
@@ -34,13 +32,9 @@ class Location {
String actualUser = MyApp.controller.currentUser.usernameDafl;
Uri uri = Uri.parse("http://89.83.53.34/phpmyadmin/dafldev/distance.php");
http.Response response = await http.post(uri, body: {
- "id": actualUser.toString(),
+ "id": actualUser,
});
var data = jsonDecode(response.body);
return data.toString();
}
-
-
}
-
-
diff --git a/Sources/dafl_project_flutter/lib/views/pages/main/p_conversation.dart b/Sources/dafl_project_flutter/lib/views/pages/main/p_conversation.dart
index e9fa1dd..6667407 100644
--- a/Sources/dafl_project_flutter/lib/views/pages/main/p_conversation.dart
+++ b/Sources/dafl_project_flutter/lib/views/pages/main/p_conversation.dart
@@ -258,7 +258,6 @@ class _ConversationPageState extends State {
}
Widget buildSheet() {
- String? currentvalue;
final messageTextField = TextEditingController();
return SingleChildScrollView(
padding:
@@ -321,7 +320,7 @@ class _ConversationPageState extends State {
borderRadius: BorderRadius.circular(15),
),
child: Column(
- children: [
+ children: const [
Text(
'Vous êtes sur le point de signaler cet utilisateur. Veuillez renseigner le motif du signalement.',
style: TextStyle(color: Colors.grey),
@@ -375,7 +374,8 @@ class _ConversationPageState extends State {
height: 70,
child: ElevatedButton(
onPressed: () {
- MyApp.controller.sendEmail(MyApp.controller.currentUser, destinataire, currentValue, messageTextField.text);
+ MyApp.controller.sendEmail(MyApp.controller.currentUser,
+ destinataire, currentValue, messageTextField.text);
Navigator.pop(context);
},
style: ElevatedButton.styleFrom(
@@ -412,6 +412,8 @@ class _ConversationPageState extends State {
}
class DropdownButtonReason extends StatefulWidget {
+ const DropdownButtonReason({super.key});
+
@override
State createState() => _DropdownButtonReasonState();
}
@@ -425,7 +427,6 @@ const List list = [
String currentValue = list[0];
-
class _DropdownButtonReasonState extends State {
String dropdownValue = list.first;
@@ -448,7 +449,7 @@ class _DropdownButtonReasonState extends State {
// This is called when the user selects an item.
setState(() {
dropdownValue = value!;
- currentValue = value!;
+ currentValue = value;
});
},
items: list.map>((String value) {
diff --git a/Sources/dafl_project_flutter/lib/views/pages/main/w_discovery.dart b/Sources/dafl_project_flutter/lib/views/pages/main/w_discovery.dart
index 11f6032..9e7cc53 100644
--- a/Sources/dafl_project_flutter/lib/views/pages/main/w_discovery.dart
+++ b/Sources/dafl_project_flutter/lib/views/pages/main/w_discovery.dart
@@ -1,6 +1,7 @@
import 'package:dafl_project_flutter/main.dart';
import 'package:fluttericon/font_awesome5_icons.dart';
import 'package:flutter/material.dart';
+import 'dart:developer' as dev;
class DiscoveryWidget extends StatefulWidget {
const DiscoveryWidget({Key? key}) : super(key: key);
@@ -115,7 +116,7 @@ class _DiscoveryListState extends State {
},
onDismissed: (direction) {
if (direction == DismissDirection.startToEnd) {
- print('play');
+ dev.log('play');
}
},
background: Container(