Merge pull request 'commit to API & spotify Service starting' (#1) from API_SpotifyService into master
Reviewed-on: david.d_almeida/FLAD#1pull/2/head
commit
7a3e8307a7
@ -1,141 +1,141 @@
|
|||||||
# Xcode
|
# Xcode
|
||||||
!**/*.xcodeproj
|
!**/*.xcodeproj
|
||||||
!**/*.pbxproj
|
!**/*.pbxproj
|
||||||
!**/*.xcworkspacedata
|
!**/*.xcworkspacedata
|
||||||
!**/*.xcsettings
|
!**/*.xcsettings
|
||||||
!**/*.xcscheme
|
!**/*.xcscheme
|
||||||
*.pbxuser
|
*.pbxuser
|
||||||
!default.pbxuser
|
!default.pbxuser
|
||||||
*.mode1v3
|
*.mode1v3
|
||||||
!default.mode1v3
|
!default.mode1v3
|
||||||
*.mode2v3
|
*.mode2v3
|
||||||
!default.mode2v3
|
!default.mode2v3
|
||||||
*.perspectivev3
|
*.perspectivev3
|
||||||
!default.perspectivev3
|
!default.perspectivev3
|
||||||
xcuserdata
|
xcuserdata
|
||||||
*.xccheckout
|
*.xccheckout
|
||||||
*.moved-aside
|
*.moved-aside
|
||||||
DerivedData
|
DerivedData
|
||||||
*.hmap
|
*.hmap
|
||||||
*.ipa
|
*.ipa
|
||||||
*.xcuserstate
|
*.xcuserstate
|
||||||
project.xcworkspace
|
project.xcworkspace
|
||||||
**/.xcode.env.local
|
**/.xcode.env.local
|
||||||
|
|
||||||
# Gradle
|
# Gradle
|
||||||
/build/
|
/build/
|
||||||
/packages/react-native-gradle-plugin/build/
|
/packages/react-native-gradle-plugin/build/
|
||||||
/packages/rn-tester/build
|
/packages/rn-tester/build
|
||||||
/packages/rn-tester/android/app/.cxx/
|
/packages/rn-tester/android/app/.cxx/
|
||||||
/packages/rn-tester/android/app/build/
|
/packages/rn-tester/android/app/build/
|
||||||
/packages/rn-tester/android/app/gradle/
|
/packages/rn-tester/android/app/gradle/
|
||||||
/packages/rn-tester/android/app/gradlew
|
/packages/rn-tester/android/app/gradlew
|
||||||
/packages/rn-tester/android/app/gradlew.bat
|
/packages/rn-tester/android/app/gradlew.bat
|
||||||
/ReactAndroid/build/
|
/ReactAndroid/build/
|
||||||
/ReactAndroid/.cxx/
|
/ReactAndroid/.cxx/
|
||||||
/ReactAndroid/gradle/
|
/ReactAndroid/gradle/
|
||||||
/ReactAndroid/gradlew
|
/ReactAndroid/gradlew
|
||||||
/ReactAndroid/gradlew.bat
|
/ReactAndroid/gradlew.bat
|
||||||
/ReactAndroid/external-artifacts/build/
|
/ReactAndroid/external-artifacts/build/
|
||||||
/ReactAndroid/external-artifacts/artifacts/
|
/ReactAndroid/external-artifacts/artifacts/
|
||||||
/ReactAndroid/hermes-engine/build/
|
/ReactAndroid/hermes-engine/build/
|
||||||
/ReactAndroid/hermes-engine/.cxx/
|
/ReactAndroid/hermes-engine/.cxx/
|
||||||
/template/android/app/build/
|
/template/android/app/build/
|
||||||
/template/android/build/
|
/template/android/build/
|
||||||
|
|
||||||
# Buck
|
# Buck
|
||||||
.buckd
|
.buckd
|
||||||
buck-out
|
buck-out
|
||||||
/.lsp.buckd
|
/.lsp.buckd
|
||||||
/.lsp-buck-out
|
/.lsp-buck-out
|
||||||
/ReactAndroid/src/main/jni/prebuilt/lib/
|
/ReactAndroid/src/main/jni/prebuilt/lib/
|
||||||
/ReactAndroid/src/main/gen
|
/ReactAndroid/src/main/gen
|
||||||
|
|
||||||
# Android Studio
|
# Android Studio
|
||||||
.project
|
.project
|
||||||
.settings
|
.settings
|
||||||
.classpath
|
.classpath
|
||||||
|
|
||||||
# Watchman
|
# Watchman
|
||||||
.watchmanconfig
|
.watchmanconfig
|
||||||
|
|
||||||
# Android
|
# Android
|
||||||
.idea
|
.idea
|
||||||
.gradle
|
.gradle
|
||||||
local.properties
|
local.properties
|
||||||
*.iml
|
*.iml
|
||||||
/android/*
|
/android/*
|
||||||
!/android/README.md
|
!/android/README.md
|
||||||
|
|
||||||
# Node
|
# Node
|
||||||
node_modules
|
node_modules
|
||||||
*.log
|
*.log
|
||||||
.nvm
|
.nvm
|
||||||
package-lock.json
|
package-lock.json
|
||||||
|
|
||||||
# OS X
|
# OS X
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
# Test generated files
|
# Test generated files
|
||||||
/ReactAndroid/src/androidTest/assets/AndroidTestBundle.js
|
/ReactAndroid/src/androidTest/assets/AndroidTestBundle.js
|
||||||
*.js.meta
|
*.js.meta
|
||||||
|
|
||||||
/coverage
|
/coverage
|
||||||
/third-party
|
/third-party
|
||||||
|
|
||||||
# Test Reports
|
# Test Reports
|
||||||
/reports
|
/reports
|
||||||
|
|
||||||
# Stack Dumps generated when programs crash (Ex. bash.exe.stackdump on Win)
|
# Stack Dumps generated when programs crash (Ex. bash.exe.stackdump on Win)
|
||||||
*.stackdump
|
*.stackdump
|
||||||
|
|
||||||
# Root dir shouldn't have Xcode project
|
# Root dir shouldn't have Xcode project
|
||||||
/*.xcodeproj
|
/*.xcodeproj
|
||||||
|
|
||||||
# ReactCommon subdir shouldn't have Xcode project
|
# ReactCommon subdir shouldn't have Xcode project
|
||||||
/ReactCommon/**/*.xcodeproj
|
/ReactCommon/**/*.xcodeproj
|
||||||
|
|
||||||
# Libs that shouldn't have Xcode project
|
# Libs that shouldn't have Xcode project
|
||||||
/Libraries/FBLazyVector/**/*.xcodeproj
|
/Libraries/FBLazyVector/**/*.xcodeproj
|
||||||
/Libraries/RCTRequired/**/*.xcodeproj
|
/Libraries/RCTRequired/**/*.xcodeproj
|
||||||
/React/CoreModules/**/*.xcodeproj
|
/React/CoreModules/**/*.xcodeproj
|
||||||
/React/FBReactNativeSpec/**/*.xcodeproj
|
/React/FBReactNativeSpec/**/*.xcodeproj
|
||||||
/packages/react-native-codegen/**/*.xcodeproj
|
/packages/react-native-codegen/**/*.xcodeproj
|
||||||
|
|
||||||
# Ruby Gems (Bundler)
|
# Ruby Gems (Bundler)
|
||||||
/vendor
|
/vendor
|
||||||
/template/vendor
|
/template/vendor
|
||||||
|
|
||||||
# iOS / CocoaPods
|
# iOS / CocoaPods
|
||||||
/template/ios/build/
|
/template/ios/build/
|
||||||
/template/ios/Pods/
|
/template/ios/Pods/
|
||||||
/template/ios/Podfile.lock
|
/template/ios/Podfile.lock
|
||||||
/packages/rn-tester/Gemfile.lock
|
/packages/rn-tester/Gemfile.lock
|
||||||
|
|
||||||
# Ignore RNTester specific Pods, but keep the __offline_mirrors__ here.
|
# Ignore RNTester specific Pods, but keep the __offline_mirrors__ here.
|
||||||
/packages/rn-tester/Pods/*
|
/packages/rn-tester/Pods/*
|
||||||
!/packages/rn-tester/Pods/__offline_mirrors_hermes__
|
!/packages/rn-tester/Pods/__offline_mirrors_hermes__
|
||||||
!/packages/rn-tester/Pods/__offline_mirrors_jsc__
|
!/packages/rn-tester/Pods/__offline_mirrors_jsc__
|
||||||
|
|
||||||
# @react-native/codegen
|
# @react-native/codegen
|
||||||
/React/FBReactNativeSpec/FBReactNativeSpec
|
/React/FBReactNativeSpec/FBReactNativeSpec
|
||||||
/packages/react-native-codegen/lib
|
/packages/react-native-codegen/lib
|
||||||
/packages/react-native-codegen/tmp/
|
/packages/react-native-codegen/tmp/
|
||||||
/ReactCommon/react/renderer/components/rncore/
|
/ReactCommon/react/renderer/components/rncore/
|
||||||
/packages/rn-tester/NativeModuleExample/ScreenshotManagerSpec*
|
/packages/rn-tester/NativeModuleExample/ScreenshotManagerSpec*
|
||||||
|
|
||||||
|
|
||||||
# Additional SDKs
|
# Additional SDKs
|
||||||
/sdks/download
|
/sdks/download
|
||||||
/sdks/hermes
|
/sdks/hermes
|
||||||
/sdks/hermesc
|
/sdks/hermesc
|
||||||
|
|
||||||
# Visual studio
|
# Visual studio
|
||||||
.vscode
|
.vscode
|
||||||
.vs
|
.vs
|
||||||
|
|
||||||
# Android memory profiler files
|
# Android memory profiler files
|
||||||
*.hprof
|
*.hprof
|
||||||
|
|
||||||
# Temporary files created by Metro to check the health of the file watcher
|
# Temporary files created by Metro to check the health of the file watcher
|
||||||
.metro-health-check*
|
.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"
|
||||||
|
}
|
||||||
|
}
|
@ -1,17 +1,17 @@
|
|||||||
export const cards = [{
|
export const cards = [{
|
||||||
name : "blue",
|
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",
|
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
|
index : 3
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name : "red",
|
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",
|
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
|
index : 2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name : "green",
|
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",
|
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
|
index : 1
|
||||||
}
|
}
|
||||||
|
|
||||||
]
|
]
|
@ -1,68 +1,82 @@
|
|||||||
import { View, Text, Image, Animated ,PanResponder, Dimensions } from 'react-native'
|
import { View, Text, Image, Animated ,PanResponder, Dimensions, StyleSheet } from 'react-native'
|
||||||
import React, { useRef } from 'react'
|
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 {width : wWidht} = Dimensions.get("window");
|
||||||
const height = wWidht * (465/264);
|
const width = wWidht *0.75;
|
||||||
const borderRadius = 24;
|
const height = wWidht * (465/264);
|
||||||
|
const borderRadius = 24;
|
||||||
|
|
||||||
|
interface CardProps {
|
||||||
interface CardProps {
|
title: string;
|
||||||
title: string;
|
image: any;
|
||||||
image: any;
|
onSwipe: (direction: "left" | "right") => void;
|
||||||
onSwipe: (direction: "left" | "right") => void;
|
}
|
||||||
}
|
|
||||||
|
// const [loading, setLoading] = useState(true);
|
||||||
|
// const [cards, setCards] = useState(cardArray);
|
||||||
const Card: React.FC<CardProps> = ({ title, image, onSwipe }) => {
|
|
||||||
const pan = useRef(new Animated.ValueXY()).current;
|
// useEffect(()=>{
|
||||||
const panResponder = useRef(
|
// setLoading(true);
|
||||||
PanResponder.create({
|
// eventMethod().then(
|
||||||
onMoveShouldSetPanResponder: (evt, gestureState) => {
|
// setLoading(false);
|
||||||
// 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;
|
|
||||||
}
|
const Card: React.FC<CardProps> = ({ title, image, onSwipe }) => {
|
||||||
return false;
|
const pan = useRef(new Animated.ValueXY()).current;
|
||||||
},
|
const panResponder = useRef(
|
||||||
onPanResponderMove: (evt, gestureState) => {
|
PanResponder.create({
|
||||||
// Update the position of the card as the user swipes it
|
onMoveShouldSetPanResponder: (evt, gestureState) => {
|
||||||
pan.setValue({ x: gestureState.dx, y: 0 });
|
// Only set the pan responder if the user has moved the card more than a certain threshold
|
||||||
console.log("Card");
|
if (Math.abs(gestureState.dx) > 10) {
|
||||||
},
|
return true;
|
||||||
onPanResponderRelease: (evt, gestureState) => {
|
}
|
||||||
// Handle the swipe action based on the swipe direction
|
return false;
|
||||||
if (gestureState.dx > 50) {
|
},
|
||||||
onSwipe("right");
|
onPanResponderMove: (evt, gestureState) => {
|
||||||
} else if (gestureState.dx < -50) {
|
// Update the position of the card as the user swipes it
|
||||||
onSwipe("left");
|
pan.setValue({ x: gestureState.dx, y: 0 });
|
||||||
} else {
|
console.log("Card");
|
||||||
// Swiped a small amount, reset the position of the card
|
},
|
||||||
Animated.spring(pan, {
|
onPanResponderRelease: (evt, gestureState) => {
|
||||||
toValue: { x: 0, y: 0 },
|
// Handle the swipe action based on the swipe direction
|
||||||
useNativeDriver: true,
|
if (gestureState.dx > 50) {
|
||||||
}).start();
|
onSwipe("right");
|
||||||
}
|
} else if (gestureState.dx < -50) {
|
||||||
},
|
onSwipe("left");
|
||||||
})
|
} else {
|
||||||
).current;
|
// Swiped a small amount, reset the position of the card
|
||||||
|
Animated.spring(pan, {
|
||||||
return (
|
toValue: { x: 0, y: 0 },
|
||||||
<View>
|
useNativeDriver: true,
|
||||||
<Animated.View
|
}).start();
|
||||||
style={{ transform: [{ translateX: pan.x }] }}
|
}
|
||||||
{...panResponder.panHandlers}
|
},
|
||||||
>
|
})
|
||||||
<Image source={image} style={{ width: 200, height: 200 }} />
|
).current;
|
||||||
</Animated.View>
|
|
||||||
</View>
|
return (
|
||||||
);
|
<View>
|
||||||
};
|
<Animated.View
|
||||||
|
style={{ transform: [{ translateX: pan.x }], backgroundColor : 'red'}}
|
||||||
export default Card;
|
{...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…
Reference in new issue