Compare commits

..

11 Commits

Author SHA1 Message Date
Dorian HODIN 2d20012fc3 Mise à jour de 'README.md'
continuous-integration/drone/push Build is passing Details
2 years ago
Marc CHEVALDONNE 5d51df9ca9 Mise à jour de 'README.md'
continuous-integration/drone/push Build is passing Details
2 years ago
dorian.hodin dfb73d42ff Try to push to deploy containers
2 years ago
Dorian HODIN 41d1e8dbb3 Mise à jour de 'Sources/php_script/script/config.php'
continuous-integration/drone/push Build is passing Details
2 years ago
Dorian HODIN ab1c306f5b Mise à jour de 'Sources/php_script/script/config.php'
continuous-integration/drone/push Build is passing Details
2 years ago
Dorian HODIN da7fb93d90 Mise à jour de 'Sources/php_script/script/config.php'
continuous-integration/drone/push Build was killed Details
2 years ago
Dorian HODIN 56e5cd28a4 Mise à jour de 'Sources/php_script/script/config.php'
continuous-integration/drone/push Build was killed Details
2 years ago
Dorian HODIN 24771535f9 Mise à jour de 'Sources/php_script/script/config.php'
continuous-integration/drone/push Build was killed Details
2 years ago
Dorian HODIN 52ec509b3d Mise à jour de 'Sources/php_script/script/config.php'
continuous-integration/drone/push Build was killed Details
2 years ago
Audric SABATIER a063418d88 Mise à jour de 'Sources/db_script/sql/create.sql'
continuous-integration/drone/push Build is passing Details
2 years ago
Audric SABATIER f3c678c23f Mise à jour de 'Sources/db_script/sql/create.sql'
continuous-integration/drone/push Build is passing Details
2 years ago

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

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

@ -56,3 +56,6 @@ tous les utilisateurs.
révéler quelques informations personnelles (nom, âge, sexe).
Le but est qu'une mise en contact entre 2 personnes se base uniquement
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.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 18 KiB

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

@ -10,46 +10,23 @@ import '../services/api/api_spotify.dart';
import '../services/database/database_service.dart';
import '../services/position/location.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 {
final ApiSpotify _api = ApiSpotify();
late User _currentUser;
final DataBaseService _dataBaseService = DataBaseService();
final LiveData _data = LiveData();
final MessageDatabaseService _messageAccess = MessageDatabaseService();
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 {
await setCurrentMusic();
await setDiscoveries();
}
beginRoutine() {
Timer.periodic(const Duration(seconds: 20), (Timer t) => setSpots());
beginRoutine() async {
await setSpots();
Timer.periodic(const Duration(seconds: 10), (Timer t) => setSpots());
}
//
@ -71,23 +48,14 @@ class Controller {
await getCompleteMusic(await _api.requests.getCurrentlyPlayingTrack());
}
List<Spot> getSpots() {
return _data.spots;
}
List<Spot> getSpots() => _data.spots;
setSpots() async {
print('setspot');
_data.spots = await Location.sendCurrentLocation();
}
LinkedHashMap<Music, DateTime> getDiscoveries() => _data.discoveries;
void deleteDiscoveries(Music key) {
_data.discoveries.remove(key);
removeFromPlaylist(key.id);
}
setDiscoveries() async {
LinkedHashMap<String, DateTime> tmpData =
await _api.requests.getPlaylistTracks();
@ -125,10 +93,8 @@ class Controller {
_api.requests.removeFromPlaylist(id);
}
addToPlaylist(String id) async {
addToPlaylist(String id) {
_api.requests.addToPlaylist(id);
Music music = await getCompleteMusic(id);
_data.discoveries.addAll({music: DateTime.now()});
}
playTrack(String id) {
@ -147,7 +113,6 @@ class Controller {
return false;
}
_currentUser = newUser;
_currentUser.idSpotify = await _api.requests.getIdUser();
return true;
}

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

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

@ -1,35 +1,8 @@
import 'user.dart';
class Message {
String idSender;
String idReceiver;
String senderId;
String content;
String timestamp;
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']
);
}
Message(this.senderId, this.content);
}

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

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

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

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

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

@ -5,36 +5,28 @@ import 'package:dafl_project_flutter/model/message.dart';
import 'dart:developer' as dev;
class ConversationPage extends StatefulWidget {
String sender;
ConversationPage({Key? key, required String this.sender}) : super(key: key);
const ConversationPage({Key? key}) : super(key: key);
@override
State<ConversationPage> createState() => _ConversationPageState(sender);
State<ConversationPage> createState() => _ConversationPageState();
}
class _ConversationPageState extends State<ConversationPage> {
String destinataire = 'test';
List<Widget> messages = [];
bool isNull = true;
final String receiver;
_ConversationPageState(this.receiver);
final messageTextField = TextEditingController();
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);
void sendMessage(String content) {
setState(() {
messages.add(messageWidget(messageToSend));
messages.add(messageWidget(
Message(MyApp.controller.getIdDafl().toString(), content)));
});
}
Widget messageWidget(Message message) {
if (message.idSender != MyApp.controller.getIdDafl()) {
if (message.senderId != MyApp.controller.getIdDafl().toString()) {
return Align(
alignment: Alignment.centerLeft,
child: Container(
@ -124,8 +116,7 @@ class _ConversationPageState extends State<ConversationPage> {
ScrollController listScrollController = ScrollController();
return Scaffold(
extendBodyBehindAppBar: false,
extendBody: false,
extendBodyBehindAppBar: true,
resizeToAvoidBottomInset: true,
appBar: AppBar(
elevation: 20,
@ -139,14 +130,13 @@ class _ConversationPageState extends State<ConversationPage> {
width: 40,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(40),
color: Colors.blue,
),
child: Image.asset('assets/images/DaflUser_profil.png'),
),
const SizedBox(
width: 20,
),
Text(receiver),
const Text("Max"),
const Spacer(),
IconButton(
splashColor: Colors.grey.withOpacity(0.2),
@ -175,34 +165,18 @@ class _ConversationPageState extends State<ConversationPage> {
),
),
body: SingleChildScrollView(
physics: const ScrollPhysics(),
child: Container(
color: const Color(0xFF141414),
height: height * 0.85,
height: height * 0.92,
width: double.infinity,
child: Flexible(
child: StreamBuilder<List<Message>>(
stream: MyApp.controller.getMessage(MyApp.controller.getIdDafl(), receiver),
builder: (BuildContext context,
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,
child: ListView.builder(
controller: listScrollController,
);
} else {
return Center(child: Container());
}
},
physics: const BouncingScrollPhysics(),
itemCount: messages.length,
itemBuilder: (context, index) {
return messages[index];
})),
),
))),
bottomSheet: BottomAppBar(
color: const Color(0xFF141414),
child: Row(
@ -212,7 +186,7 @@ class _ConversationPageState extends State<ConversationPage> {
Container(
height: height * 0.08,
color: Colors.transparent,
width: width * 0.8,
width: width * 0.9,
child: Container(
margin: const EdgeInsets.fromLTRB(10, 10, 10, 10),
decoration: BoxDecoration(
@ -244,13 +218,10 @@ class _ConversationPageState extends State<ConversationPage> {
onTap: isNull
? null
: () {
sendMessage(
messageTextField.text,
MyApp.controller.getIdDafl(),
receiver);
sendMessage(messageTextField.text);
if (listScrollController.hasClients) {
final position =
listScrollController.position.minScrollExtent;
listScrollController.position.maxScrollExtent;
listScrollController.jumpTo(position);
}
messageTextField.clear();
@ -285,9 +256,9 @@ class _ConversationPageState extends State<ConversationPage> {
),
);
}
final messageReportTextField = TextEditingController();
Widget buildSheet() {
Widget buildSheet() {
final messageTextField = TextEditingController();
return SingleChildScrollView(
padding:
EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom),
@ -374,7 +345,7 @@ class _ConversationPageState extends State<ConversationPage> {
borderRadius: BorderRadius.circular(15),
),
child: TextField(
controller: messageReportTextField,
controller: messageTextField,
keyboardAppearance: Brightness.dark,
style: TextStyle(
fontFamily: 'DMSans',
@ -405,9 +376,9 @@ class _ConversationPageState extends State<ConversationPage> {
onPressed: () {
MyApp.controller.sendEmail(
MyApp.controller.getIdDafl().toString(),
receiver,
destinataire,
currentValue,
messageReportTextField.text);
messageTextField.text);
Navigator.pop(context);
},
style: ElevatedButton.styleFrom(

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

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

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

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

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

@ -196,8 +196,26 @@ class _SignUpPageState extends State<SignUpPage> {
padding: const EdgeInsets.fromLTRB(45, 10, 45, 0),
child: Stack(
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(
height: 43,
width: width * 0.75,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFF24CF5F),
@ -318,16 +336,15 @@ class _SignUpPageState extends State<SignUpPage> {
} else if (!await MyApp.controller.searchUser(username)) {
notify(0, context);
}
else if (password == "" || confirmPassword == "") {
if (password == "" || confirmPassword == "") {
notify(4, context);
} else if (password.length < 8) {
notify(3, context);
} else if (password != confirmPassword) {
notify(1, context);
} else {
MyApp.controller.save(username, password);
// create user in database
print("success");
Navigator.of(context).push(
PageTransition(
duration: const Duration(milliseconds: 300),
@ -338,4 +355,4 @@ class _SignUpPageState extends State<SignUpPage> {
);
}
}
}
}

@ -1,13 +1,6 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
_flutterfire_internals:
dependency: transitive
description:
name: _flutterfire_internals
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.12"
animations:
dependency: "direct main"
description:
@ -78,27 +71,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
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:
dependency: transitive
description:
@ -162,48 +134,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
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:
dependency: "direct main"
description: flutter

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

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

@ -18,6 +18,3 @@ function connection(): bool|int|mysqli
}
}

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

Loading…
Cancel
Save