diff --git a/doc/Images/Overview.png b/doc/Images/Overview.png index 857f328..407eead 100644 Binary files a/doc/Images/Overview.png and b/doc/Images/Overview.png differ diff --git a/src/Api/src/services/LocationService.ts b/src/Api/src/services/LocationService.ts index 4a7594e..0bc4aeb 100644 --- a/src/Api/src/services/LocationService.ts +++ b/src/Api/src/services/LocationService.ts @@ -2,15 +2,15 @@ import { UserLocation } from '../models/Location'; import LocationSchema from "../database/LocationSchema"; class LocationService { - private locations = LocationSchema; + private location = LocationSchema; public async getNearUser(userId: string, musicId: string, latitude: number, longitude: number) { - await this.locations.findOneAndUpdate( + await this.location.findOneAndUpdate( { userId }, { userId, musicId, latitude, longitude }, { upsert: true } ); - const snapshot = await this.locations.find({ userId: { $ne: userId } }); + const snapshot = await this.location.find({ userId: { $ne: userId } }); if (!snapshot.length) { console.log('No matching documents.'); return; @@ -50,6 +50,17 @@ class LocationService { return dist; } } + + public async delete( + id: string + ): Promise { + try { + await this.location.findByIdAndRemove(id); + } catch (error: any) { + throw new Error(error.message); + } + } + } export default LocationService; \ No newline at end of file diff --git a/src/Api/src/services/UserService.ts b/src/Api/src/services/UserService.ts index 1afe066..61efa79 100644 --- a/src/Api/src/services/UserService.ts +++ b/src/Api/src/services/UserService.ts @@ -1,5 +1,4 @@ import { IMusic } from "../models/Music"; -import LocationSchema from "../database/LocationSchema"; import UserSchema from "../database/UserSchema"; import token from "./TokenService"; import { IPerson } from "../models/Person"; @@ -7,7 +6,6 @@ import mongoose from "mongoose"; class UserService { private user = UserSchema; - private location = LocationSchema; public async register( name: string, @@ -52,7 +50,6 @@ class UserService { ): Promise { try { await this.user.findByIdAndRemove(id); - await this.location.findByIdAndRemove(id); } catch (error: any) { throw new Error(error.message); } diff --git a/src/FLAD/components/SimilarMusicComponent.tsx b/src/FLAD/components/SimilarMusicComponent.tsx index dbc5f1c..a0da245 100644 --- a/src/FLAD/components/SimilarMusicComponent.tsx +++ b/src/FLAD/components/SimilarMusicComponent.tsx @@ -1,5 +1,5 @@ import { View, Text, StyleSheet, Image } from 'react-native'; -import Music from '../model/Music'; +import Music from '../models/Music'; import normalize from './Normalize'; export interface RenderCellProps { @@ -18,7 +18,7 @@ export const SimilarMusic = (props: RenderCellProps) => { const styles = StyleSheet.create({ similarContainer: { - marginHorizontal: normalize(7) + marginHorizontal: 6 }, similarTitle: { color: "#DADADA", diff --git a/src/FLAD/components/UserInfoBadgeComponent.tsx b/src/FLAD/components/UserInfoBadgeComponent.tsx index 0f0689a..0f8b06a 100644 --- a/src/FLAD/components/UserInfoBadgeComponent.tsx +++ b/src/FLAD/components/UserInfoBadgeComponent.tsx @@ -16,7 +16,7 @@ export default function UserInfoBadge(props: UserInfoProps) { height: 30, paddingHorizontal: normalize(10), backgroundColor: '#3F1DC3', - alignSelf: 'flex-start', + alignSelf: 'flex-start', borderRadius: 12, paddingRight: 20, }, @@ -41,26 +41,36 @@ export default function UserInfoBadge(props: UserInfoProps) { const date = formatDate(props.date); + let timeSection; + + if (date.days !== 0) { + timeSection = ( + + {date.days} + j + + ); + } else if (date.hours !== 0) { + timeSection = ( + + {date.hours} + h + + ); + } else { + timeSection = ( + + {date.minutes} + min + + ); + } + return ( Il y a - {date.days !== 0 ? ( - - {date.days} - j - - ) : date.hours !== 0 ? ( - - {date.hours} - h - - ) : ( - - {date.minutes} - min - - )} + {timeSection} {'<'} {props.distance} m diff --git a/src/FLAD/navigation/HomeNavigation.tsx b/src/FLAD/navigation/HomeNavigation.tsx index 8f9951a..a992d58 100644 --- a/src/FLAD/navigation/HomeNavigation.tsx +++ b/src/FLAD/navigation/HomeNavigation.tsx @@ -1,8 +1,8 @@ import React, { useEffect, useState } from 'react'; -import { View, Alert } from 'react-native'; +import { View, Alert, Platform } from 'react-native'; import { faUser, faEnvelope, faHeart, faMusic } from "@fortawesome/free-solid-svg-icons" import { createBottomTabNavigator } from '@react-navigation/bottom-tabs'; -import { NavigationContainer, DefaultTheme, DarkTheme } from '@react-navigation/native'; +import { NavigationContainer } from '@react-navigation/native'; import FavoriteNavigation from './FavoriteNavigation'; import SettingNavigation from './SettingNavigation'; import { FontAwesomeIcon } from "@fortawesome/react-native-fontawesome"; @@ -16,6 +16,7 @@ import * as Location from 'expo-location'; import { getSpotList } from '../redux/thunk/spotThunk'; import Music from '../models/Music'; import normalize from '../components/Normalize'; +import { BlurView } from 'expo-blur'; export default function HomeNavigation() { //@ts-ignore @@ -113,16 +114,25 @@ export default function HomeNavigation() { } }, [errorEmptyMusic]); + const MenuBlur = () => { + return ( + + ); + }; return ( - // @ts-ignore - + : undefined, tabBarActiveTintColor: isDark ? "white" : "rgb(255, 45, 85)", tabBarStyle: { - backgroundColor: isDark ? "rgb(46,46,46)" : "white", + position: 'absolute', + borderTopColor: isDark ? 'rgba(255, 255, 255, 0.25)' : 'rgba(50, 50, 50, 0.07)', }, }}> { diff --git a/src/FLAD/screens/ConversationScreen.tsx b/src/FLAD/screens/ConversationScreen.tsx index f89cc04..5990ae7 100644 --- a/src/FLAD/screens/ConversationScreen.tsx +++ b/src/FLAD/screens/ConversationScreen.tsx @@ -1,5 +1,5 @@ import { useNavigation } from "@react-navigation/native"; -import { SafeAreaView, StyleSheet, Text, View, FlatList, TouchableOpacity } from "react-native"; +import { StyleSheet, Text, View, FlatList, TouchableOpacity } from "react-native"; import { useSelector } from "react-redux"; import { colorsDark } from '../constants/colorsDark'; import { colorsLight } from '../constants/colorsLight'; @@ -48,7 +48,7 @@ export default function ConversationScreen() { }) return ( - + Messages Retrouvez ici les discussions @@ -65,6 +65,6 @@ export default function ConversationScreen() { )} /> - + ) } \ No newline at end of file diff --git a/src/FLAD/screens/DetailScreen.tsx b/src/FLAD/screens/DetailScreen.tsx index fe456b1..0ee968c 100644 --- a/src/FLAD/screens/DetailScreen.tsx +++ b/src/FLAD/screens/DetailScreen.tsx @@ -1,5 +1,5 @@ import { useIsFocused, useNavigation } from "@react-navigation/native"; -import { View, Text, Image, StyleSheet, TouchableOpacity, ScrollView, Share, Alert, SafeAreaView, Linking, FlatList, ActivityIndicator } from "react-native"; +import { View, Text, Image, StyleSheet, TouchableOpacity, ScrollView, Share, Alert, Linking, FlatList, ActivityIndicator, Platform, SafeAreaView } from "react-native"; import Animated, { interpolate, SensorType, useAnimatedSensor, useAnimatedStyle, withSpring } from "react-native-reanimated"; import { Audio } from 'expo-av'; import { useEffect, useState } from "react"; @@ -38,7 +38,7 @@ export default function DetailScreen({ route }) { if (sound) { sound.unloadAsync(); } - }; + }; }, []); const isFocused = useIsFocused(); @@ -133,12 +133,11 @@ export default function DetailScreen({ route }) { mainSafeArea: { height: '100%', width: '100%', - paddingTop: insets.top }, backgroundSection: { height: "100%", width: "100%", - position: "absolute" + position: "absolute", }, back_drop: { height: "100%", @@ -149,13 +148,14 @@ export default function DetailScreen({ route }) { height: "100%", }, card: { - alignItems: 'center' + alignItems: 'center', + paddingTop: insets.top }, cardCover: { width: normalize(390), height: normalize(390), borderRadius: 16, - resizeMode: 'stretch' + resizeMode: 'stretch', }, section1: { flexDirection: "row", @@ -204,7 +204,7 @@ export default function DetailScreen({ route }) { fontWeight: "bold", color: "white", fontSize: normalize(17), - paddingLeft: normalize(5) + paddingLeft: "2%" }, date: { fontWeight: "400", @@ -279,12 +279,10 @@ export default function DetailScreen({ route }) { return ( - - { Linking.openURL(item.url); }}> @@ -325,7 +322,7 @@ export default function DetailScreen({ route }) { - {item.trackPreviewUrl && ( + {!!item.trackPreviewUrl && ( @@ -349,8 +346,6 @@ export default function DetailScreen({ route }) { - - Similaire {loading ? ( diff --git a/src/FLAD/screens/FavoriteScreen.tsx b/src/FLAD/screens/FavoriteScreen.tsx index bd820f8..dd4ee64 100644 --- a/src/FLAD/screens/FavoriteScreen.tsx +++ b/src/FLAD/screens/FavoriteScreen.tsx @@ -1,10 +1,10 @@ import React, { useEffect, useState } from 'react'; -import { StyleSheet, Text, View, FlatList, SafeAreaView, SectionList, TouchableOpacity, RefreshControl } from 'react-native'; +import { StyleSheet, Text, View, FlatList, SectionList, TouchableOpacity, RefreshControl } from 'react-native'; import CardMusic from '../components/CardMusicComponent'; import normalize from '../components/Normalize'; import { Svg, Path } from 'react-native-svg'; import FladyComponent from '../components/FladyComponent'; -import { useNavigation } from "@react-navigation/native"; +import { useNavigation, useFocusEffect } from "@react-navigation/native"; import { useSelector, useDispatch } from 'react-redux'; import { colorsDark } from '../constants/colorsDark'; import { colorsLight } from '../constants/colorsLight'; @@ -12,7 +12,6 @@ import { getFavoriteMusic } from '../redux/thunk/appThunk'; import { Spot } from '../models/Spot'; import { useSafeAreaInsets } from 'react-native-safe-area-context'; import { resetNbAddedFavoriteMusic } from '../redux/actions/appActions'; -import { useFocusEffect } from '@react-navigation/native'; export default function FavoriteScreen() { @@ -125,7 +124,7 @@ export default function FavoriteScreen() { }); return ( - + Favoris @@ -176,6 +175,6 @@ export default function FavoriteScreen() { nestedScrollEnabled={true} /> - + ); }; \ No newline at end of file diff --git a/src/FLAD/screens/ProfilScreen.tsx b/src/FLAD/screens/ProfilScreen.tsx index 229f0e1..088695d 100644 --- a/src/FLAD/screens/ProfilScreen.tsx +++ b/src/FLAD/screens/ProfilScreen.tsx @@ -7,7 +7,7 @@ import { useNavigation } from "@react-navigation/native"; import { useDispatch, useSelector } from 'react-redux'; import normalize from '../components/Normalize'; import * as ImagePicker from 'expo-image-picker'; -import { SafeAreaView } from 'react-native-safe-area-context'; +import { useSafeAreaInsets } from 'react-native-safe-area-context'; import { colorsDark } from '../constants/colorsDark'; import { colorsLight } from '../constants/colorsLight'; import { deleteUser } from '../redux/thunk/authThunk'; @@ -177,10 +177,13 @@ export default function ProfilScreen() { } }, [errorUpdate]); + const insets = useSafeAreaInsets(); + const styles = StyleSheet.create({ mainSafeArea: { flex: 1, backgroundColor: style.body, + paddingTop: insets.top }, container: { marginTop: 20, @@ -393,7 +396,7 @@ export default function ProfilScreen() { return ( - + - + ); }; \ No newline at end of file diff --git a/src/FLAD/screens/SettingScreen.tsx b/src/FLAD/screens/SettingScreen.tsx index 95124cd..4a4d5d2 100644 --- a/src/FLAD/screens/SettingScreen.tsx +++ b/src/FLAD/screens/SettingScreen.tsx @@ -1,6 +1,6 @@ import React, { useEffect, useRef, useState } from 'react'; import AsyncStorage from '@react-native-async-storage/async-storage'; -import { View, StyleSheet, Text, Image, TouchableWithoutFeedback, Keyboard, TouchableOpacity, SafeAreaView, Alert } from 'react-native'; +import { View, StyleSheet, Text, Image, TouchableWithoutFeedback, Keyboard, TouchableOpacity, Alert } from 'react-native'; import { Svg, Path } from 'react-native-svg'; import { useNavigation } from "@react-navigation/native"; import { useDispatch, useSelector } from 'react-redux'; @@ -272,7 +272,7 @@ export default function SettingScreen() { }) return ( - + Réglages @@ -384,7 +384,7 @@ export default function SettingScreen() { - + ); }; diff --git a/src/FLAD/screens/SpotScreen.tsx b/src/FLAD/screens/SpotScreen.tsx index dffcb79..6fa7576 100644 --- a/src/FLAD/screens/SpotScreen.tsx +++ b/src/FLAD/screens/SpotScreen.tsx @@ -8,17 +8,20 @@ import Loading from '../components/LoadingComponent'; import { useNavigation } from '@react-navigation/native'; import { useDispatch, useSelector } from 'react-redux'; import { Spot } from '../models/Spot'; -import { removeFromSpotList } from '../redux/actions/spotActions'; -import { MusicServiceProvider } from '../models/MusicServiceProvider'; import { useSafeAreaInsets } from 'react-native-safe-area-context'; import Artist from '../models/Artist'; import { addMusicToFavorite } from '../redux/thunk/appThunk'; import { addToPlaylist, removeSpot } from '../redux/thunk/spotThunk'; import UserInfoBadge from '../components/UserInfoBadgeComponent'; +import { colorsDark } from '../constants/colorsDark'; +import { colorsLight } from '../constants/colorsLight'; export default function SpotScreen() { //@ts-ignore const spotReducer: Spot[] = useSelector(state => state.appReducer.spot) + // @ts-ignore + const isDark = useSelector(state => state.userReducer.dark); + const style = isDark ? colorsDark : colorsLight; const [cards, setCards] = useState(spotReducer); const [currentCard, setcurrentCard] = useState(cards[cards.length - 1]); @@ -66,7 +69,7 @@ export default function SpotScreen() { justifyContent: 'center', alignItems: 'center', flex: 1, - backgroundColor: "#141414", + backgroundColor: style.body, paddingTop: insets.top }, posterBackground: { @@ -106,7 +109,7 @@ export default function SpotScreen() { paddingHorizontal: 30, width: '100%', position: "absolute", - top: "85%" + top: "80%" }, button: { alignItems: 'center',