commit to API & spotify Service starting

pull/1/head
David D'ALMEIDA 2 years ago
parent f062680a15
commit 77472cf538

280
.gitignore vendored

@ -1,141 +1,141 @@
# Xcode
!**/*.xcodeproj
!**/*.pbxproj
!**/*.xcworkspacedata
!**/*.xcsettings
!**/*.xcscheme
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace
**/.xcode.env.local
# Gradle
/build/
/packages/react-native-gradle-plugin/build/
/packages/rn-tester/build
/packages/rn-tester/android/app/.cxx/
/packages/rn-tester/android/app/build/
/packages/rn-tester/android/app/gradle/
/packages/rn-tester/android/app/gradlew
/packages/rn-tester/android/app/gradlew.bat
/ReactAndroid/build/
/ReactAndroid/.cxx/
/ReactAndroid/gradle/
/ReactAndroid/gradlew
/ReactAndroid/gradlew.bat
/ReactAndroid/external-artifacts/build/
/ReactAndroid/external-artifacts/artifacts/
/ReactAndroid/hermes-engine/build/
/ReactAndroid/hermes-engine/.cxx/
/template/android/app/build/
/template/android/build/
# Buck
.buckd
buck-out
/.lsp.buckd
/.lsp-buck-out
/ReactAndroid/src/main/jni/prebuilt/lib/
/ReactAndroid/src/main/gen
# Android Studio
.project
.settings
.classpath
# Watchman
.watchmanconfig
# Android
.idea
.gradle
local.properties
*.iml
/android/*
!/android/README.md
# Node
node_modules
*.log
.nvm
package-lock.json
# OS X
.DS_Store
# Test generated files
/ReactAndroid/src/androidTest/assets/AndroidTestBundle.js
*.js.meta
/coverage
/third-party
# Test Reports
/reports
# Stack Dumps generated when programs crash (Ex. bash.exe.stackdump on Win)
*.stackdump
# Root dir shouldn't have Xcode project
/*.xcodeproj
# ReactCommon subdir shouldn't have Xcode project
/ReactCommon/**/*.xcodeproj
# Libs that shouldn't have Xcode project
/Libraries/FBLazyVector/**/*.xcodeproj
/Libraries/RCTRequired/**/*.xcodeproj
/React/CoreModules/**/*.xcodeproj
/React/FBReactNativeSpec/**/*.xcodeproj
/packages/react-native-codegen/**/*.xcodeproj
# Ruby Gems (Bundler)
/vendor
/template/vendor
# iOS / CocoaPods
/template/ios/build/
/template/ios/Pods/
/template/ios/Podfile.lock
/packages/rn-tester/Gemfile.lock
# Ignore RNTester specific Pods, but keep the __offline_mirrors__ here.
/packages/rn-tester/Pods/*
!/packages/rn-tester/Pods/__offline_mirrors_hermes__
!/packages/rn-tester/Pods/__offline_mirrors_jsc__
# @react-native/codegen
/React/FBReactNativeSpec/FBReactNativeSpec
/packages/react-native-codegen/lib
/packages/react-native-codegen/tmp/
/ReactCommon/react/renderer/components/rncore/
/packages/rn-tester/NativeModuleExample/ScreenshotManagerSpec*
# Additional SDKs
/sdks/download
/sdks/hermes
/sdks/hermesc
# Visual studio
.vscode
.vs
# Android memory profiler files
*.hprof
# Temporary files created by Metro to check the health of the file watcher
# Xcode
!**/*.xcodeproj
!**/*.pbxproj
!**/*.xcworkspacedata
!**/*.xcsettings
!**/*.xcscheme
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace
**/.xcode.env.local
# Gradle
/build/
/packages/react-native-gradle-plugin/build/
/packages/rn-tester/build
/packages/rn-tester/android/app/.cxx/
/packages/rn-tester/android/app/build/
/packages/rn-tester/android/app/gradle/
/packages/rn-tester/android/app/gradlew
/packages/rn-tester/android/app/gradlew.bat
/ReactAndroid/build/
/ReactAndroid/.cxx/
/ReactAndroid/gradle/
/ReactAndroid/gradlew
/ReactAndroid/gradlew.bat
/ReactAndroid/external-artifacts/build/
/ReactAndroid/external-artifacts/artifacts/
/ReactAndroid/hermes-engine/build/
/ReactAndroid/hermes-engine/.cxx/
/template/android/app/build/
/template/android/build/
# Buck
.buckd
buck-out
/.lsp.buckd
/.lsp-buck-out
/ReactAndroid/src/main/jni/prebuilt/lib/
/ReactAndroid/src/main/gen
# Android Studio
.project
.settings
.classpath
# Watchman
.watchmanconfig
# Android
.idea
.gradle
local.properties
*.iml
/android/*
!/android/README.md
# Node
node_modules
*.log
.nvm
package-lock.json
# OS X
.DS_Store
# Test generated files
/ReactAndroid/src/androidTest/assets/AndroidTestBundle.js
*.js.meta
/coverage
/third-party
# Test Reports
/reports
# Stack Dumps generated when programs crash (Ex. bash.exe.stackdump on Win)
*.stackdump
# Root dir shouldn't have Xcode project
/*.xcodeproj
# ReactCommon subdir shouldn't have Xcode project
/ReactCommon/**/*.xcodeproj
# Libs that shouldn't have Xcode project
/Libraries/FBLazyVector/**/*.xcodeproj
/Libraries/RCTRequired/**/*.xcodeproj
/React/CoreModules/**/*.xcodeproj
/React/FBReactNativeSpec/**/*.xcodeproj
/packages/react-native-codegen/**/*.xcodeproj
# Ruby Gems (Bundler)
/vendor
/template/vendor
# iOS / CocoaPods
/template/ios/build/
/template/ios/Pods/
/template/ios/Podfile.lock
/packages/rn-tester/Gemfile.lock
# Ignore RNTester specific Pods, but keep the __offline_mirrors__ here.
/packages/rn-tester/Pods/*
!/packages/rn-tester/Pods/__offline_mirrors_hermes__
!/packages/rn-tester/Pods/__offline_mirrors_jsc__
# @react-native/codegen
/React/FBReactNativeSpec/FBReactNativeSpec
/packages/react-native-codegen/lib
/packages/react-native-codegen/tmp/
/ReactCommon/react/renderer/components/rncore/
/packages/rn-tester/NativeModuleExample/ScreenshotManagerSpec*
# Additional SDKs
/sdks/download
/sdks/hermes
/sdks/hermesc
# Visual studio
.vscode
.vs
# Android memory profiler files
*.hprof
# Temporary files created by Metro to check the health of the file watcher
.metro-health-check*

@ -0,0 +1,18 @@
{
"name": "api",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@types/express": "^4.17.16",
"nodemon": "^2.0.20",
"ts-node": "^10.9.1",
"typescript": "^4.9.4"
}
}

@ -3,16 +3,62 @@ import { useState, useTransition } from 'react';
import { Animated, StyleSheet, Text, View } from 'react-native';
import Card from './components/Card';
// import { cards as cardArray } from './FakeData/data'
import { cards as cardArray } from './FakeData/data'
export default function App() {
// const [currentCard, setCurrentCard] = useState(cardArray);
// const aIndex = useTransition(currentCard)
// ;
const [cards, setCards] = useState(cardArray);
const aIndex = useTransition();
const onSwipe = (index: number, direction: 'left' | 'right') => {
if (direction === 'right') {
// Swiped right
console.log('Swiped right');
} else if (direction === 'left') {
console.log('Swiped left');
}
// update the state of the card or the app
setCards(cards.filter((_, i) => i !== index));
};
// const [currentCard, setCurrentCard] = useState(0);
return (
<View>
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center', position : 'absolute', backgroundColor : '' }}>
{cards.map((card, index) => (
<View key={card.name}>
<Card
title={card.name}
image={card.sourceUrl}
onSwipe={(direction) => onSwipe(index, direction)}
/>
</View>
))}
</View>
// <View style={styles.container}>
// <Text>Open up App.tsx to start working on your app!</Text>
// {/* <View>
// <Animated.View>
// </Animated.View>
// {cardArray.map( ({index}) => currentCard < index && step + step && (
// <Card card={card} ></Card>
// ) )}
// </View> */}
// <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
// <Card title="Swipe me left or right" />
// </View>
// <StatusBar style="auto" />
// </View>
);
}
@ -35,4 +81,4 @@ const styles = StyleSheet.create({
resizeMode : "cover",
placeholder: "assets/images/loadingPlaceholder.gif"
},
});
});

@ -1,17 +1,17 @@
export const cards = [{
name : "blue",
sourceUrl : "https://images.unsplash.com/photo-1484589065579-248aad0d8b13?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1359&q=80",
index : 3
},
{
name : "red",
sourceUrl : "https://images.unsplash.com/photo-1614613535308-eb5fbd3d2c17?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=870&q=80",
index : 2
},
{
name : "green",
sourceUrl : "https://images.unsplash.com/photo-1584679109597-c656b19974c9?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=580&q=80",
index : 1
}
export const cards = [{
name : "blue",
sourceUrl : "https://images.unsplash.com/photo-1484589065579-248aad0d8b13?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1359&q=80",
index : 3
},
{
name : "red",
sourceUrl : "https://images.unsplash.com/photo-1614613535308-eb5fbd3d2c17?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=870&q=80",
index : 2
},
{
name : "green",
sourceUrl : "https://images.unsplash.com/photo-1584679109597-c656b19974c9?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=580&q=80",
index : 1
}
]

@ -1,68 +1,82 @@
import { View, Text, Image, Animated ,PanResponder, Dimensions } from 'react-native'
import React, { useRef } from 'react'
const {width : wWidht} = Dimensions.get("window");
const width = wWidht *0.75;
const height = wWidht * (465/264);
const borderRadius = 24;
interface CardProps {
title: string;
image: any;
onSwipe: (direction: "left" | "right") => void;
}
const Card: React.FC<CardProps> = ({ title, image, onSwipe }) => {
const pan = useRef(new Animated.ValueXY()).current;
const panResponder = useRef(
PanResponder.create({
onMoveShouldSetPanResponder: (evt, gestureState) => {
// Only set the pan responder if the user has moved the card more than a certain threshold
if (Math.abs(gestureState.dx) > 10) {
return true;
}
return false;
},
onPanResponderMove: (evt, gestureState) => {
// Update the position of the card as the user swipes it
pan.setValue({ x: gestureState.dx, y: 0 });
console.log("Card");
},
onPanResponderRelease: (evt, gestureState) => {
// Handle the swipe action based on the swipe direction
if (gestureState.dx > 50) {
onSwipe("right");
} else if (gestureState.dx < -50) {
onSwipe("left");
} else {
// Swiped a small amount, reset the position of the card
Animated.spring(pan, {
toValue: { x: 0, y: 0 },
useNativeDriver: true,
}).start();
}
},
})
).current;
return (
<View>
<Animated.View
style={{ transform: [{ translateX: pan.x }] }}
{...panResponder.panHandlers}
>
<Image source={image} style={{ width: 200, height: 200 }} />
</Animated.View>
</View>
);
};
export default Card;
import { View, Text, Image, Animated ,PanResponder, Dimensions, StyleSheet } from 'react-native'
import React, { useRef, useState } from 'react'
import { eventMethod } from '@ionic/core/dist/types/utils/overlays';
const {width : wWidht} = Dimensions.get("window");
const width = wWidht *0.75;
const height = wWidht * (465/264);
const borderRadius = 24;
interface CardProps {
title: string;
image: any;
onSwipe: (direction: "left" | "right") => void;
}
// const [loading, setLoading] = useState(true);
// const [cards, setCards] = useState(cardArray);
// useEffect(()=>{
// setLoading(true);
// eventMethod().then(
// setLoading(false);
// )
// })
const Card: React.FC<CardProps> = ({ title, image, onSwipe }) => {
const pan = useRef(new Animated.ValueXY()).current;
const panResponder = useRef(
PanResponder.create({
onMoveShouldSetPanResponder: (evt, gestureState) => {
// Only set the pan responder if the user has moved the card more than a certain threshold
if (Math.abs(gestureState.dx) > 10) {
return true;
}
return false;
},
onPanResponderMove: (evt, gestureState) => {
// Update the position of the card as the user swipes it
pan.setValue({ x: gestureState.dx, y: 0 });
console.log("Card");
},
onPanResponderRelease: (evt, gestureState) => {
// Handle the swipe action based on the swipe direction
if (gestureState.dx > 50) {
onSwipe("right");
} else if (gestureState.dx < -50) {
onSwipe("left");
} else {
// Swiped a small amount, reset the position of the card
Animated.spring(pan, {
toValue: { x: 0, y: 0 },
useNativeDriver: true,
}).start();
}
},
})
).current;
return (
<View>
<Animated.View
style={{ transform: [{ translateX: pan.x }], backgroundColor : 'red'}}
{...panResponder.panHandlers}
>
<Image source={{uri : image}} style={{ width: 200, height: 200 }} />
</Animated.View>
</View>
);
};
const nournous = StyleSheet.create({
})
export default Card;

@ -0,0 +1,73 @@
import { View, Text, Image, Animated ,PanResponder, Dimensions } from 'react-native'
import React, { useRef, useState, useTransition } from 'react'
import Card from '../components/Card';
import { cards as cardArray } from '../FakeData/data'
const {width : wWidht} = Dimensions.get("window");
const width = wWidht *0.75;
const height = wWidht * (465/264);
const borderRadius = 24;
interface SpotProps {
title: string;
image: any;
onSwipe: (direction: "left" | "right") => void;
}
const Spot: React.FC<SpotProps> = ({ title, image, onSwipe }) => {
const [cards, setCards] = useState(cardArray);
const aIndex = useTransition();
const onSwipe = (index: number, direction: 'left' | 'right') => {
if (direction === 'right') {
// Swiped right
console.log('Swiped right');
} else if (direction === 'left') {
console.log('Swiped left');
}
// update the state of the card or the app
setCards(cards.filter((_, i) => i !== index));
};
// const [currentCard, setCurrentCard] = useState(0);
return (
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center', position : 'absolute', backgroundColor : '' }}>
{cards.map((card, index) => (
<View key={card.name}>
<Card
title={card.name}
image={card.sourceUrl}
onSwipe={(direction) => onSwipe(index, direction)}
/>
</View>
))}
</View>
// <View style={styles.container}>
// <Text>Open up App.tsx to start working on your app!</Text>
// {/* <View>
// <Animated.View>
// </Animated.View>
// {cardArray.map( ({index}) => currentCard < index && step + step && (
// <Card card={card} ></Card>
// ) )}
// </View> */}
// <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
// <Card title="Swipe me left or right" />
// </View>
// <StatusBar style="auto" />
// </View>
);
};
export default Spot;

@ -0,0 +1,23 @@
export class SpotifyService {
private identification : ApiSpotifyIdentification;
public request : SpotifyRequest;
constructor() {
}
get identification{
}
async uploadName() {
}
async apiAuth(url : string) {
await this.identification.setCode(url);
this.request = ApiSpotifyRequests(await this.identification.createToken());
}
}
Loading…
Cancel
Save