Compare commits

...

11 Commits

Author SHA1 Message Date
Rayhân HASSOU 3fb79fcb30 Mise à jour de 'README.md'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 28d58c398a Mise à jour de 'README.md'
continuous-integration/drone/push Build is passing Details
1 year ago
Rayhân HASSOU a2eb549ba2 Merge pull request 'CORRECT_GRAMMARY' (#73) from CORRECT_GRAMMARY into master
continuous-integration/drone/push Build is passing Details
1 year ago
Rayhân HASSOU b08b5434ac Mise à jour de 'Sources/justMUSIC/lib/screens/login_screen.dart'
continuous-integration/drone/push Build is passing Details
1 year ago
Rayhân HASSOU 210e4e4d4e Mise à jour de 'Sources/justMUSIC/lib/screens/welcome_screen.dart'
continuous-integration/drone/push Build is passing Details
1 year ago
Emre KARTAL 67c734aaf3 Correct historic capsules 🐛
continuous-integration/drone/push Build is passing Details
1 year ago
Emre KARTAL efc86170a8 change class name
continuous-integration/drone/push Build is passing Details
1 year ago
Emre KARTAL 7699c1b883 add Capsule collection
continuous-integration/drone/push Build is passing Details
1 year ago
Emre KARTAL 9db264c0d1 Mise à jour de 'Sources/justMUSIC/lib/screens/forget_password_screen.dart'
continuous-integration/drone/push Build is passing Details
1 year ago
Emre KARTAL db866e7955 Transférer les fichiers vers 'Documentation/Diagrammes'
continuous-integration/drone/push Build is passing Details
1 year ago
Emre KARTAL d4eaefc03c Update README.md
continuous-integration/drone/push Build is passing Details
1 year ago

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 844 KiB

@ -39,9 +39,9 @@ C'est un réseau social donc l'utilisateur pourra publier et commenter des posts
La racine de notre gitlab est composé de deux dossier essentielles au projet: La racine de notre gitlab est composé de deux dossier essentielles au projet:
[**src**](src) : **Code de l'application** [**Sources**](Sources) : **Code de l'application**
[**doc**](doc) : **Regroupe l'entièreté de la documentation** [**Documentation**](Documentation) : **Regroupe l'entièreté de la documentation**
</br> </br>
@ -49,10 +49,33 @@ La racine de notre gitlab est composé de deux dossier essentielles au projet:
## Fonctionnement ## Fonctionnement
<div align = center>
<img src="Documentation/Images/Overview.png" />
</div>
### Feeds
Une fois authentifié vous aurez la possibilité de voir les posts capsules de vos amis, de voir les musiques qu'ils mettent en avant accompagner éventuellement d'une image, d'une description, de leurs localisations... (Vous n'avez pas d'amis, pas de soucis, cliquer seulement sur l'icon en haut a gauche de la page pour suivre nimporte quel personne que vous voulez), Mais aussi juste d'un simple mouvement du doigt swiper pour vous retrouvez sur la page Discovery où vous verrais les posts récents en tendance dans le monde 🌎
Amuser vous à cliquer sur les posts pour ecouter la music mais aussi connaître les détails et savoir qui a commenter 💬 et liker ❤️. Si la musique vous plaît enregistrer la et vous la retrouverez lorsque vous aurez envie de poster.
### Post
Pour participer à cette aventure musicale avec des gens du monde entier, cliquez simplement sur l'icône JustMusic. Gardez à l'esprit que vous ne pourrez poster qu'une fois par jour, donc réfléchissez bien à la musique que vous souhaitez mettre en avant. N'hésitez pas à ajouter une photo et une description pour rendre votre publication plus chaleureuse 😃.
### Profil
Consultez l'aperçu de votre profil pour savoir combien de personnes vous suivent et que vous suivez. Vous pouvez également voir le nombre de capsules que vous avez publiées, personnaliser les paramètres de votre compte selon vos préférences, et explorez votre historique de capsules pour vous remémorer vos précédentes publications 🎧.
#### Bonne aventure musicale 🎵🌟
## Deploiement ## Deploiement
- [x] &nbsp; ![IOS](https://img.shields.io/badge/IOS-000?style=for-the-badge&logo=apple&logoColor=black&color=white) - [x] &nbsp; ![IOS](https://img.shields.io/badge/IOS-000?style=for-the-badge&logo=apple&logoColor=black&color=white)
- [x] &nbsp; ![Android](https://img.shields.io/badge/Android-000?style=for-the-badge&logo=android&logoColor=white&color=green) - [x] &nbsp; ![Android](https://img.shields.io/badge/Android-000?style=for-the-badge&logo=android&logoColor=white&color=green)
- [x] &nbsp; ![Safari](https://img.shields.io/badge/Safari-000000.svg?style=for-the-badge&logo=Safari&logoColor=white)
## Techniciens ## Techniciens
@ -64,7 +87,7 @@ La racine de notre gitlab est composé de deux dossier essentielles au projet:
<img src ="https://codefirst.iut.uca.fr/git/avatars/1ff65c9c5ab0e8c8883fb48adbcf972f?size=870" height="50px"> <img src ="https://codefirst.iut.uca.fr/git/avatars/1ff65c9c5ab0e8c8883fb48adbcf972f?size=870" height="50px">
</a> </a>
<a href = "https://codefirst.iut.uca.fr/git/david.d_almeida"> <a href = "https://codefirst.iut.uca.fr/git/david.d_almeida">
<img src ="https://codefirst.iut.uca.fr/git/avatars/0f8eaaad1e26d3de644ca522eccaea7c?size=870" height="50px"> <img src ="https://codefirst.iut.uca.fr/git/avatars/a16fa2dc52ceae18d8923c91121caa66?size=870" height="50px">
</a> </a>
<a href = "https://codefirst.iut.uca.fr/git/rayhan.hassou"> <a href = "https://codefirst.iut.uca.fr/git/rayhan.hassou">
<img src ="https://codefirst.iut.uca.fr/git/avatars/84062b2bb326d9e9154a9859b375e599?size=870" height="50px"> <img src ="https://codefirst.iut.uca.fr/git/avatars/84062b2bb326d9e9154a9859b375e599?size=870" height="50px">

@ -0,0 +1,34 @@
import 'package:tuple/tuple.dart';
import 'Music.dart';
class Capsule {
final String _id;
late Music _music;
Tuple2<String?,String?> _location;
DateTime _date;
// Constructor
Capsule(this._id, this._location, this._date);
//Getters and setters
String get id => _id;
Music get music => _music;
set music(Music value) {
_music = value;
}
Tuple2<String?, String?> get location => _location;
set location(Tuple2<String?, String?> value) {
_location = value;
}
DateTime get date => _date;
set date(DateTime value) {
_date = value;
}
}

@ -52,9 +52,9 @@ class _ForgetPasswordScreenState extends State<ForgetPasswordScreen> {
setState(() => canResendEmail = true); setState(() => canResendEmail = true);
} on FirebaseAuthException catch (e) { } on FirebaseAuthException catch (e) {
if (e.code == "invalid-email") { if (e.code == "invalid-email") {
error = "Mail incorrect";
} else if (e.code == "user-not-found") {
error = "Format de mail incorrect"; error = "Format de mail incorrect";
} else if (e.code == "user-not-found") {
error = "Mail incorrect";
} else if (e.code == "too-many-requests") { } else if (e.code == "too-many-requests") {
error = error =
"Trop de tentatives. Veuillez réessayer plus tard"; "Trop de tentatives. Veuillez réessayer plus tard";

@ -85,7 +85,7 @@ class _LoginScreenState extends State<LoginScreen> {
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: [ children: [
Text( Text(
"Te revoilà!", "Te revoilà !",
style: GoogleFonts.plusJakartaSans( style: GoogleFonts.plusJakartaSans(
color: Colors.white, fontWeight: FontWeight.w600, fontSize: 38.h), color: Colors.white, fontWeight: FontWeight.w600, fontSize: 38.h),
), ),
@ -95,7 +95,7 @@ class _LoginScreenState extends State<LoginScreen> {
SizedBox( SizedBox(
width: 230.w, width: 230.w,
child: Text( child: Text(
"Bon retour parmis nous tu nous as manqué!", "Bon retour parmis nous. Tu nous as manqué !",
style: GoogleFonts.plusJakartaSans( style: GoogleFonts.plusJakartaSans(
color: Colors.white, fontWeight: FontWeight.w400, fontSize: 20.h), color: Colors.white, fontWeight: FontWeight.w400, fontSize: 20.h),
textAlign: TextAlign.center, textAlign: TextAlign.center,
@ -116,7 +116,7 @@ class _LoginScreenState extends State<LoginScreen> {
keyboardAppearance: Brightness.dark, keyboardAppearance: Brightness.dark,
validator: (value) { validator: (value) {
if (value == null || value.isEmpty) { if (value == null || value.isEmpty) {
return 'entrez un email valide'; return 'Entrez un email valide';
} }
return null; return null;
}, },
@ -148,7 +148,7 @@ class _LoginScreenState extends State<LoginScreen> {
obscureText: passenable, obscureText: passenable,
validator: (value) { validator: (value) {
if (value == null || value.isEmpty) { if (value == null || value.isEmpty) {
return 'entrez un mot de passe valide'; return 'Entrez un mot de passe valide';
} }
return null; return null;
}, },
@ -202,7 +202,7 @@ class _LoginScreenState extends State<LoginScreen> {
child: Padding( child: Padding(
padding: EdgeInsets.only(top: 10), padding: EdgeInsets.only(top: 10),
child: Text( child: Text(
"Mot de passe oublié?", "Mot de passe oublié ?",
style: GoogleFonts.plusJakartaSans(color: Colors.white), style: GoogleFonts.plusJakartaSans(color: Colors.white),
), ),
)), )),
@ -226,14 +226,14 @@ class _LoginScreenState extends State<LoginScreen> {
child: RichText( child: RichText(
textAlign: TextAlign.center, textAlign: TextAlign.center,
text: TextSpan( text: TextSpan(
text: 'Pas encore inscrit?', text: 'Pas encore inscrit ?',
style: GoogleFonts.plusJakartaSans( style: GoogleFonts.plusJakartaSans(
color: Colors.white, color: Colors.white,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
fontSize: 15), fontSize: 15),
children: <TextSpan>[ children: <TextSpan>[
TextSpan( TextSpan(
text: " Sinscire", text: " Sinscrire",
style: GoogleFonts.plusJakartaSans( style: GoogleFonts.plusJakartaSans(
fontSize: 15, fontSize: 15,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,

@ -78,7 +78,7 @@ class WellcomeScreen extends StatelessWidget {
child: Padding( child: Padding(
padding: const EdgeInsets.all(3.0), padding: const EdgeInsets.all(3.0),
child: Text( child: Text(
"Tu as déja un compte? Connexion", "Tu as déja un compte ? Connexion",
style: GoogleFonts.plusJakartaSans( style: GoogleFonts.plusJakartaSans(
color: Colors.white, color: Colors.white,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,

@ -0,0 +1,33 @@
import 'package:cloud_firestore/cloud_firestore.dart';
class CapsuleService {
Future<List<bool>> recapSevenDays(String id) async {
List<bool> recapList = [];
DateTime sevenDaysAgo = DateTime.now().subtract(Duration(days: 6));
QuerySnapshot<Map<String, dynamic>> response = await FirebaseFirestore
.instance
.collection("capsules")
.where("user_id", isEqualTo: id)
.get();
List<Map<String, dynamic>?> capsuleList = response.docs
.map((DocumentSnapshot<Map<String, dynamic>> doc) => doc.data())
.toList();
for (int i = 0; i < 7; i++) {
DateTime date = sevenDaysAgo.add(Duration(days: i));
bool capsuleExists = capsuleList.any((post) =>
post?["date"] != null &&
post?["date"].toDate().year == date.year &&
post?["date"].toDate().month == date.month &&
post?["date"].toDate().day == date.day);
recapList.add(capsuleExists);
}
return recapList;
}
}

@ -37,7 +37,7 @@ class MusicService {
List<Tuple2<int, String>> capsules = []; List<Tuple2<int, String>> capsules = [];
var querySnapshot = await FirebaseFirestore.instance var querySnapshot = await FirebaseFirestore.instance
.collection('posts') .collection('capsules')
.where('user_id', isEqualTo: idUser) .where('user_id', isEqualTo: idUser)
.where('date', isGreaterThanOrEqualTo: DateTime(year, month)) .where('date', isGreaterThanOrEqualTo: DateTime(year, month))
.where('date', isLessThan: DateTime(year, month + 1)) .where('date', isLessThan: DateTime(year, month + 1))

@ -23,6 +23,15 @@ class PostService {
var userRef = MyApp.db.collection("users").doc(id); var userRef = MyApp.db.collection("users").doc(id);
var capsule = {
"user_id": id,
"date": DateTime.now(),
"place": [location?.item1, location?.item2],
"song_id": idMusic,
};
await MyApp.db.collection("capsules").doc(postAdd.id).set(capsule);
await MyApp.db.runTransaction((transaction) async { await MyApp.db.runTransaction((transaction) async {
var userSnapshot = await transaction.get(userRef); var userSnapshot = await transaction.get(userRef);
if (userSnapshot.exists) { if (userSnapshot.exists) {
@ -141,35 +150,6 @@ class PostService {
return !isTodayAvailable; return !isTodayAvailable;
} }
Future<List<bool>> recapSevenDays(String id) async {
List<bool> recapList = [];
DateTime sevenDaysAgo = DateTime.now().subtract(Duration(days: 6));
QuerySnapshot<Map<String, dynamic>> response = await FirebaseFirestore
.instance
.collection("posts")
.where("user_id", isEqualTo: id)
.get();
List<Map<String, dynamic>?> postList = response.docs
.map((DocumentSnapshot<Map<String, dynamic>> doc) => doc.data())
.toList();
for (int i = 0; i < 7; i++) {
DateTime date = sevenDaysAgo.add(Duration(days: i));
bool postExists = postList.any((post) =>
post?["date"] != null &&
post?["date"].toDate().year == date.year &&
post?["date"].toDate().month == date.month &&
post?["date"].toDate().day == date.day);
recapList.add(postExists);
}
return recapList;
}
Future<List<String>> getLikesByPostId(String id) async { Future<List<String>> getLikesByPostId(String id) async {
var response = var response =
await FirebaseFirestore.instance.collection("posts").doc(id).get(); await FirebaseFirestore.instance.collection("posts").doc(id).get();

@ -241,7 +241,12 @@ class MusicViewModel {
var musics = await getMusicsWithIds(capsulesData.map((capsule) => capsule.item2).toList()); var musics = await getMusicsWithIds(capsulesData.map((capsule) => capsule.item2).toList());
for (var capsule in capsulesData) { for (var capsule in capsulesData) {
var music = musics.firstWhere((music) => music.id == capsule.item2); var music = musics.firstWhere(
(music) => music.id == capsule.item2,
orElse: () => Music("-1", "", "", "", 0, 0, false, []),
);
if (music.id != "-1")
capsules.add(Tuple2(capsule.item1, music)); capsules.add(Tuple2(capsule.item1, music));
} }
return capsules; return capsules;

@ -1,6 +1,7 @@
import 'dart:io'; import 'dart:io';
import 'package:justmusic/model/Post.dart'; import 'package:justmusic/model/Post.dart';
import 'package:justmusic/services/CapsuleService.dart';
import 'package:justmusic/services/PostService.dart'; import 'package:justmusic/services/PostService.dart';
import 'package:tuple/tuple.dart'; import 'package:tuple/tuple.dart';
@ -14,6 +15,7 @@ class PostViewModel {
var lastPostFriend; var lastPostFriend;
var lastPostDiscovery; var lastPostDiscovery;
final PostService _postService = PostService(); final PostService _postService = PostService();
final CapsuleService _capsuleService = CapsuleService();
// Constructor // Constructor
PostViewModel(); PostViewModel();
@ -114,7 +116,7 @@ class PostViewModel {
Future<List<bool>> recapSevenDays(String id) async { Future<List<bool>> recapSevenDays(String id) async {
try { try {
return await _postService.recapSevenDays(id); return await _capsuleService.recapSevenDays(id);
} catch (e) { } catch (e) {
print(e); print(e);
rethrow; rethrow;
@ -145,7 +147,6 @@ class PostViewModel {
print(bool); print(bool);
return bool; return bool;
} catch (e) { } catch (e) {
print("haaaaaaaaa");
rethrow; rethrow;
} }
} }

Loading…
Cancel
Save