aboutsummaryrefslogtreecommitdiff
path: root/src/app/biometrics.tsx
blob: 500adc903eb88d52dda43ec257d2941652b1b1dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
import React from 'react';
import { View, Text, StyleSheet } from 'react-native';
import { useRouter } from 'expo-router';
import * as SecureStore from 'expo-secure-store';
import Animated, { FadeInDown, FadeInUp } from 'react-native-reanimated';
import { Feather } from '@expo/vector-icons';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
import { Button } from '@/components/ui/button';
import { Colors, Spacing, Typography, Radius } from '@/constants/theme';
import { BlurView } from 'expo-blur';

export default function BiometricsScreen() {
    const router = useRouter();
    const insets = useSafeAreaInsets();

    async function handleAccept() {
        await SecureStore.setItemAsync('yaba_use_biometrics', 'true');
        router.replace('/');
    }

    function handleDecline() {
        router.replace('/');
    }

    return (
        <View style={[styles.container, { paddingTop: insets.top, paddingBottom: insets.bottom }]}>

            <View style={styles.content}>
                <Animated.View entering={FadeInDown.duration(600).delay(100)} style={styles.iconContainer}>
                    <View style={styles.iconBackground}>
                        <Feather size={64} color={Colors.primary} />
                    </View>
                </Animated.View>

                <Animated.View entering={FadeInUp.duration(600).delay(200)} style={styles.textContainer}>
                    <Text style={styles.title}>Login por Biometria</Text>
                    <Text style={styles.subtitle}>
                        Deseja utilizar sua biometria (Face ID / Digital) para acessar o app mais rapidamente nas próximas vezes?
                    </Text>
                </Animated.View>
            </View>

            <Animated.View entering={FadeInUp.duration(600).delay(400)} style={styles.footer}>
                <BlurView intensity={80} tint="dark" style={styles.blurContainer}>
                    <Button
                        label="Sim, usar biometria"
                        onPress={handleAccept}
                        fullWidth
                        style={styles.primaryButton}
                    />
                    <Button
                        label="Não, manter acesso livre"
                        variant="ghost"
                        onPress={handleDecline}
                        fullWidth
                    />
                </BlurView>
            </Animated.View>
        </View>
    );
}

const styles = StyleSheet.create({
    container: {
        flex: 1,
        backgroundColor: Colors.background,
        justifyContent: 'space-between',
    },
    content: {
        flex: 1,
        justifyContent: 'center',
        alignItems: 'center',
        paddingHorizontal: Spacing.xl,
        gap: Spacing.xxl,
    },
    iconContainer: {
        alignItems: 'center',
    },
    iconBackground: {
        width: 120,
        height: 120,
        borderRadius: 60,
        backgroundColor: 'rgba(238, 250, 13, 0.1)',
        alignItems: 'center',
        justifyContent: 'center',
        borderWidth: 1,
        borderColor: 'rgba(238, 250, 13, 0.2)',
    },
    textContainer: {
        alignItems: 'center',
        gap: Spacing.sm,
    },
    title: {
        ...Typography.h1,
        color: Colors.textPrimary,
        textAlign: 'center',
    },
    subtitle: {
        ...Typography.bodyLarge,
        color: Colors.textSecondary,
        textAlign: 'center',
        lineHeight: 24,
    },
    footer: {
        paddingHorizontal: Spacing.lg,
        paddingBottom: Spacing.lg,
    },
    blurContainer: {
        padding: Spacing.lg,
        borderRadius: Radius.lg,
        gap: Spacing.md,
        backgroundColor: 'rgba(22, 27, 34, 0.6)',
        borderWidth: 1,
        borderColor: 'rgba(255, 255, 255, 0.08)',
        overflow: 'hidden',
    },
    primaryButton: {
        height: 56,
    }
});