diff --git a/app.json b/app.json
index 83d493c..2b485b5 100644
--- a/app.json
+++ b/app.json
@@ -15,9 +15,7 @@
"android": {
"adaptiveIcon": {
"backgroundColor": "#E6F4FE",
- "foregroundImage": "./assets/images/android-icon-foreground.png",
- "backgroundImage": "./assets/images/android-icon-background.png",
- "monochromeImage": "./assets/images/android-icon-monochrome.png"
+ "foregroundImage": "./assets/images/adaptive-icon.png"
},
"edgeToEdgeEnabled": true,
"predictiveBackGestureEnabled": false,
diff --git a/app/(protected)/_layout.tsx b/app/(protected)/_layout.tsx
index 9da82f3..0189b63 100644
--- a/app/(protected)/_layout.tsx
+++ b/app/(protected)/_layout.tsx
@@ -43,35 +43,35 @@ export default function ProtectedLayout() {
name="index"
options={{
title: 'Home',
- tabBarIcon: ({ color, size }) => ,
+ tabBarIcon: ({ color, size }) => ,
}}
/>
,
+ tabBarIcon: ({ color, size }) => ,
}}
/>
,
+ tabBarIcon: ({ color, size }) => ,
}}
/>
,
+ tabBarIcon: ({ color, size }) => ,
}}
/>
,
+ tabBarIcon: ({ color, size }) => ,
href: authState.user?.role === 'Amministratore' ? undefined : null,
}}
/>
@@ -80,6 +80,7 @@ export default function ProtectedLayout() {
name="profile"
options={{
href: null,
+ tabBarStyle: { display: 'none' },
title: 'Profilo',
}}
/>
diff --git a/app/(protected)/attendance/index.tsx b/app/(protected)/attendance/index.tsx
index f40fe06..c7cb39f 100644
--- a/app/(protected)/attendance/index.tsx
+++ b/app/(protected)/attendance/index.tsx
@@ -10,9 +10,11 @@ import React, { useEffect, useState } from 'react';
import { RefreshControl, ScrollView, Text, TouchableOpacity, View } from 'react-native';
import NfcManager from 'react-native-nfc-manager';
import { SafeAreaView } from 'react-native-safe-area-context';
+import { useLocalSearchParams } from 'expo-router';
export default function AttendanceScreen() {
const [scannerType, setScannerType] = useState<'qr' | 'nfc'>('qr');
+ const { autoScan } = useLocalSearchParams();
const alert = useAlert();
const [showScanner, setShowScanner] = useState(false);
const [lastScan, setLastScan] = useState<{ type: string; time: string; site: string } | null>(null);
@@ -47,10 +49,19 @@ export default function AttendanceScreen() {
};
useEffect(() => {
- checkNfcAvailability();
- fetchAttendances();
- setLastScan(null);
- }, []);
+ const init = async () => {
+ await checkNfcAvailability();
+ fetchAttendances();
+ setLastScan(null);
+
+ if (autoScan === 'true') {
+ setTimeout(() => {
+ handleStartScan();
+ }, 300);
+ }
+ };
+ init();
+ }, [autoScan]);
const onRefresh = () => {
setRefreshing(true);
diff --git a/app/(protected)/index.tsx b/app/(protected)/index.tsx
index 9028ac9..aa554e3 100644
--- a/app/(protected)/index.tsx
+++ b/app/(protected)/index.tsx
@@ -74,7 +74,7 @@ export default function HomeScreen() {
{user?.name} {user?.surname}
- {user?.role}
+ {user?.role}
@@ -119,7 +119,7 @@ export default function HomeScreen() {
Azioni Rapide
router.push('/attendance')}
+ onPress={() => router.push('/attendance?autoScan=true')}
className="flex-1 bg-white p-6 rounded-3xl shadow-sm items-center justify-center gap-4 border border-gray-100 active:scale-[0.98]"
>
diff --git a/assets/images/adaptive-icon.png b/assets/images/adaptive-icon.png
index e37b66f..4dfe148 100644
Binary files a/assets/images/adaptive-icon.png and b/assets/images/adaptive-icon.png differ
diff --git a/assets/images/android-icon-background.png b/assets/images/android-icon-background.png
deleted file mode 100644
index 5ffefc5..0000000
Binary files a/assets/images/android-icon-background.png and /dev/null differ
diff --git a/assets/images/android-icon-foreground.png b/assets/images/android-icon-foreground.png
deleted file mode 100644
index 3a9e501..0000000
Binary files a/assets/images/android-icon-foreground.png and /dev/null differ
diff --git a/assets/images/android-icon-monochrome.png b/assets/images/android-icon-monochrome.png
deleted file mode 100644
index 77484eb..0000000
Binary files a/assets/images/android-icon-monochrome.png and /dev/null differ
diff --git a/assets/images/icon.png b/assets/images/icon.png
deleted file mode 100644
index d1a6ecb..0000000
Binary files a/assets/images/icon.png and /dev/null differ
diff --git a/components/QrScanModal.tsx b/components/QrScanModal.tsx
index 47c9916..021b478 100644
--- a/components/QrScanModal.tsx
+++ b/components/QrScanModal.tsx
@@ -1,5 +1,5 @@
import React, { useState, useEffect, useRef } from 'react';
-import { View, Text, Modal, TouchableOpacity, Vibration, StyleSheet, Dimensions } from 'react-native';
+import { View, Text, Modal, TouchableOpacity, Vibration, StyleSheet, useWindowDimensions } from 'react-native';
import { SafeAreaView } from 'react-native-safe-area-context';
import { CameraView, useCameraPermissions } from 'expo-camera';
import { X, ScanLine } from 'lucide-react-native';
@@ -14,17 +14,16 @@ export default function QrScanModal({ visible, onClose, onScan }: QrScanModalPro
const [permission, requestPermission] = useCameraPermissions();
const [scanned, setScanned] = useState(false);
const scanInProgress = useRef(false);
- const { width, height } = Dimensions.get('window');
+ const { width, height } = useWindowDimensions();
const squareSize = Math.min(width * 0.8, height * 0.8, 400);
- // Permission Handling and Reset Scanned State on Modal Open
+ // Permission handling and scanned state reset on modal open
useEffect(() => {
- if (visible) {
- setScanned(false);
- scanInProgress.current = false;
- if (permission && !permission.granted && permission.canAskAgain) {
- requestPermission();
- }
+ if (!visible) return;
+ setScanned(false);
+ scanInProgress.current = false;
+ if (permission && !permission.granted && permission.canAskAgain) {
+ requestPermission();
}
}, [visible, permission]);
@@ -43,10 +42,6 @@ export default function QrScanModal({ visible, onClose, onScan }: QrScanModalPro
return ;
}
- if (!permission.granted && visible) {
- requestPermission();
- }
-
return (
- {/* Dark Overlay with Transparent "Hole" (Visually Simulated with Borders or Opacity) */}
-
- {/* Header Overlay */}
-
- Scansiona QR Code
- Inquadra il codice nel riquadro
-
+ {/* Mask Overlay with transparent cutout */}
+
+
+
+
- {/* Central Area (Transparent for the camera) */}
-
-
- {/* Decorative Corners */}
+ {/* Scanner Target Frame */}
+
- {/* Animated Scan Line or Icon */}
- {!scanned && }
+ {!scanned && }
-
- {/* Footer Overlay */}
-
-
-
-
- Chiudi
+
+
+
+
+
+ {/* UI Overlay */}
+
+
+ {/* Header */}
+
+
+ Scansiona QR Code
+
+
+ Inquadra il codice nel riquadro
+
+
+
+ {/* Footer */}
+
+
+
+
+
+
+ Chiudi
+
+