Code smells fix

jest_Test
Emre KARTAL 2 years ago
parent 3fa45977cc
commit 8458868be6

@ -1,24 +1,14 @@
import Music from "../Music"; import Music from "../Music";
export default class MusicFactory { export default class MusicFactory {
static mapFromSpotifyTrack(jsonMusic :any ): Music { static mapFromSpotifyTrack(jsonMusic: any): Music {
const music = new Music( const music = new Music(
jsonMusic.id, jsonMusic.id,
jsonMusic.name, jsonMusic.name,
"", "",
jsonMusic.album.images[0].url, jsonMusic.album.images[0].url,
jsonMusic.preview_url jsonMusic.preview_url
); );
return music;
}
static mapFromSpotifyTrackSmpified(jsonMusic :any ): Music {
const music = new Music(
jsonMusic.id,
jsonMusic.name,
"",
jsonMusic.album.images[0].url,
jsonMusic.preview_url
);
return music; return music;
} }
} }

@ -1,4 +1,4 @@
export default function AdjustSize(Text: String) { export default function AdjustSize(Text: string) {
const titleLength = Text.length; const titleLength = Text.length;
const minFontSize = 23; const minFontSize = 23;
const maxFontSize = 48; const maxFontSize = 48;

@ -19,12 +19,6 @@ interface ArtistProps {
} }
export const Artist = ({ artist, onPress }: ArtistProps) => { export const Artist = ({ artist, onPress }: ArtistProps) => {
const source = typeof artist.image === 'string' ? { uri: artist.image } : artist.image; const source = typeof artist.image === 'string' ? { uri: artist.image } : artist.image;
//@ts-ignore
const onSingleTapEvent = (event) => {
if (event.nativeEvent.state === State.ACTIVE) {
alert('Hey single tap!');
}
};
const [selected, setSeleted] = useState(false); const [selected, setSeleted] = useState(false);
const onS = () => { const onS = () => {
setSeleted(!selected); setSeleted(!selected);

@ -1,8 +1,7 @@
import { useState } from "react"; import { useState } from "react";
import { ScrollView } from "react-native"; import { ScrollView, StyleSheet } from "react-native";
import Music from "../Model/Music"; import Music from "../Model/Music";
import { Artist } from "./Artist"; import { Artist } from "./Artist";
import { StyleSheet } from "react-native";
export const ArtistLayout = () => { export const ArtistLayout = () => {
const MUSIC_LIST: Music[] = [ const MUSIC_LIST: Music[] = [
@ -16,7 +15,6 @@ export const ArtistLayout = () => {
new Music("Kratos", "PNL", "https://upload.wikimedia.org/wikipedia/en/a/a0/PNL_-_Dans_la_l%C3%A9gende.png"), new Music("Kratos", "PNL", "https://upload.wikimedia.org/wikipedia/en/a/a0/PNL_-_Dans_la_l%C3%A9gende.png"),
] ]
const [artists, setArtists] = useState<Music[]>(MUSIC_LIST); const [artists, setArtists] = useState<Music[]>(MUSIC_LIST);
const [selectedArtists, setSelectedArtists] = useState<typeof MUSIC_LIST>([]);
return ( return (
<ScrollView contentContainerStyle={styles.container}> <ScrollView contentContainerStyle={styles.container}>

@ -3,7 +3,6 @@ import { RenderCellProps } from "./littleCard";
interface HorizontalFlatListProps { interface HorizontalFlatListProps {
// React.ReactNode;
children: (props: RenderCellProps) => React.ReactElement children: (props: RenderCellProps) => React.ReactElement
title: string; title: string;
data: any[]; data: any[];

@ -1,6 +1,5 @@
import React, { useState, useRef } from 'react'; import React, { useState, useRef } from 'react';
import { Modal, View, StyleSheet, useColorScheme, Text, FlatList, Animated, TouchableOpacity, ImageBackground, Image } from 'react-native'; import { Modal, View, StyleSheet, useColorScheme, Text, FlatList, Animated, TouchableOpacity, ImageBackground, Image } from 'react-native';
// import Modal from "react-native-modal";
import { useNavigation } from "@react-navigation/native"; import { useNavigation } from "@react-navigation/native";
import normalize from '../components/Normalize'; import normalize from '../components/Normalize';
import OnboardingItem from './OnboardingItem'; import OnboardingItem from './OnboardingItem';

@ -5,7 +5,6 @@ import MusicDetail from '../screens/MusicDetail';
export default function SpotNavigation() { export default function SpotNavigation() {
// const Stack = createSharedElementStackNavigator();
const Stack = createStackNavigator(); const Stack = createStackNavigator();
return ( return (

@ -1,6 +0,0 @@
// export const UserLogin = (username: string, password: string) => {
// return {
// type: userTypes.LOGIN,
// playload : username, password
// };
// }

@ -96,7 +96,7 @@ export const getRefreshToken = () => {
dispatch(restoreToken(empty)); dispatch(restoreToken(empty));
} }
} catch (e) { } catch (e) {
console.log('Error---------', e); console.log('Error :', e);
} }
} }
} }

@ -18,7 +18,7 @@ export const getSpotList = (resuestHandler: SpotifyService) => {
return async dispatch => { return async dispatch => {
try { try {
//@ts-ignore //@ts-ignore
var userToken: string = await SecureStore.getItemAsync(key); const userToken: string = await SecureStore.getItemAsync(key);
const headers = { const headers = {
'Authorization': 'Bearer ' + userToken 'Authorization': 'Bearer ' + userToken
}; };

@ -13,7 +13,6 @@ import { Feather as Icon } from "@expo/vector-icons";
import { HorizontalFlatList } from "../components/HorizontalFlatList"; import { HorizontalFlatList } from "../components/HorizontalFlatList";
import { LittleCard } from "../components/littleCard"; import { LittleCard } from "../components/littleCard";
import * as SecureStore from 'expo-secure-store'; import * as SecureStore from 'expo-secure-store';
import { useSelector } from "react-redux";
const halfPi = Math.PI / 2; const halfPi = Math.PI / 2;
@ -21,7 +20,7 @@ const halfPi = Math.PI / 2;
//@ts-ignore //@ts-ignore
const MusicDetail = ({ route }) => { const MusicDetail = ({ route }) => {
const music: Music = route.params.music; const music: Music = route.params.music;
const [currentspot, setCurrentSpot] = useState(music); const [currentspot] = useState(music);
const [simularMusic, setSimularMusic] = useState<Music[]>([]); const [simularMusic, setSimularMusic] = useState<Music[]>([]);
const [isPlaying, setIsPlaying] = useState(false); const [isPlaying, setIsPlaying] = useState(false);
const [sound, setSound] = useState(null); const [sound, setSound] = useState(null);
@ -87,7 +86,7 @@ const MusicDetail = ({ route }) => {
const sensor = useAnimatedSensor(SensorType.ROTATION); const sensor = useAnimatedSensor(SensorType.ROTATION);
const styleAniamatedImage = useAnimatedStyle(() => { const styleAniamatedImage = useAnimatedStyle(() => {
const { yaw, pitch, roll } = sensor.sensor.value; const { pitch, roll } = sensor.sensor.value;
const verticalAxis = interpolate( const verticalAxis = interpolate(
pitch, pitch,
[-halfPi * 2, halfPi * 2], [-halfPi * 2, halfPi * 2],

@ -1,10 +1,10 @@
import React, { useState, useRef, useEffect } from 'react'; import React, { useEffect } from 'react';
import { View, Text, StyleSheet, TouchableWithoutFeedback, Keyboard, ScrollView, Image } from 'react-native'; import { View, Text, StyleSheet, TouchableWithoutFeedback, Keyboard, ScrollView, Image } from 'react-native';
import { TextInput, TouchableOpacity } from 'react-native-gesture-handler'; import { TextInput, TouchableOpacity } from 'react-native-gesture-handler';
import { Svg, Path } from 'react-native-svg'; import { Svg, Path } from 'react-native-svg';
import Modal from "react-native-modal"; import Modal from "react-native-modal";
import { useNavigation } from "@react-navigation/native"; import { useNavigation } from "@react-navigation/native";
import { useDispatch, useSelector } from 'react-redux'; import { useSelector } from 'react-redux';
import normalize from '../components/Normalize'; import normalize from '../components/Normalize';
import * as ImagePicker from 'expo-image-picker'; import * as ImagePicker from 'expo-image-picker';
@ -43,8 +43,6 @@ export default function SettingProfil() {
aspect: [4, 3], aspect: [4, 3],
quality: 1, quality: 1,
}); });
if (!result.canceled) {
}
}; };
const styles = StyleSheet.create({ const styles = StyleSheet.create({

@ -55,7 +55,6 @@ const SpotDetailsPage = ({ route }) => {
: undefined; : undefined;
}, [sound]); }, [sound]);
console.log(spot);
const sensor = useAnimatedSensor(SensorType.ROTATION); const sensor = useAnimatedSensor(SensorType.ROTATION);
const styleAniamatedImage = useAnimatedStyle(() => { const styleAniamatedImage = useAnimatedStyle(() => {
const { pitch, roll } = sensor.sensor.value; const { pitch, roll } = sensor.sensor.value;
@ -75,7 +74,7 @@ const SpotDetailsPage = ({ route }) => {
}; };
}) })
var id = '0cFS3AMF9Lhj3CNoFvwjvY' const id = '0cFS3AMF9Lhj3CNoFvwjvY'
const getCurrentTrack = async () => { const getCurrentTrack = async () => {
try { try {

@ -1,4 +1,4 @@
import { View, Text, StyleSheet, Button, Platform } from 'react-native' import { View, Text, StyleSheet, Button } from 'react-native'
import React from 'react' import React from 'react'
import * as AuthSession from 'expo-auth-session'; import * as AuthSession from 'expo-auth-session';
import * as WebBrowser from 'expo-web-browser'; import * as WebBrowser from 'expo-web-browser';

Loading…
Cancel
Save