feat: implement authentication flow and session management

- Update RootLayout to handle authentication state and redirect users based on their auth status.
- Create an Index component to redirect unauthenticated users to the login page.
- Modify ApiAuthRepository to fetch user session data using access and refresh tokens.
- Introduce a new container file to manage use case instances for authentication and filament operations.
- Enhance authStore to validate tokens and fetch user data from the API.
- Add babel-plugin-module-resolver for improved module imports.
- Update package.json scripts for running the app on Android and iOS.
- Add expo-camera dependency for camera functionalities.
- Update tsconfig.json to include infrastructure path mapping.
This commit is contained in:
2026-03-14 13:22:17 -03:00
parent d7fb768d3b
commit 416e13893c
68 changed files with 1778 additions and 99 deletions
+10 -14
View File
@@ -5,6 +5,7 @@ import {
import { useLocalSearchParams, useRouter } from 'expo-router';
import { Ionicons } from '@expo/vector-icons';
import { SafeAreaView } from 'react-native-safe-area-context';
import QRCode from 'react-native-qrcode-svg';
import { useFilamentStore } from '@store/filamentStore';
import { colors, typography, spacing, radius } from '@shared/theme';
import { Button } from '@presentation/components/ui/Button';
@@ -23,19 +24,18 @@ export default function QRCodeScreen(): React.ReactElement {
? `${filament.brand.toLowerCase()}-${(filament.model ?? '').toLowerCase()}-${filament.colorHex.replace('#', '').toLowerCase()}`.replace(/\s+/g, '-')
: 'desconhecido';
const deepLink = `meowspool.app/f/${slug}`;
const deepLink = `meowspool://filament/${id}`;
async function handleShare(): Promise<void> {
try {
await Share.share({ message: `meowspool://filament/${id}`, url: `https://${deepLink}` });
await Share.share({ message: deepLink });
} catch {
// cancelled
}
}
async function handleCopyLink(): Promise<void> {
// expo-clipboard not installed — show alert as placeholder
Alert.alert('Link copiado', deepLink);
Alert.alert('Link', deepLink);
}
if (!filament) {
@@ -75,10 +75,12 @@ export default function QRCodeScreen(): React.ReactElement {
{/* QR Code area */}
<View style={styles.qrContainer}>
<View style={styles.qrCard}>
{/* Placeholder QR — real impl would use react-native-qrcode-svg */}
<View style={styles.qrPlaceholder}>
<Ionicons name="qr-code" size={160} color={colors.black} />
</View>
<QRCode
value={deepLink}
size={200}
backgroundColor="#F5EFE0"
color="#1E1B18"
/>
</View>
<Text style={styles.qrHint}>Aponte a câmera para escanear</Text>
<View style={styles.linkBadge}>
@@ -149,12 +151,6 @@ const styles = StyleSheet.create({
borderRadius: radius.xl,
padding: spacing[6],
},
qrPlaceholder: {
width: 200,
height: 200,
alignItems: 'center',
justifyContent: 'center',
},
qrHint: {
fontFamily: typography.fontFamily.ui,
fontSize: typography.fontSize.sm,