Merge et harmonisation.
continuous-integration/drone/push Build is passing Details

messagerie_lucas_test
Félix MIELCAREK 2 years ago
parent d605c45f91
commit 342ec103fc

@ -156,6 +156,13 @@
</list>
</value>
</entry>
<entry key="flutter_localizations">
<value>
<list>
<option value="$PROJECT_DIR$/../../../../flutter/packages/flutter_localizations/lib" />
</list>
</value>
</entry>
<entry key="flutter_native_splash">
<value>
<list>
@ -163,6 +170,13 @@
</list>
</value>
</entry>
<entry key="flutter_styled_toast">
<value>
<list>
<option value="$PROJECT_DIR$/../../../../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_styled_toast-2.1.3/lib" />
</list>
</value>
</entry>
<entry key="flutter_test">
<value>
<list>
@ -282,6 +296,13 @@
</list>
</value>
</entry>
<entry key="intl">
<value>
<list>
<option value="$PROJECT_DIR$/../../../../flutter/.pub-cache/hosted/pub.dartlang.org/intl-0.17.0/lib" />
</list>
</value>
</entry>
<entry key="js">
<value>
<list>
@ -601,6 +622,7 @@
<root url="file://$PROJECT_DIR$/../../../../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_launcher_icons-0.10.0/lib" />
<root url="file://$PROJECT_DIR$/../../../../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_lints-2.0.1/lib" />
<root url="file://$PROJECT_DIR$/../../../../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_native_splash-2.2.11/lib" />
<root url="file://$PROJECT_DIR$/../../../../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_styled_toast-2.1.3/lib" />
<root url="file://$PROJECT_DIR$/../../../../flutter/.pub-cache/hosted/pub.dartlang.org/fluttericon-2.0.0/lib" />
<root url="file://$PROJECT_DIR$/../../../../flutter/.pub-cache/hosted/pub.dartlang.org/fluttertoast-8.1.1/lib" />
<root url="file://$PROJECT_DIR$/../../../../flutter/.pub-cache/hosted/pub.dartlang.org/font_awesome_flutter-10.2.1/lib" />
@ -616,6 +638,7 @@
<root url="file://$PROJECT_DIR$/../../../../flutter/.pub-cache/hosted/pub.dartlang.org/http-0.13.5/lib" />
<root url="file://$PROJECT_DIR$/../../../../flutter/.pub-cache/hosted/pub.dartlang.org/http_parser-4.0.2/lib" />
<root url="file://$PROJECT_DIR$/../../../../flutter/.pub-cache/hosted/pub.dartlang.org/image-3.2.2/lib" />
<root url="file://$PROJECT_DIR$/../../../../flutter/.pub-cache/hosted/pub.dartlang.org/intl-0.17.0/lib" />
<root url="file://$PROJECT_DIR$/../../../../flutter/.pub-cache/hosted/pub.dartlang.org/js-0.6.4/lib" />
<root url="file://$PROJECT_DIR$/../../../../flutter/.pub-cache/hosted/pub.dartlang.org/json_annotation-4.7.0/lib" />
<root url="file://$PROJECT_DIR$/../../../../flutter/.pub-cache/hosted/pub.dartlang.org/lints-2.0.0/lib" />
@ -659,6 +682,7 @@
<root url="file://$PROJECT_DIR$/../../../../flutter/.pub-cache/hosted/pub.dartlang.org/yaml-3.1.1/lib" />
<root url="file://$PROJECT_DIR$/../../../../flutter/bin/cache/pkg/sky_engine/lib" />
<root url="file://$PROJECT_DIR$/../../../../flutter/packages/flutter/lib" />
<root url="file://$PROJECT_DIR$/../../../../flutter/packages/flutter_localizations/lib" />
<root url="file://$PROJECT_DIR$/../../../../flutter/packages/flutter_test/lib" />
<root url="file://$PROJECT_DIR$/../../../../flutter/packages/flutter_web_plugins/lib" />
</CLASSES>

@ -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"
]
}
}
]

@ -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<void> 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';

@ -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';
@ -164,60 +162,54 @@ class CardProvider extends ChangeNotifier {
showToastWidget(
ClipRRect(
borderRadius: BorderRadius.circular(25),
child: new BackdropFilter(
filter: new ImageFilter.blur(sigmaX: 30.0, sigmaY: 30.0),
child: new Container(
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 30.0, sigmaY: 30.0),
child: Container(
width: 300.0,
height: 70.0,
decoration: new BoxDecoration(
decoration: BoxDecoration(
color: Colors.grey.shade900.withOpacity(0.7),
),
child: new Center(
child: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
MyApp.controller.currentUser.discovery
.contains(MyApp.controller.currentUser.spots.last.music)
? Icon(
MyApp.controller.currentUser.discovery.contains(
MyApp.controller.currentUser.spots.last.music)
? const Icon(
Icons.info_rounded,
size: 40,
color: Colors.grey,
)
: Icon(
: const Icon(
Icons.check_rounded,
size: 40,
color: Colors.grey,
),
SizedBox(
const SizedBox(
width: 10,
),
MyApp.controller.currentUser.discovery
.contains(MyApp.controller.currentUser.spots.last.music)
? Text(
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),
)
: Text(
"Ajouté à discovery",
: const Text("Ajouté à discovery",
style: TextStyle(
color: Colors.grey,
fontWeight: FontWeight.bold,
fontSize: 17),
),
],
)),
),
),
),
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) {

@ -1,22 +0,0 @@
import 'message.dart';
import 'user.dart';
import 'dart:developer' as dev;
class Conversation {
User firstUser;
User secondUser;
List<Message> 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());
}
}
}

@ -4,9 +4,5 @@ class Message{
User sender;
String content;
@override
String toString() => "$sender : $content";
Message(this.sender, this.content);
}

@ -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);
}

@ -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';
class User {
Timer? timer;
int test = 0;
class User {
//attributes from DAFL
late int idDafl;
late String usernameDafl;
late String passwDafl;
List<Music> discovery = [];
List<Spot> spots = [];
//attributes with Spotify API
String? _idSpotify; //use _getIdUser() as kind of a private getter
late Music _currentMusic;
Set<User> likedUsers = {};
List<Music> discovery = [];
List<Conversation> waitingConv = [];
List<Conversation> confirmConv = [];
List<Spot> spots = [];
Map<User, Conversation> 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<String>? rep;
int i;
rep = Location.sendCurrentLocation();
List<Future<Music>> futureMusicList = [];
List<List<String>> musicId = [];
listSpots() {
Future<String> rep = Location.sendCurrentLocation();
//ex : dorian-2d2s52a15d2a5,audric-2x5s2az3d1s5wx5s1,lucas-s2a5d25a2a25d
rep.then((String result) {
List<String> 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<String> tab2 = element.split("-");
spots.add(Spot(tab2[0], Music(tab2[1])));
}
});
}
void getListSpots(){
getListSpots() {
if (test == 0) {
test = 1;
listspots();
listSpots();
} else {
timer = Timer.periodic(const Duration(seconds: 72), (Timer t) => listspots());
timer =
Timer.periodic(const Duration(seconds: 72), (Timer t) => listSpots());
}
}
@override
String toString() => "$usernameDafl ($passwDafl)";
}

@ -4,8 +4,6 @@ import 'dart:convert';
import 'dart:async';
import '../main.dart';
class Location {
static Future<String> 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();
}
}

@ -258,7 +258,6 @@ class _ConversationPageState extends State<ConversationPage> {
}
Widget buildSheet() {
String? currentvalue;
final messageTextField = TextEditingController();
return SingleChildScrollView(
padding:
@ -321,7 +320,7 @@ class _ConversationPageState extends State<ConversationPage> {
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<ConversationPage> {
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<ConversationPage> {
}
class DropdownButtonReason extends StatefulWidget {
const DropdownButtonReason({super.key});
@override
State<DropdownButtonReason> createState() => _DropdownButtonReasonState();
}
@ -425,7 +427,6 @@ const List<String> list = <String>[
String currentValue = list[0];
class _DropdownButtonReasonState extends State<DropdownButtonReason> {
String dropdownValue = list.first;
@ -448,7 +449,7 @@ class _DropdownButtonReasonState extends State<DropdownButtonReason> {
// This is called when the user selects an item.
setState(() {
dropdownValue = value!;
currentValue = value!;
currentValue = value;
});
},
items: list.map<DropdownMenuItem<String>>((String value) {

@ -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<DiscoveryList> {
},
onDismissed: (direction) {
if (direction == DismissDirection.startToEnd) {
print('play');
dev.log('play');
}
},
background: Container(

Loading…
Cancel
Save