Compare commits

..

33 Commits

Author SHA1 Message Date
dorian.hodin 9fa0510a87 Add ADMINS in .drone.yml
continuous-integration/drone/push Build is passing Details
2 years ago
dorian.hodin d4a6daf4d2 Re-deploy containers 2
2 years ago
dorian.hodin d3cc32a0b8 Re-deploy containers
2 years ago
Audric SABATIER b99d407c91 ADD : add spot user to list of user conv and send message to him (Swipe on top)
continuous-integration/drone/push Build is passing Details
2 years ago
dorian.hodin b61f9d6f07 Timer 10 => 20
continuous-integration/drone/push Build is passing Details
2 years ago
Lucas Delanier a029de17c9 fix some visuals problems
continuous-integration/drone/push Build is passing Details
2 years ago
Lucas Delanier b53f683da7 Merge remote-tracking branch 'origin/#MSG01/ImplementationFirebaseMessaging' into #MSG01/ImplementationFirebaseMessaging
continuous-integration/drone/push Build is passing Details
2 years ago
Lucas Delanier 48e868084a fix send bar
2 years ago
Audric SABATIER fee30256cc ADD : Timestamp to display messages in order
continuous-integration/drone/push Build is passing Details
2 years ago
Audric SABATIER a2ee5b35a5 ADD : Display all messages in conv
continuous-integration/drone/push Build is passing Details
2 years ago
Dorian HODIN 6f59204361 change php_server
continuous-integration/drone/push Build is passing Details
2 years ago
Dorian HODIN 7a77591c11 Now work with containers
continuous-integration/drone/push Build is passing Details
2 years ago
Dorian HODIN ae00ce8b76 .drone.yml update
continuous-integration/drone/push Build was killed Details
2 years ago
Dorian HODIN 1e5e6f997a Server Web on Containers, change db_location to public
continuous-integration/drone/push Build is passing Details
2 years ago
Audric SABATIER 79e56d12ba ADD : Display users on top of conv page
continuous-integration/drone/push Build is passing Details
2 years ago
Audric SABATIER 407bd19f4a ADD : Get user from Firestore and display in conv page
continuous-integration/drone/push Build is failing Details
2 years ago
Lucas Delanier 7880edf861 fix add to discovery
continuous-integration/drone/push Build is passing Details
2 years ago
dorian.hodin d2b9ca3547 Now good URL for Location DB and server
continuous-integration/drone/push Build is passing Details
2 years ago
Lucas Delanier d77b18503a fix name scrolling on profile page
continuous-integration/drone/push Build is passing Details
2 years ago
Dorian HODIN 4f1436fc5b Make button play with spotify visible on spot + spot working + temporary IP adress
continuous-integration/drone/push Build is passing Details
2 years ago
Lucas Delanier a9dd2cd336 fix navbar height
continuous-integration/drone/push Build is passing Details
2 years ago
Lucas Delanier 98afc0967e fix page spot
continuous-integration/drone/push Build is passing Details
2 years ago
Lucas Delanier f320c8e113 fix creation of the playlist
continuous-integration/drone/push Build is passing Details
2 years ago
Dorian HODIN 29a513a484 CI Test
continuous-integration/drone/push Build is passing Details
2 years ago
Lucas Delanier a8df8e214e fix problem with discoveries
continuous-integration/drone/push Build is passing Details
2 years ago
Audric SABATIER 67df69604b ADD : Methods call by the controller and some comments
continuous-integration/drone/push Build is passing Details
2 years ago
Audric SABATIER 9497713be4 ADD : Methods to get messages from FireStrore
continuous-integration/drone/push Build is passing Details
2 years ago
Audric SABATIER dc951b015e ADD : Firebase options files to complete CI
continuous-integration/drone/push Build is passing Details
2 years ago
Audric SABATIER cee8a2fd80 ADD : Send messages From MassagingService by controller
continuous-integration/drone/push Build is failing Details
2 years ago
Audric SABATIER 7f35484e2c ADD : HashMap to message class and send methods
continuous-integration/drone/push Build is failing Details
2 years ago
Audric SABATIER d3afd5714f ADD : FIREBASE to the project
continuous-integration/drone/push Build is failing Details
2 years ago
Lucas Delanier e7402aa914 fix problem with late data
continuous-integration/drone/push Build is passing Details
2 years ago
Audric SABATIER b9a9f72d0c ADD: New database and new logs Update
continuous-integration/drone/push Build is passing Details
2 years ago

@ -52,6 +52,8 @@ steps:
CONTAINERNAME: apiredirect CONTAINERNAME: apiredirect
COMMAND: create COMMAND: create
OVERWRITE: true OVERWRITE: true
ADMINS: dorianhodin,alexislamande,baptistebaverel,johanlachenal
depends_on: [ web-server ] depends_on: [ web-server ]
# docker image build # docker image build
@ -67,7 +69,8 @@ steps:
password: password:
from_secret: SECRET_PASSWD from_secret: SECRET_PASSWD
# container deployment
# container deployment
- name: deploy-php - name: deploy-php
image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest
environment: environment:
@ -85,6 +88,7 @@ steps:
from_secret: db_password from_secret: db_password
CODEFIRST_CLIENTDRONE_ENV_ROOT_PASSWORD: CODEFIRST_CLIENTDRONE_ENV_ROOT_PASSWORD:
from_secret: db_root_password from_secret: db_root_password
ADMINS: dorianhodin,alexislamande,baptistebaverel,johanlachenal
depends_on: [ php_script ] depends_on: [ php_script ]
# database container deployment # database container deployment
@ -92,10 +96,10 @@ steps:
image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest
environment: environment:
IMAGENAME: mariadb:10.5 IMAGENAME: mariadb:10.5
CONTAINERNAME: mysql_location CONTAINERNAME: db_location
COMMAND: create COMMAND: create
# OVERWRITE: true OVERWRITE: true
PRIVATE: true # PRIVATE: true
CODEFIRST_CLIENTDRONE_ENV_MARIADB_ROOT_PASSWORD: CODEFIRST_CLIENTDRONE_ENV_MARIADB_ROOT_PASSWORD:
from_secret: db_root_password from_secret: db_root_password
CODEFIRST_CLIENTDRONE_ENV_MARIADB_DATABASE: CODEFIRST_CLIENTDRONE_ENV_MARIADB_DATABASE:
@ -104,5 +108,5 @@ steps:
from_secret: db_user from_secret: db_user
CODEFIRST_CLIENTDRONE_ENV_MARIADB_PASSWORD: CODEFIRST_CLIENTDRONE_ENV_MARIADB_PASSWORD:
from_secret: db_password from_secret: db_password
ADMINS: dorianhodin,alexislamande,baptistebaverel,johanlachenal
depends_on: [ deploy-php ] depends_on: [ deploy-php ]

@ -1,5 +1,6 @@
<component name="ProjectCodeStyleConfiguration"> <component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173"> <code_scheme name="Project" version="173">
<option name="WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN" value="true" />
<JetCodeStyleSettings> <JetCodeStyleSettings>
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" /> <option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</JetCodeStyleSettings> </JetCodeStyleSettings>

@ -2,7 +2,7 @@
<img src="https://codefirst.iut.uca.fr/git/DAFLDev/DAFLMusic/raw/branch/master/Documentation/Images/Banner_DAFL.png" /> <img src="https://codefirst.iut.uca.fr/git/DAFLDev/DAFLMusic/raw/branch/master/Documentation/Images/Banner_DAFL.png" />
</p> </p>
[![Build Status](https://codefirst.iut.uca.fr/api/badges/DAFLDev/DAFLMusic/status.svg)](https://codefirst.iut.uca.fr/DAFLDev/DAFLMusic) [![Build Status](https://codefirst.iut.uca.fr/api/badges/DAFLDev/DAFLMusic/status.svg)](https://codefirst.iut.uca.fr/DAFLDev/DAFLMusic)
[![Bugs](https://codefirst.iut.uca.fr/sonar/api/project_badges/measure?project=DAFLMusic&metric=bugs&token=d36308dfacfc3cb26e1944ec2441cd9563e0c912)](https://codefirst.iut.uca.fr/sonar/dashboard?id=DAFLMusic) [![Bugs](https://codefirst.iut.uca.fr/sonar/api/project_badges/measure?project=DAFLMusic&metric=bugs&token=d36308dfacfc3cb26e1944ec2441cd9563e0c912)](https://codefirst.iut.uca.fr/sonar/dashboard?id=DAFLMusic)
[![Code Smells](https://codefirst.iut.uca.fr/sonar/api/project_badges/measure?project=DAFLMusic&metric=code_smells&token=d36308dfacfc3cb26e1944ec2441cd9563e0c912)](https://codefirst.iut.uca.fr/sonar/dashboard?id=DAFLMusic) [![Code Smells](https://codefirst.iut.uca.fr/sonar/api/project_badges/measure?project=DAFLMusic&metric=code_smells&token=d36308dfacfc3cb26e1944ec2441cd9563e0c912)](https://codefirst.iut.uca.fr/sonar/dashboard?id=DAFLMusic)
[![Technical Debt](https://codefirst.iut.uca.fr/sonar/api/project_badges/measure?project=DAFLMusic&metric=sqale_index&token=d36308dfacfc3cb26e1944ec2441cd9563e0c912)](https://codefirst.iut.uca.fr/sonar/dashboard?id=DAFLMusic) [![Technical Debt](https://codefirst.iut.uca.fr/sonar/api/project_badges/measure?project=DAFLMusic&metric=sqale_index&token=d36308dfacfc3cb26e1944ec2441cd9563e0c912)](https://codefirst.iut.uca.fr/sonar/dashboard?id=DAFLMusic)
@ -55,7 +55,4 @@ tous les utilisateurs.
* Si l'utilisateur est consentant, après un "Match", il peut accepter de * Si l'utilisateur est consentant, après un "Match", il peut accepter de
révéler quelques informations personnelles (nom, âge, sexe). révéler quelques informations personnelles (nom, âge, sexe).
Le but est qu'une mise en contact entre 2 personnes se base uniquement Le but est qu'une mise en contact entre 2 personnes se base uniquement
sur des critères musicaux et non personnels. sur des critères musicaux et non personnels.
<a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/4.0/"><img alt="Licence Creative Commons" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-nd/4.0/88x31.png" /></a><br />Ce(tte) œuvre est mise à disposition selon les termes de la <a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/4.0/">Licence Creative Commons Attribution - Pas d&#39;Utilisation Commerciale - Pas de Modification 4.0 International</a>.

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 20 KiB

@ -1,4 +1,4 @@
postgres avnadmin
mdpDaflBd AVNS_MA4OWhqM3cOMSwKXlzw
89.83.54.48 pg-206a2fcd-the-3c42.aivencloud.com
BD-DaflMusic Bd-DaflMusic

@ -10,23 +10,46 @@ import '../services/api/api_spotify.dart';
import '../services/database/database_service.dart'; import '../services/database/database_service.dart';
import '../services/position/location.dart'; import '../services/position/location.dart';
import 'live_datas.dart'; import 'live_datas.dart';
import 'package:dafl_project_flutter/model/message.dart';
import 'package:dafl_project_flutter/services/messaging/message_database_service.dart';
import 'dart:developer' as dev;
class Controller { class Controller {
final ApiSpotify _api = ApiSpotify(); final ApiSpotify _api = ApiSpotify();
late User _currentUser; late User _currentUser;
final DataBaseService _dataBaseService = DataBaseService(); final DataBaseService _dataBaseService = DataBaseService();
final LiveData _data = LiveData(); final LiveData _data = LiveData();
final MessageDatabaseService _messageAccess = MessageDatabaseService();
late BuildContext navigatorKey; late BuildContext navigatorKey;
/// FIREBASE Messaging
void sendMessage(Message message, String idSender, String idReceiver) {
_messageAccess.sendMessage(message, idSender, idReceiver);
}
Stream<List<Message>> getMessage(String idSender, String idReceiver) {
return _messageAccess.getMessage(idSender, idReceiver);
}
void addUserConversation(String idSender, String idReceiver){
_messageAccess.addMessagingUser(idSender, idReceiver);
}
initUser() async { initUser() async {
await setCurrentMusic(); await setCurrentMusic();
await setDiscoveries(); await setDiscoveries();
} }
beginRoutine() async { beginRoutine() {
await setSpots(); Timer.periodic(const Duration(seconds: 20), (Timer t) => setSpots());
Timer.periodic(const Duration(seconds: 10), (Timer t) => setSpots());
} }
// //
@ -48,14 +71,23 @@ class Controller {
await getCompleteMusic(await _api.requests.getCurrentlyPlayingTrack()); await getCompleteMusic(await _api.requests.getCurrentlyPlayingTrack());
} }
List<Spot> getSpots() => _data.spots; List<Spot> getSpots() {
return _data.spots;
}
setSpots() async { setSpots() async {
print('setspot');
_data.spots = await Location.sendCurrentLocation(); _data.spots = await Location.sendCurrentLocation();
} }
LinkedHashMap<Music, DateTime> getDiscoveries() => _data.discoveries; LinkedHashMap<Music, DateTime> getDiscoveries() => _data.discoveries;
void deleteDiscoveries(Music key) {
_data.discoveries.remove(key);
removeFromPlaylist(key.id);
}
setDiscoveries() async { setDiscoveries() async {
LinkedHashMap<String, DateTime> tmpData = LinkedHashMap<String, DateTime> tmpData =
await _api.requests.getPlaylistTracks(); await _api.requests.getPlaylistTracks();
@ -93,8 +125,10 @@ class Controller {
_api.requests.removeFromPlaylist(id); _api.requests.removeFromPlaylist(id);
} }
addToPlaylist(String id) { addToPlaylist(String id) async {
_api.requests.addToPlaylist(id); _api.requests.addToPlaylist(id);
Music music = await getCompleteMusic(id);
_data.discoveries.addAll({music: DateTime.now()});
} }
playTrack(String id) { playTrack(String id) {
@ -113,6 +147,7 @@ class Controller {
return false; return false;
} }
_currentUser = newUser; _currentUser = newUser;
_currentUser.idSpotify = await _api.requests.getIdUser();
return true; return true;
} }

@ -6,6 +6,6 @@ import '../model/spot.dart';
class LiveData { class LiveData {
bool discoveriesSortChoice = true; bool discoveriesSortChoice = true;
late LinkedHashMap<Music, DateTime> discoveries; late LinkedHashMap<Music, DateTime> discoveries;
late List<Spot> spots; List<Spot> spots = <Spot>[];
late Music userCurrentMusic; late Music userCurrentMusic;
} }

@ -0,0 +1,69 @@
// File generated by FlutterFire CLI.
// ignore_for_file: lines_longer_than_80_chars, avoid_classes_with_only_static_members
import 'package:firebase_core/firebase_core.dart' show FirebaseOptions;
import 'package:flutter/foundation.dart'
show defaultTargetPlatform, kIsWeb, TargetPlatform;
/// Default [FirebaseOptions] for use with your Firebase apps.
///
/// Example:
/// ```dart
/// import 'firebase_options.dart';
/// // ...
/// await Firebase.initializeApp(
/// options: DefaultFirebaseOptions.currentPlatform,
/// );
/// ```
class DefaultFirebaseOptions {
static FirebaseOptions get currentPlatform {
if (kIsWeb) {
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for web - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
}
switch (defaultTargetPlatform) {
case TargetPlatform.android:
return android;
case TargetPlatform.iOS:
return ios;
case TargetPlatform.macOS:
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for macos - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
case TargetPlatform.windows:
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for windows - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
case TargetPlatform.linux:
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for linux - '
'you can reconfigure this by running the FlutterFire CLI again.',
);
default:
throw UnsupportedError(
'DefaultFirebaseOptions are not supported for this platform.',
);
}
}
static const FirebaseOptions android = FirebaseOptions(
apiKey: 'AIzaSyBODcBh2wlcYBc0QCQKLKXA46uE64veSvA',
appId: '1:743783838712:android:34e4356470b8125ee51c0d',
messagingSenderId: '743783838712',
projectId: 'daflmusic-b36d2',
storageBucket: 'daflmusic-b36d2.appspot.com',
);
static const FirebaseOptions ios = FirebaseOptions(
apiKey: 'AIzaSyD2E7KNx6BNyn6U7FqDq65m-i66WXVyjYA',
appId: '1:743783838712:ios:d69f49090eb60fb9e51c0d',
messagingSenderId: '743783838712',
projectId: 'daflmusic-b36d2',
storageBucket: 'daflmusic-b36d2.appspot.com',
iosClientId: '743783838712-eqfakrghgk4grboprkebadoqe09k0002.apps.googleusercontent.com',
iosBundleId: 'com.example.daflProjectFlutter',
);
}

@ -8,12 +8,19 @@ import 'package:flutter/services.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:rive/rive.dart' as riv; import 'package:rive/rive.dart' as riv;
import '../controller/controller.dart'; import '../controller/controller.dart';
import 'model/message.dart';
import 'model/spot.dart'; import 'model/spot.dart';
import 'dart:developer' as dev; import 'dart:developer' as dev;
import 'package:flutter_styled_toast/flutter_styled_toast.dart'; import 'package:flutter_styled_toast/flutter_styled_toast.dart';
import 'package:firebase_core/firebase_core.dart';
import 'firebase_options.dart';
void main() { void main() async{
runApp(const MyApp()); runApp(const MyApp());
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
} }
class MyApp extends StatelessWidget { class MyApp extends StatelessWidget {
@ -221,7 +228,7 @@ class CardProvider extends ChangeNotifier {
notifyListeners(); notifyListeners();
} }
} }
final messageTextField = TextEditingController();
void message(context) { void message(context) {
dev.log("message"); dev.log("message");
_angle = 0; _angle = 0;
@ -243,7 +250,6 @@ class CardProvider extends ChangeNotifier {
} }
Widget buildSheet(context) { Widget buildSheet(context) {
final messageTextField = TextEditingController();
return SingleChildScrollView( return SingleChildScrollView(
padding: padding:
EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom), EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom),
@ -296,26 +302,28 @@ class CardProvider extends ChangeNotifier {
), ),
child: Padding( child: Padding(
padding: const EdgeInsets.all(20), padding: const EdgeInsets.all(20),
child: TextField( child: Form(
keyboardAppearance: Brightness.dark, child: TextField(
controller: messageTextField, keyboardAppearance: Brightness.dark,
maxLength: 300, controller: messageTextField,
style: TextStyle( maxLength: 300,
fontFamily: 'DMSans', style: TextStyle(
color: Colors.white.withOpacity(1), fontFamily: 'DMSans',
fontSize: 17, color: Colors.white.withOpacity(1),
fontWeight: FontWeight.w200), fontSize: 17,
expands: true, fontWeight: FontWeight.w200),
maxLines: null, expands: true,
textInputAction: TextInputAction.send, maxLines: null,
decoration: const InputDecoration( decoration: const InputDecoration(
hintStyle: TextStyle( hintStyle: TextStyle(
color: Colors.white, color: Colors.white,
),
border: InputBorder.none,
hintText: "Mon message",
), ),
border: InputBorder.none,
hintText: "Mon message",
), ),
), )
), ),
), ),
const SizedBox( const SizedBox(
@ -357,8 +365,14 @@ class CardProvider extends ChangeNotifier {
); );
} }
void sendMessage(String message, String userId) { void sendMessage(String content, String idReceiver) {
dev.log(MyApp.controller.getSpots().last.userId); Message message = Message(idSender: MyApp.controller.getIdDafl(), idReceiver: idReceiver,
content: content, timestamp: DateTime.now().toString());
MyApp.controller.sendMessage(message, MyApp.controller.getIdDafl(),
idReceiver);
MyApp.controller.addUserConversation(MyApp.controller.getIdDafl(), idReceiver);
} }
void like(context) { void like(context) {
@ -623,3 +637,5 @@ Object notify(int index, context, {bool isError = true}) {
))); )));
} }
} }

@ -1,8 +1,35 @@
import 'user.dart'; import 'user.dart';
class Message { class Message {
String senderId; String idSender;
String idReceiver;
String content; String content;
String timestamp;
Message(this.senderId, this.content);
} Message({required this.idSender,
required this.idReceiver,
required this.content,
required this.timestamp
});
Map<String, dynamic> toHashMap() {
return {
'idSender': idSender,
'idReceiver': idReceiver,
'content': content,
'timestamp' : timestamp
};
}
factory Message.fromMap(Map<String, dynamic> data){
return Message(
idSender: data['idSender'],
idReceiver: data['idReceiver'],
content: data['content'],
timestamp: data['timestamp']
);
}
}

@ -39,7 +39,7 @@ class DatabaseConnexion {
try { try {
var uri = var uri =
'postgres://$_psqlUser:$_psqlPswd@$_psqlHost:5442/$_psqlDataBase'; 'postgres://$_psqlUser:$_psqlPswd@$_psqlHost:15739/$_psqlDataBase?sslmode=require';
return connect(uri); return connect(uri);
} catch (e) { } catch (e) {

@ -11,7 +11,7 @@ class DatabaseLoader implements Loader {
final connection = await DatabaseConnexion.initConnexion(); final connection = await DatabaseConnexion.initConnexion();
var queryResult = await connection var queryResult = await connection
.query( .query(
'select username from utilisateur where username = @username AND password = @password', 'select idDafl from users where idDafl = @username AND password = @password',
{'username': username, 'password': password}) {'username': username, 'password': password})
.toList() .toList()
.then((result) { .then((result) {
@ -25,7 +25,6 @@ class DatabaseLoader implements Loader {
.whenComplete(() { .whenComplete(() {
connection.close(); connection.close();
}); });
return queryResult; return queryResult;
} }
} }

@ -8,9 +8,10 @@ class DatabaseSaver implements Saver {
final connection = await DatabaseConnexion.initConnexion(); final connection = await DatabaseConnexion.initConnexion();
connection.execute( connection.execute(
'insert into utilisateur (username, password) values (@username, @password)', 'insert into users (idDafl, idSpotify, password) values (@username, 0, @password)',
{'id': '', 'username': idDafl, 'password': passw}).whenComplete(() { {'id': '', 'username': idDafl, 'password': passw}).whenComplete(() {
connection.close(); connection.close();
}); });
print('save');
} }
} }

@ -10,7 +10,7 @@ class DatabaseSearcher implements Searcher {
final connection = await DatabaseConnexion.initConnexion(); final connection = await DatabaseConnexion.initConnexion();
bool queryResult = await connection bool queryResult = await connection
.query('select * from utilisateur where username = @username', .query('select * from users where idDafl = @username',
{'username': username}) {'username': username})
.toList() .toList()
.then((rows) { .then((rows) {

@ -0,0 +1,80 @@
import 'package:dafl_project_flutter/model/message.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
class MessageDatabaseService{
// Make an unique chat ID between 2 client. Look like 'User1-User2'
String _getChatId(String idSender, String idReceiver) {
// Test to always have the same id
if (idSender.hashCode <= idReceiver.hashCode)
return '$idSender-${idReceiver}';
else
return '${idReceiver}-$idSender';
}
// Send a message from an user to an other
void sendMessage(Message message, String idSender, String idReceiver) {
String chatId = _getChatId(idSender, idReceiver);
// Get a message from a snapshot Firestore
var documentReference = FirebaseFirestore.instance
.collection('messages')
.doc(chatId)
.collection(chatId)
.doc(DateTime
.now()
.millisecondsSinceEpoch
.toString());
FirebaseFirestore.instance.runTransaction((transaction) async {
transaction.set(documentReference, message.toHashMap());
});
}
Message _getMessage(DocumentSnapshot<Map<String, dynamic>> snapshot) {
var data = snapshot.data();
if (data == null)
throw Exception("no data in database");
return Message.fromMap(data);
}
// Get a list of messages from Firestore
List<Message> _getAllMessages(QuerySnapshot<Map<String, dynamic>> snapshot) {
return snapshot.docs.map((doc) {
return _getMessage(doc);
}).toList();
}
// Get the massages from Firestore
Stream<List<Message>> getMessage(String idSender, String idReceiver) {
String chatId = _getChatId(idSender, idReceiver);
return FirebaseFirestore.instance
.collection('messages')
.doc(chatId)
.collection(chatId)
.orderBy('timestamp', descending: true)
.snapshots().map(_getAllMessages);
}
void addMessagingUser(String idSender, String idReceiver) {
// Get a message from a snapshot Firestore
var documentReference = FirebaseFirestore.instance
.collection('users')
.doc(idSender)
.collection(idSender)
.doc(DateTime
.now()
.millisecondsSinceEpoch
.toString());
Map<String, dynamic> receiver = { 'user' : idReceiver };
FirebaseFirestore.instance.runTransaction((transaction) async {
transaction.set(documentReference, receiver);
});
}
}

@ -1,3 +1,5 @@
import 'dart:developer';
import 'package:dafl_project_flutter/model/spot.dart'; import 'package:dafl_project_flutter/model/spot.dart';
import 'package:geolocator/geolocator.dart'; import 'package:geolocator/geolocator.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
@ -8,7 +10,7 @@ import '../../main.dart';
class Location { class Location {
static Future<List<Spot>> sendCurrentLocation() async { static Future<List<Spot>> sendCurrentLocation() async {
Uri uri = Uri.parse( Uri uri = Uri.parse(
"https://codefirst.iut.uca.fr/containers/php_script-dorianhodin/insertAndMakeListUser.php"); "https://codefirst.iut.uca.fr/containers/DAFLDev-php_script/insertAndMakeListUser.php");
LocationPermission permission = await Geolocator.checkPermission(); LocationPermission permission = await Geolocator.checkPermission();
if (permission == LocationPermission.denied) { if (permission == LocationPermission.denied) {
@ -29,7 +31,7 @@ class Location {
"longitude": current.longitude.toString(), "longitude": current.longitude.toString(),
"idMusic": actualSong, "idMusic": actualSong,
}); });
log("echo");
var data = jsonDecode(response.body); var data = jsonDecode(response.body);
Map<String, String> spotsData = {}; Map<String, String> spotsData = {};
List<Spot> spots = []; List<Spot> spots = [];

@ -5,28 +5,36 @@ import 'package:dafl_project_flutter/model/message.dart';
import 'dart:developer' as dev; import 'dart:developer' as dev;
class ConversationPage extends StatefulWidget { class ConversationPage extends StatefulWidget {
const ConversationPage({Key? key}) : super(key: key); String sender;
ConversationPage({Key? key, required String this.sender}) : super(key: key);
@override @override
State<ConversationPage> createState() => _ConversationPageState(); State<ConversationPage> createState() => _ConversationPageState(sender);
} }
class _ConversationPageState extends State<ConversationPage> { class _ConversationPageState extends State<ConversationPage> {
String destinataire = 'test';
List<Widget> messages = []; List<Widget> messages = [];
bool isNull = true; bool isNull = true;
final String receiver;
_ConversationPageState(this.receiver);
final messageTextField = TextEditingController(); final messageTextField = TextEditingController();
void sendMessage(String content) { void sendMessage(String content, String idSender, String idReceiver) {
Message messageToSend = Message(idSender: idSender, idReceiver: idReceiver, content: content, timestamp: DateTime.now().toString());
MyApp.controller.sendMessage(messageToSend, idSender, idReceiver);
setState(() { setState(() {
messages.add(messageWidget( messages.add(messageWidget(messageToSend));
Message(MyApp.controller.getIdDafl().toString(), content)));
}); });
} }
Widget messageWidget(Message message) { Widget messageWidget(Message message) {
if (message.senderId != MyApp.controller.getIdDafl().toString()) { if (message.idSender != MyApp.controller.getIdDafl()) {
return Align( return Align(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: Container( child: Container(
@ -116,7 +124,8 @@ class _ConversationPageState extends State<ConversationPage> {
ScrollController listScrollController = ScrollController(); ScrollController listScrollController = ScrollController();
return Scaffold( return Scaffold(
extendBodyBehindAppBar: true, extendBodyBehindAppBar: false,
extendBody: false,
resizeToAvoidBottomInset: true, resizeToAvoidBottomInset: true,
appBar: AppBar( appBar: AppBar(
elevation: 20, elevation: 20,
@ -130,13 +139,14 @@ class _ConversationPageState extends State<ConversationPage> {
width: 40, width: 40,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(40), borderRadius: BorderRadius.circular(40),
color: Colors.blue,
), ),
child: Image.asset('assets/images/DaflUser_profil.png'),
), ),
const SizedBox( const SizedBox(
width: 20, width: 20,
), ),
const Text("Max"), Text(receiver),
const Spacer(), const Spacer(),
IconButton( IconButton(
splashColor: Colors.grey.withOpacity(0.2), splashColor: Colors.grey.withOpacity(0.2),
@ -165,18 +175,34 @@ class _ConversationPageState extends State<ConversationPage> {
), ),
), ),
body: SingleChildScrollView( body: SingleChildScrollView(
child: Container( physics: const ScrollPhysics(),
color: const Color(0xFF141414), child: Container(
height: height * 0.92, color: const Color(0xFF141414),
width: double.infinity, height: height * 0.85,
child: ListView.builder( width: double.infinity,
controller: listScrollController, child: Flexible(
physics: const BouncingScrollPhysics(), child: StreamBuilder<List<Message>>(
itemCount: messages.length, stream: MyApp.controller.getMessage(MyApp.controller.getIdDafl(), receiver),
itemBuilder: (context, index) { builder: (BuildContext context,
return messages[index]; AsyncSnapshot<List<Message>> snapshot) {
})), if (snapshot.hasData) {
), List<Message> listMessage =
snapshot.data ?? List.from([]);
return ListView.builder(
padding: EdgeInsets.all(10.0),
itemCount: listMessage.length,
itemBuilder: (context, index) =>
messageWidget(listMessage[index]),
reverse: true,
controller: listScrollController,
);
} else {
return Center(child: Container());
}
},
),
))),
bottomSheet: BottomAppBar( bottomSheet: BottomAppBar(
color: const Color(0xFF141414), color: const Color(0xFF141414),
child: Row( child: Row(
@ -186,7 +212,7 @@ class _ConversationPageState extends State<ConversationPage> {
Container( Container(
height: height * 0.08, height: height * 0.08,
color: Colors.transparent, color: Colors.transparent,
width: width * 0.9, width: width * 0.8,
child: Container( child: Container(
margin: const EdgeInsets.fromLTRB(10, 10, 10, 10), margin: const EdgeInsets.fromLTRB(10, 10, 10, 10),
decoration: BoxDecoration( decoration: BoxDecoration(
@ -204,7 +230,7 @@ class _ConversationPageState extends State<ConversationPage> {
style: const TextStyle(color: Colors.white), style: const TextStyle(color: Colors.white),
decoration: InputDecoration( decoration: InputDecoration(
hintStyle: hintStyle:
TextStyle(color: Colors.white.withOpacity(0.7)), TextStyle(color: Colors.white.withOpacity(0.7)),
border: InputBorder.none, border: InputBorder.none,
hintText: "Votre message...", hintText: "Votre message...",
), ),
@ -218,50 +244,53 @@ class _ConversationPageState extends State<ConversationPage> {
onTap: isNull onTap: isNull
? null ? null
: () { : () {
sendMessage(messageTextField.text); sendMessage(
if (listScrollController.hasClients) { messageTextField.text,
final position = MyApp.controller.getIdDafl(),
listScrollController.position.maxScrollExtent; receiver);
listScrollController.jumpTo(position); if (listScrollController.hasClients) {
} final position =
messageTextField.clear(); listScrollController.position.minScrollExtent;
}, listScrollController.jumpTo(position);
}
messageTextField.clear();
},
child: isNull == true child: isNull == true
? const SizedBox( ? const SizedBox(
height: 1, height: 1,
width: 1, width: 1,
) )
: Container( : Container(
width: 40, width: 40,
height: 40, height: 40,
margin: const EdgeInsets.fromLTRB(0, 0, 0, 0), margin: const EdgeInsets.fromLTRB(0, 0, 0, 0),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(100), borderRadius: BorderRadius.circular(100),
gradient: const LinearGradient( gradient: const LinearGradient(
colors: [Color(0xff8e24a1), Color(0xff8163ff)], colors: [Color(0xff8e24a1), Color(0xff8163ff)],
begin: Alignment.topLeft, begin: Alignment.topLeft,
end: Alignment.bottomRight, end: Alignment.bottomRight,
)),
child: Transform.rotate(
angle: -300,
child: const Icon(
Icons.arrow_back,
size: 26,
color: Colors.white,
),
)), )),
child: Transform.rotate(
angle: -300,
child: const Icon(
Icons.arrow_back,
size: 26,
color: Colors.white,
),
)),
) )
], ],
), ),
), ),
); );
} }
final messageReportTextField = TextEditingController();
Widget buildSheet() { Widget buildSheet() {
final messageTextField = TextEditingController();
return SingleChildScrollView( return SingleChildScrollView(
padding: padding:
EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom), EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom),
child: Container( child: Container(
height: 500, height: 500,
width: double.infinity, width: double.infinity,
@ -345,7 +374,7 @@ class _ConversationPageState extends State<ConversationPage> {
borderRadius: BorderRadius.circular(15), borderRadius: BorderRadius.circular(15),
), ),
child: TextField( child: TextField(
controller: messageTextField, controller: messageReportTextField,
keyboardAppearance: Brightness.dark, keyboardAppearance: Brightness.dark,
style: TextStyle( style: TextStyle(
fontFamily: 'DMSans', fontFamily: 'DMSans',
@ -376,9 +405,9 @@ class _ConversationPageState extends State<ConversationPage> {
onPressed: () { onPressed: () {
MyApp.controller.sendEmail( MyApp.controller.sendEmail(
MyApp.controller.getIdDafl().toString(), MyApp.controller.getIdDafl().toString(),
destinataire, receiver,
currentValue, currentValue,
messageTextField.text); messageReportTextField.text);
Navigator.pop(context); Navigator.pop(context);
}, },
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
@ -463,4 +492,4 @@ class _DropdownButtonReasonState extends State<DropdownButtonReason> {
}).toList(), }).toList(),
); );
} }
} }

@ -1,4 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import '../../../main.dart'; import '../../../main.dart';
import '../../presentation/custom_icons_icons.dart'; import '../../presentation/custom_icons_icons.dart';
import './w_settings.dart'; import './w_settings.dart';
@ -36,6 +37,7 @@ class _MainPageState extends State<MainPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
SystemChrome.setEnabledSystemUIMode (SystemUiMode.immersive);
double height = MediaQuery.of(context).size.height; double height = MediaQuery.of(context).size.height;
return Scaffold( return Scaffold(
resizeToAvoidBottomInset: false, resizeToAvoidBottomInset: false,
@ -48,8 +50,8 @@ class _MainPageState extends State<MainPage> {
), ),
child: ConstrainedBox( child: ConstrainedBox(
constraints: const BoxConstraints( constraints: const BoxConstraints(
minHeight: 100, minHeight: 80,
maxHeight: 100, maxHeight: 80,
), ),
child: NavigationBar( child: NavigationBar(
animationDuration: const Duration(microseconds: 800), animationDuration: const Duration(microseconds: 800),

@ -1,7 +1,7 @@
import 'dart:collection'; import 'dart:collection';
import 'package:dafl_project_flutter/main.dart'; import 'package:dafl_project_flutter/main.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:scroll_loop_auto_scroll/scroll_loop_auto_scroll.dart';
import 'dart:developer' as dev; import 'dart:developer' as dev;
import '../../../model/music.dart'; import '../../../model/music.dart';
@ -14,6 +14,13 @@ class DiscoveryWidget extends StatefulWidget {
} }
class _DiscoveryWidgetState extends State<DiscoveryWidget> { class _DiscoveryWidgetState extends State<DiscoveryWidget> {
@override
initState() {
MyApp.controller.getDiscoveries();
super.initState();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
@ -113,12 +120,13 @@ class _DiscoveryListState extends State<DiscoveryList> {
} }
refreshList() async { refreshList() async {
await Future.delayed(const Duration(seconds: 1)); await Future.delayed(const Duration(seconds: 3));
setState(() {}); setState(() {});
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
double width = MediaQuery.of(context).size.width;
late LinkedHashMap<Music, DateTime> listDiscoveries; late LinkedHashMap<Music, DateTime> listDiscoveries;
if (MyApp.controller.getChoice()) { if (MyApp.controller.getChoice()) {
//TODO : implement sort by date //TODO : implement sort by date
@ -155,9 +163,8 @@ class _DiscoveryListState extends State<DiscoveryList> {
dev.log(listDiscoveries.keys.toList()[reversedIndex].id); dev.log(listDiscoveries.keys.toList()[reversedIndex].id);
dev.log( dev.log(
listDiscoveries.keys.toList()[reversedIndex].name); listDiscoveries.keys.toList()[reversedIndex].name);
MyApp.controller.removeFromPlaylist( MyApp.controller.deleteDiscoveries(
listDiscoveries.keys.toList()[reversedIndex].id); listDiscoveries.keys.toList()[reversedIndex]);
listDiscoveries = MyApp.controller.getDiscoveries();
return true; return true;
} }
if (direction == DismissDirection.startToEnd) { if (direction == DismissDirection.startToEnd) {
@ -218,19 +225,51 @@ class _DiscoveryListState extends State<DiscoveryList> {
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment.center, MainAxisAlignment.center,
children: [ children: [
Text( MyApp.controller
MyApp.controller .getDiscoveries()
.getDiscoveries() .keys
.keys .toList()[reversedIndex]
.toList()[reversedIndex] .name
.name, .length >
style: TextStyle( 22
fontFamily: 'DMSans', ? SizedBox(
color: width: width * 0.60,
Colors.white.withOpacity(1), child: ScrollLoopAutoScroll(
fontSize: 20, delayAfterScrollInput:
fontWeight: FontWeight.w800), Duration(seconds: 1),
), delay: Duration(seconds: 1),
child: Text(
MyApp.controller
.getDiscoveries()
.keys
.toList()[reversedIndex]
.name,
style: TextStyle(
fontSize: 20,
color: Colors.white,
fontWeight:
FontWeight.bold),
),
duration:
Duration(seconds: 100),
scrollDirection:
Axis.horizontal,
),
)
: Text(
MyApp.controller
.getDiscoveries()
.keys
.toList()[reversedIndex]
.name,
style: TextStyle(
fontFamily: 'DMSans',
color: Colors.white
.withOpacity(1),
fontSize: 20,
fontWeight:
FontWeight.w800),
),
Text( Text(
MyApp.controller MyApp.controller
.getDiscoveries() .getDiscoveries()

@ -1,3 +1,5 @@
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:dafl_project_flutter/main.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:page_transition/page_transition.dart'; import 'package:page_transition/page_transition.dart';
@ -65,7 +67,7 @@ class _MessagesWidgetState extends State<MessagesWidget> {
color: Colors.grey.withOpacity(0.4), fontSize: 15), color: Colors.grey.withOpacity(0.4), fontSize: 15),
), ),
Padding( Padding(
padding: EdgeInsets.fromLTRB(0, height * 0.01, 0, 0), padding: EdgeInsets.fromLTRB(0, height * 0.01, 0, height * 0.01),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [ children: [
@ -131,7 +133,10 @@ class _MessagesWidgetState extends State<MessagesWidget> {
} }
class MessagesButtonWidget extends StatelessWidget { class MessagesButtonWidget extends StatelessWidget {
const MessagesButtonWidget({super.key}); final String sender;
const MessagesButtonWidget({super.key, required this.sender});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -150,8 +155,7 @@ class MessagesButtonWidget extends StatelessWidget {
width: 60, width: 60,
decoration: BoxDecoration( decoration: BoxDecoration(
image: const DecorationImage( image: const DecorationImage(
image: NetworkImage( image: AssetImage('assets/images/DaflUser_profil.png'),
'https://www.goutemesdisques.com/uploads/tx_gmdchron/pi1/L_Etrange_Histoire_de_Mr_Anderson.jpg'),
fit: BoxFit.cover, fit: BoxFit.cover,
), ),
border: Border.all( border: Border.all(
@ -171,7 +175,7 @@ class MessagesButtonWidget extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text( Text(
'Max', sender,
style: TextStyle( style: TextStyle(
fontFamily: 'DMSans', fontFamily: 'DMSans',
color: Colors.white.withOpacity(1), color: Colors.white.withOpacity(1),
@ -207,17 +211,48 @@ class MessagesButtonWidget extends StatelessWidget {
} }
} }
class ListConfirmedWidget extends StatelessWidget { class ListConfirmedWidget extends StatelessWidget {
const ListConfirmedWidget({super.key}); const ListConfirmedWidget({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ListView(children: const [
MessagesButtonWidget(), return StreamBuilder<QuerySnapshot<Map<String, dynamic>>>(
MessagesButtonWidget(), stream: FirebaseFirestore.instance
MessagesButtonWidget(), .collection('users')
MessagesButtonWidget(), .doc(MyApp.controller.getIdDafl())
]); .collection(MyApp.controller.getIdDafl())
.snapshots(),
builder: (_, snapshot) {
if (snapshot.hasError) return Text('Error = ${snapshot.error}');
if (snapshot.hasData) {
final docs = snapshot.data!.docs;
return ListView.builder(
itemCount: docs.length,
itemBuilder: (context, i) {
final data = docs[i].data();
return GestureDetector(
onTap: () {
Navigator.of(context).push(PageTransition(
duration: const Duration(milliseconds: 200),
reverseDuration: const Duration(milliseconds: 200),
type: PageTransitionType.rightToLeftWithFade,
childCurrent: context.widget,
child: ConversationPage(sender : data['user'])));
},
child: MessagesButtonWidget(sender : data['user'])
);
},
);
}
return Center(child: CircularProgressIndicator());
},
);
} }
} }
@ -226,6 +261,7 @@ class ListWaitingWidget extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ListView( return ListView(
children: [ children: [
GestureDetector( GestureDetector(
@ -235,11 +271,13 @@ class ListWaitingWidget extends StatelessWidget {
reverseDuration: const Duration(milliseconds: 200), reverseDuration: const Duration(milliseconds: 200),
type: PageTransitionType.rightToLeftWithFade, type: PageTransitionType.rightToLeftWithFade,
childCurrent: context.widget, childCurrent: context.widget,
child: const ConversationPage())); child: ConversationPage(sender :'test')));
}, },
child: const MessagesButtonWidget(), child: const MessagesButtonWidget(sender : "test6"),
), ),
], ],
); );
} }
} }

@ -1,4 +1,7 @@
import 'package:scroll_loop_auto_scroll/scroll_loop_auto_scroll.dart';
import '../../../main.dart'; import '../../../main.dart';
import '../../../model/music.dart';
import './w_settings.dart'; import './w_settings.dart';
import './w_spot.dart'; import './w_spot.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -30,12 +33,14 @@ class _MainPageProfilState extends State<MainPageProfil> {
@override @override
initState() { initState() {
MyApp.controller.setCurrentMusic();
username = MyApp.controller.getIdDafl(); username = MyApp.controller.getIdDafl();
super.initState(); super.initState();
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
double width = MediaQuery.of(context).size.width;
double height = MediaQuery.of(context).size.height; double height = MediaQuery.of(context).size.height;
return Container( return Container(
color: const Color(0xFF141414), color: const Color(0xFF141414),
@ -218,125 +223,231 @@ class _MainPageProfilState extends State<MainPageProfil> {
child: riv.RiveAnimation.asset( child: riv.RiveAnimation.asset(
'assets/images/playing_animation.riv'))) 'assets/images/playing_animation.riv')))
]), ]),
Container( FutureBuilder(
margin: const EdgeInsets.fromLTRB(0, 10, 0, 0), future: MyApp.controller.getCompleteMusic(
height: height * 0.14, MyApp.controller.getCurrentMusic().id),
decoration: BoxDecoration( builder: (BuildContext context,
borderRadius: BorderRadius.circular(15.0), AsyncSnapshot<Music> snapshot) {
color: const Color(0xFFD9D9D9).withOpacity(0.08), print(snapshot.connectionState);
), if (snapshot.connectionState ==
child: Row( ConnectionState.waiting) {
mainAxisAlignment: MainAxisAlignment.start, return Container(
crossAxisAlignment: CrossAxisAlignment.center, margin:
children: [ const EdgeInsets.fromLTRB(0, 10, 0, 0),
Container( height: height * 0.14,
margin: const EdgeInsets.fromLTRB( decoration: BoxDecoration(
15, 0, 0, 0), borderRadius: BorderRadius.circular(15.0),
child: ClipRRect( color: const Color(0xFFD9D9D9)
borderRadius: .withOpacity(0.08),
BorderRadius.circular(15), ),
child: FadeInImage.assetNetwork( child: Row(
height: 90, mainAxisAlignment: MainAxisAlignment.start,
width: 90, crossAxisAlignment:
placeholder: CrossAxisAlignment.center,
children: [
Container(
margin: const EdgeInsets.fromLTRB(
15, 0, 0, 0),
child: ClipRRect(
borderRadius:
BorderRadius.circular(10),
child: Image.asset(
"assets/images/loadingPlaceholder.gif", "assets/images/loadingPlaceholder.gif",
image: MyApp.controller height: 90,
.getCurrentMusic() width: 90))),
.linkCover))), Container(
Container( margin: const EdgeInsets.fromLTRB(
margin: const EdgeInsets.fromLTRB( 12, 20, 0, 0),
12, 20, 0, 0), child: Column(
child: Column(
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment.start, MainAxisAlignment.start,
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment.start,
children: [ children: [
Text( Container(
MyApp.controller width: 150,
.getCurrentMusic() height: 20,
.name, decoration: BoxDecoration(
style: const TextStyle( borderRadius:
fontSize: 18, BorderRadius.circular(5.0),
fontWeight: FontWeight.w500, color: Colors.grey
color: Colors.white), .withOpacity(0.7),
),
),
SizedBox(
height: 10,
), ),
Text( Container(
MyApp.controller width: 100,
.getCurrentMusic() height: 20,
.artist, decoration: BoxDecoration(
style: const TextStyle( borderRadius:
fontSize: 16, BorderRadius.circular(5.0),
fontWeight: FontWeight.w400, color: Colors.grey
color: Colors.grey)) .withOpacity(0.4),
])), ),
const Spacer(), ),
Container( ],
height: 55, ),
width: double.infinity, )
],
),
);
} else if (snapshot.connectionState ==
ConnectionState.done) {
if (snapshot.hasError) {
return const Text('Error');
} else if (snapshot.hasData) {
return Container(
margin: const EdgeInsets.fromLTRB(
0, 10, 0, 0),
height: height * 0.14,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: borderRadius:
BorderRadius.circular(10.0), BorderRadius.circular(15.0),
color: Colors.transparent, color: const Color(0xFFD9D9D9)
.withOpacity(0.08),
), ),
margin: const EdgeInsets.fromLTRB( child: Row(
30, 0, 30, 0), mainAxisAlignment:
child: SizedBox( MainAxisAlignment.start,
height: 55, crossAxisAlignment:
width: double.infinity, CrossAxisAlignment.center,
child: ElevatedButton( children: [
style: ElevatedButton.styleFrom( Container(
backgroundColor: margin:
const Color(0xFFD9D9D9) const EdgeInsets.fromLTRB(
.withOpacity(0.08), 15, 0, 0, 0),
shape: RoundedRectangleBorder( child: ClipRRect(
borderRadius: borderRadius:
BorderRadius.circular( BorderRadius.circular(
10.0), 15),
), // background// foreground child: FadeInImage.assetNetwork(
height: 90,
width: 90,
placeholder:
"assets/images/loadingPlaceholder.gif",
image: snapshot
.data!.linkCover))),
Container(
margin: const EdgeInsets.fromLTRB(
12, 20, 0, 0),
child: Column(
mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
snapshot.data!.name.length >
22
? SizedBox(
width: width*0.5,
child:
ScrollLoopAutoScroll(
delayAfterScrollInput:
Duration(
seconds: 1),
delay: Duration(
seconds: 1),
child: Text(
snapshot
.data!.name,
style: TextStyle(
fontSize: 20,
color: Colors
.white,
fontWeight:
FontWeight
.bold),
),
duration: Duration(
seconds: 100),
scrollDirection:
Axis.horizontal,
),
)
: Text(
snapshot.data!.name,
style: TextStyle(
fontSize: 20,
color:
Colors.white,
fontWeight:
FontWeight
.bold),
),
Text(
snapshot.data!.artist,
style: const TextStyle(
fontSize: 16,
fontWeight:
FontWeight.w400,
color: Colors.grey),
),
],
), ),
onPressed: () { )
Navigator.push( ]));
context, } else {
MaterialPageRoute( return const Text('Empty data');
builder: (context) => }
const SettingsWidget())) } else {
.then( return Text(
(value) => setState(() { 'State: ${snapshot.connectionState}');
username = MyApp }
.controller }),
.getIdDafl() ])),
.toString(); const Spacer(),
})); Container(
}, height: 55,
child: Row(children: [ width: double.infinity,
const Icon( decoration: BoxDecoration(
Icons.settings, borderRadius: BorderRadius.circular(10.0),
color: Colors.white, color: Colors.transparent,
size: 30, ),
), margin: const EdgeInsets.fromLTRB(30, 0, 30, 0),
const SizedBox( child: SizedBox(
width: 12, height: 55,
), width: double.infinity,
const Text( child: ElevatedButton(
"Paramètres", style: ElevatedButton.styleFrom(
style: TextStyle( backgroundColor:
color: Colors.white, const Color(0xFFD9D9D9).withOpacity(0.08),
fontSize: 17, shape: RoundedRectangleBorder(
fontWeight: borderRadius: BorderRadius.circular(10.0),
FontWeight.w400), ), // background// foreground
textAlign: TextAlign.center, ),
), onPressed: () {
const Spacer(), Navigator.push(
Icon( context,
Icons.arrow_forward_ios, MaterialPageRoute(
color: Colors.white builder: (context) =>
.withOpacity(0.3), const SettingsWidget()));
) },
])))), child: Row(children: [
const Spacer() const Icon(
])) Icons.settings,
])) color: Colors.white,
size: 30,
),
const SizedBox(
width: 12,
),
const Text(
"Paramètres",
style: TextStyle(
color: Colors.white,
fontSize: 17,
fontWeight: FontWeight.w400),
textAlign: TextAlign.center,
),
const Spacer(),
Icon(
Icons.arrow_forward_ios,
color: Colors.white.withOpacity(0.3),
)
])))),
const Spacer()
]))); ])));
} }
} }

@ -16,6 +16,8 @@ class SpotsWidget extends StatefulWidget {
} }
class _SpotsWidgetState extends State<SpotsWidget> { class _SpotsWidgetState extends State<SpotsWidget> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
double height = MediaQuery.of(context).size.height; double height = MediaQuery.of(context).size.height;
@ -233,8 +235,8 @@ class _SpotsWidgetState extends State<SpotsWidget> {
child: SizedBox( child: SizedBox(
height: 40, height: 40,
child: MyApp.controller.getSpots().isEmpty child: MyApp.controller.getSpots().isEmpty
? Image.asset("assets/images/play_spotify_button.png") ? Container()
: Container(), : Image.asset("assets/images/play_spotify_button.png"),
), ),
)) ))
], ],

@ -196,26 +196,8 @@ class _SignUpPageState extends State<SignUpPage> {
padding: const EdgeInsets.fromLTRB(45, 10, 45, 0), padding: const EdgeInsets.fromLTRB(45, 10, 45, 0),
child: Stack( child: Stack(
children: [ children: [
Container(
height: 43,
decoration: BoxDecoration(
color: const Color(0xFF24CF5F),
borderRadius:
const BorderRadius.all(Radius.circular(50)),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.3),
spreadRadius: 5,
blurRadius: 7,
offset: const Offset(
0, 3), // changes position of shadow
),
],
),
),
SizedBox( SizedBox(
height: 43, height: 43,
width: width * 0.75,
child: ElevatedButton( child: ElevatedButton(
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFF24CF5F), backgroundColor: const Color(0xFF24CF5F),
@ -336,15 +318,16 @@ class _SignUpPageState extends State<SignUpPage> {
} else if (!await MyApp.controller.searchUser(username)) { } else if (!await MyApp.controller.searchUser(username)) {
notify(0, context); notify(0, context);
} }
if (password == "" || confirmPassword == "") { else if (password == "" || confirmPassword == "") {
notify(4, context); notify(4, context);
} else if (password.length < 8) { } else if (password.length < 8) {
notify(3, context); notify(3, context);
} else if (password != confirmPassword) { } else if (password != confirmPassword) {
notify(1, context); notify(1, context);
} else { } else {
MyApp.controller.save(username, password);
// create user in database // create user in database
print("success");
Navigator.of(context).push( Navigator.of(context).push(
PageTransition( PageTransition(
duration: const Duration(milliseconds: 300), duration: const Duration(milliseconds: 300),
@ -354,5 +337,5 @@ class _SignUpPageState extends State<SignUpPage> {
child: const HomePage()), child: const HomePage()),
); );
} }
}
} }
}

@ -1,6 +1,13 @@
# Generated by pub # Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile # See https://dart.dev/tools/pub/glossary#lockfile
packages: packages:
_flutterfire_internals:
dependency: transitive
description:
name: _flutterfire_internals
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.12"
animations: animations:
dependency: "direct main" dependency: "direct main"
description: description:
@ -71,6 +78,27 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.1" version: "1.1.1"
cloud_firestore:
dependency: "direct main"
description:
name: cloud_firestore
url: "https://pub.dartlang.org"
source: hosted
version: "4.3.1"
cloud_firestore_platform_interface:
dependency: transitive
description:
name: cloud_firestore_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "5.10.1"
cloud_firestore_web:
dependency: transitive
description:
name: cloud_firestore_web
url: "https://pub.dartlang.org"
source: hosted
version: "3.2.1"
collection: collection:
dependency: transitive dependency: transitive
description: description:
@ -134,6 +162,48 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "6.1.4" version: "6.1.4"
firebase_core:
dependency: "direct main"
description:
name: firebase_core
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.1"
firebase_core_platform_interface:
dependency: transitive
description:
name: firebase_core_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "4.5.2"
firebase_core_web:
dependency: transitive
description:
name: firebase_core_web
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
firebase_messaging:
dependency: "direct main"
description:
name: firebase_messaging
url: "https://pub.dartlang.org"
source: hosted
version: "14.2.1"
firebase_messaging_platform_interface:
dependency: transitive
description:
name: firebase_messaging_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "4.2.10"
firebase_messaging_web:
dependency: transitive
description:
name: firebase_messaging_web
url: "https://pub.dartlang.org"
source: hosted
version: "3.2.11"
flutter: flutter:
dependency: "direct main" dependency: "direct main"
description: flutter description: flutter

@ -32,6 +32,9 @@ dependencies:
marquee: ^2.2.3 marquee: ^2.2.3
text_scroll: ^0.1.1 text_scroll: ^0.1.1
scroll_loop_auto_scroll: ^0.0.2 scroll_loop_auto_scroll: ^0.0.2
firebase_core: ^2.4.1
firebase_messaging: ^14.1.1
cloud_firestore: ^4.1.0
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:

@ -1,9 +1,3 @@
DROP TABLE IF EXISTS Musique;
DROP TABLE IF EXISTS Matchs;
DROP TABLE IF EXISTS LikeDafl;
DROP TABLE IF EXISTS UserDafl;
CREATE TABLE UserDafl( CREATE TABLE UserDafl(
idDafl INT PRIMARY KEY, idDafl INT PRIMARY KEY,
pseudo varchar(50) NOT NULL, pseudo varchar(50) NOT NULL,
@ -12,7 +6,7 @@ CREATE TABLE UserDafl(
); );
CREATE TABLE Musique( CREATE TABLE Musique(
idUser INT REFERENCES UserDafl(idDafl), idUser INT REFERENCES User(idDafl),
idMusic INT, idMusic INT,
title varchar(50) NOT NULL, title varchar(50) NOT NULL,
artist varchar(50) NOT NULL, artist varchar(50) NOT NULL,
@ -22,29 +16,29 @@ CREATE TABLE Musique(
); );
CREATE TABLE Matchs( CREATE TABLE Matchs(
idUserA INT REFERENCES UserDafl(idDafl), idUserA INT REFERENCES User(idDafl),
idUserB INT REFERENCES UserDafl(idDafl), idUserB INT REFERENCES User(idDafl),
dateMatch date NOT NULL, dateMatch date NOT NULL,
PRIMARY KEY(idUserA,idUserB) PRIMARY KEY(idUserA,idUserB)
); );
CREATE TABLE LikeDafl( CREATE TABLE LikeDafl(
idUserWhoLike INT REFERENCES UserDafl(idDafl), idUserWhoLike INT REFERENCES User(idDafl),
idUserWhoGetLike INT REFERENCES UserDafl(idDafl), idUserWhoGetLike INT REFERENCES User(idDafl),
dateLike date NOT NULL, dateLike date NOT NULL,
PRIMARY KEY(idUserWhoLike,idUserWhoGetLike) PRIMARY KEY(idUserWhoLike,idUserWhoGetLike)
); );
CREATE TABLE MessageDafl( CREATE TABLE MessageDafl(
senderID INT NOT NULL REFERENCES UserDafl(idDafl) , senderID INT NOT NULL REFERENCES User(idDafl) ,
idMessage INT PRIMARY KEY, idMessage INT PRIMARY KEY,
content varchar(500), content varchar(500),
dateMess date NOT NULL dateMess date NOT NULL
); );
CREATE TABLE ConversationDafl( CREATE TABLE ConversationDafl(
idUserA INT NOT NULL REFERENCES UserDafl(idDafl), idUserA INT NOT NULL REFERENCES User(idDafl),
idUserB INT NOT NULL REFERENCES UserDafl(idDafl), idUserB INT NOT NULL REFERENCES User(idDafl),
idConversation INT PRIMARY KEY, idConversation INT PRIMARY KEY,
waiting BOOLEAN NOT NULL CHECK (waiting=1 OR waiting=0) waiting BOOLEAN NOT NULL CHECK (waiting=1 OR waiting=0)
); );

@ -17,4 +17,7 @@ function connection(): bool|int|mysqli
return -1; //Send a return code as -1, so insertAndMakeListUser.php can know if the connection is successful return -1; //Send a return code as -1, so insertAndMakeListUser.php can know if the connection is successful
} }
} }

@ -33,7 +33,7 @@ function insertUserAndReturnList(): array|int
latitude double NOT NULL, latitude double NOT NULL,
longitude double NOT NULL, longitude double NOT NULL,
idMusic varchar(100) NOT NULL, idMusic varchar(100) NOT NULL,
dateLog date NOT NULL dateLog datetime NOT NULL
);"; );";
mysqli_query($res, $query); mysqli_query($res, $query);

Loading…
Cancel
Save