diff --git a/app.json b/app.json index 0aa210f..1dc49c4 100644 --- a/app.json +++ b/app.json @@ -5,7 +5,7 @@ "version": "1.0.0", "orientation": "portrait", "icon": "./assets/images/icon.png", - "scheme": "myapp", + "scheme": "led.matrix", "userInterfaceStyle": "automatic", "newArchEnabled": true, "ios": { diff --git a/app/(tabs)/about.tsx b/app/(tabs)/about.tsx index 105598f..294ef22 100644 --- a/app/(tabs)/about.tsx +++ b/app/(tabs)/about.tsx @@ -1,21 +1,37 @@ -import { Text, View, StyleSheet } from 'react-native'; +import {StyleSheet, Text, View} from 'react-native'; +import React, {useState} from "react"; +import SpotifyAuthButton from "@/components/SpotifyAuthButton"; +import {Token} from "@/services/RestService"; export default function AboutScreen() { - return ( - - About screen - - ); + const [token, setToken] = useState(null); + + const handleAuthSuccess = (token: Token) => { + setToken(token); + console.log('Erhaltener Authentifizierungscode:', token); + // Hier kannst du den Code weiterverwenden, um das Access Token zu erhalten + }; + + return ( + + About screen + Willkommen bei der Spotify Authentifizierung + + {token && Erhaltener Code: {token.access_token}} + + + + ); } const styles = StyleSheet.create({ - container: { - flex: 1, - backgroundColor: '#25292e', - justifyContent: 'center', - alignItems: 'center', - }, - text: { - color: '#fff', - }, + container: { + flex: 1, + backgroundColor: '#25292e', + justifyContent: 'center', + alignItems: 'center', + }, + text: { + color: '#fff', + }, }); diff --git a/app/(tabs)/index.tsx b/app/(tabs)/index.tsx index bf2965e..0a6bc44 100644 --- a/app/(tabs)/index.tsx +++ b/app/(tabs)/index.tsx @@ -1,62 +1,65 @@ import {ActivityIndicator, StyleSheet, Text, View} from 'react-native'; import Button from '@/components/Button'; import ImageViewer from '@/components/ImageViewer'; - -const PlaceholderImage = require('@/assets/images/GarfieldCharakter.webp'); - import * as ImagePicker from 'expo-image-picker'; import {RestService} from '@/services/RestService'; import useService from '@/hooks/useService'; +const PlaceholderImage = require('@/assets/images/GarfieldCharakter.webp'); + +import * as WebBrowser from "expo-web-browser"; + +WebBrowser.maybeCompleteAuthSession(); + export default function Index() { - const {data, loading, error} = useService(RestService.fetchAllUser); + const {data: usersData, loading: userLoading, error: userError} = useService(RestService.fetchAllUser); - const pickImageAsync = async () => { - let result = await ImagePicker.launchImageLibraryAsync({ - mediaTypes: ['images'], - allowsEditing: true, - quality: 1, - }); + const pickImageAsync = async () => { + let result = await ImagePicker.launchImageLibraryAsync({ + mediaTypes: ['images'], + allowsEditing: true, + quality: 1, + }); - if (!result.canceled) { - console.log(result); - } else { - alert('You did not select any image.'); - } - }; + if (!result.canceled) { + console.log(result); + } else { + alert('You did not select any image.'); + } + }; - console.log(data); - return ( - - - + console.log(usersData); + return ( + + + + + + {userLoading && } + {userError && Error: {userError.message}} + {usersData && ( + + {usersData.users.map((item) => item.name).join('; ')} + + )} +