diff --git a/App.tsx b/App.tsx index 42c16d8..b9bccbb 100644 --- a/App.tsx +++ b/App.tsx @@ -30,16 +30,22 @@ const App: React.FC = () => { - } - > + } + screenOptions={{ headerShown: false }} // turn of header for all screens + > {(props) => } + + + + + diff --git a/assets/SafeQR_Logo 1.png b/assets/SafeQR_Logo 1.png new file mode 100644 index 0000000..31c4c19 Binary files /dev/null and b/assets/SafeQR_Logo 1.png differ diff --git a/assets/favicon.png b/assets/favicon.png index e75f697..e9afa27 100644 Binary files a/assets/favicon.png and b/assets/favicon.png differ diff --git a/assets/icon.png b/assets/icon.png index a0b1526..aac2746 100644 Binary files a/assets/icon.png and b/assets/icon.png differ diff --git a/components/ScannedDataBox.tsx b/components/ScannedDataBox.tsx index f4efce8..46219e5 100644 --- a/components/ScannedDataBox.tsx +++ b/components/ScannedDataBox.tsx @@ -76,7 +76,7 @@ const ScannedDataBox: React.FC = ({ qrCodeId, clearScanData } }; - const getRedirectIcon = () => { + const getSheildIcon = () => { if (redirects === 0) { return ; } else if (redirects <= 2) { @@ -99,19 +99,24 @@ const ScannedDataBox: React.FC = ({ qrCodeId, clearScanData }; return ( + + + + {/* The Top Scan Icon with payload, truncated */} setIsContentModalVisible(true)}> - {truncateContent(contents, 30)} {/* Truncated content further */} + {truncateContent(contents, 30)} + {/* Display QR Code , timestamp and Description */} @@ -123,11 +128,12 @@ const ScannedDataBox: React.FC = ({ qrCodeId, clearScanData - + {/* The Main Result in appropriate color */} Result: {getResultText()} + {/* Change the UI based on Type */} {type === 'URL' && ( <> @@ -140,33 +146,21 @@ const ScannedDataBox: React.FC = ({ qrCodeId, clearScanData <> Not Secure + + + )} setIsRedirectModalVisible(true)}> - {getRedirectIcon()} + {getSheildIcon()} Redirects - - )} - {type === 'SMS' && ( - <> - Recipient Phone Number: {details.phone || 'Undefined'} - Message Content: {details.message || 'Undefined'} - - )} - {type === 'TEXT' && ( - setIsContentModalVisible(true)}> - - Content: {truncateContent(contents, 30)} {/* Truncated content further */} - - - )} - setIsModalVisible(true)}> + setIsModalVisible(true)}> Security Headers @@ -210,6 +204,32 @@ const ScannedDataBox: React.FC = ({ qrCodeId, clearScanData + + + )} + + {type === 'SMS' && ( + <> + Recipient Phone Number: {details.phone || 'Undefined'} + Message Content: {details.message || 'Undefined'} + + )} + + {type === 'TEXT' && ( + setIsContentModalVisible(true)}> + + Content: {truncateContent(contents, 30)} {/* Truncated content further */} + + + + + + + + )} + + + { return ( - // Wrap the navigator in a NavigationContainer to manage the navigation tree - - {/* Define the tab navigator with custom tab bar and initial route */} - }> - - {/* Define each tab with a name and corresponding component */} + } + > - + ); }; -export default AppNavigator; \ No newline at end of file +export default AppNavigator; diff --git a/package-lock.json b/package-lock.json index 7265a1b..2f5ecc6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -42,7 +42,8 @@ "react-native-svg": "15.2.0", "react-native-webview": "^13.8.6", "react-redux": "^9.1.2", - "redux": "^5.0.1" + "redux": "^5.0.1", + "safeqr": "file:" }, "devDependencies": { "@babel/core": "^7.20.0", @@ -16952,6 +16953,10 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/safeqr": { + "resolved": "", + "link": true + }, "node_modules/sax": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/sax/-/sax-1.4.1.tgz", diff --git a/package.json b/package.json index 60b0c1f..d602848 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,8 @@ "react-native-svg": "15.2.0", "react-native-webview": "^13.8.6", "react-redux": "^9.1.2", - "redux": "^5.0.1" + "redux": "^5.0.1", + "safeqr": "file:" }, "devDependencies": { "@babel/core": "^7.20.0", diff --git a/screens/QRScannerScreen.tsx b/screens/QRScannerScreen.tsx index 1ab36b8..eec6d21 100644 --- a/screens/QRScannerScreen.tsx +++ b/screens/QRScannerScreen.tsx @@ -1,5 +1,5 @@ import React, { useState, useEffect, useCallback } from 'react'; -import { View, Text, StyleSheet, ActivityIndicator, TouchableOpacity, Modal, TouchableWithoutFeedback } from 'react-native'; +import { View, Text, StyleSheet, ActivityIndicator, TouchableOpacity, Modal, Image, Dimensions } from 'react-native'; import { Camera, CameraView, scanFromURLAsync } from 'expo-camera'; import { Ionicons } from '@expo/vector-icons'; import { useFocusEffect, useNavigation } from '@react-navigation/native'; @@ -7,10 +7,11 @@ import * as ImagePicker from 'expo-image-picker'; import ScannedDataBox from '../components/ScannedDataBox'; import { useDispatch } from 'react-redux'; import { AppDispatch } from '../store'; -import { addQRCode } from '../reducers/qrCodesReducer'; import { scanQRCode, getUserInfo } from '../api/qrCodeAPI'; import SettingsScreen from './SettingsScreen'; +const { width: screenWidth, height: screenHeight } = Dimensions.get('window'); + const QRScannerScreen: React.FC<{ clearScanData: () => void }> = ({ clearScanData }) => { const navigation = useNavigation(); // Navigation hook const dispatch = useDispatch(); // Use dispatch for Redux actions @@ -141,8 +142,9 @@ const QRScannerScreen: React.FC<{ clearScanData: () => void }> = ({ clearScanDat return ( - SafeQR - Welcome to SafeQR code Scanner + Welcome to + + Please point the camera at the QR Code {cameraVisible && ( @@ -155,27 +157,26 @@ const QRScannerScreen: React.FC<{ clearScanData: () => void }> = ({ clearScanDat )} - + - + {/* Scanned Data Box */} {isScannedDataBoxVisible && ( - - setIsScannedDataBoxVisible(false)} - /> - -)} - + + setIsScannedDataBoxVisible(false)} + /> + + )} {/* Settings Icon */} setIsSettingsModalVisible(true)} style={styles.settingsButton}> - + {/* Settings Modal */} @@ -205,12 +206,36 @@ const styles = StyleSheet.create({ backgroundColor: '#f8f0fc', padding: 20, }, - headerText: { - fontSize: 24, - fontWeight: 'bold', - color: '#ff69b4', + titleText: { textAlign: 'center', - marginBottom: 20, + fontSize: 20, + marginTop: screenHeight * 0.05, + color: 'black', + }, + logo: { + alignSelf: 'center', + width: screenWidth * 0.5, + height: screenWidth * 0.2, + resizeMode: 'contain', + marginVertical: 10, + }, + welcomeText: { + textAlign: 'center', + fontSize: 20, + marginVertical: 10, + color: 'black', + }, + cameraContainer: { + height: '60%', + alignItems: 'center', + justifyContent: 'center', + borderRadius: 10, + overflow: 'hidden', + }, + settingsButton: { + position: 'absolute', + top: screenHeight * 0.05, + right: 20, }, splashContainer: { flex: 1, @@ -220,38 +245,31 @@ const styles = StyleSheet.create({ height: '100%', width: '100%', }, - cameraContainer: { - height: '60%', - alignItems: 'center', - justifyContent: 'center', - borderRadius: 10, - overflow: 'hidden', - }, camera: { width: '100%', height: '100%', }, flashButton: { position: 'absolute', - bottom: 20, - left: 100, - width: 50, - height: 50, + bottom: screenHeight * 0.025, + left: screenWidth * 0.2, + width: screenWidth * 0.125, + height: screenWidth * 0.125, justifyContent: 'center', alignItems: 'center', backgroundColor: '#000', - borderRadius: 25, + borderRadius: screenWidth * 0.0625, }, galleryButton: { position: 'absolute', - bottom: 20, - right: 100, - width: 50, - height: 50, + bottom: screenHeight * 0.025, + right: screenWidth * 0.2, + width: screenWidth * 0.125, + height: screenWidth * 0.125, justifyContent: 'center', alignItems: 'center', backgroundColor: '#000', - borderRadius: 25, + borderRadius: screenWidth * 0.0625, }, scannedDataBoxPopup: { position: 'absolute', @@ -259,51 +277,39 @@ const styles = StyleSheet.create({ left: '5%', right: '5%', zIndex: 2, - backgroundColor: 'white', // Optional: Set a background color if needed - borderRadius: 10, // Optional: Add rounded corners - padding: 10, // Optional: Add padding around the content - elevation: 5, // Optional: Add elevation for shadow effect - }, - - welcomeText: { - textAlign: 'center', - fontSize: 20, - marginVertical: 10, - color: 'black', - }, - settingsButton: { - position: 'absolute', - top: 40, - right: 20, - zIndex: 2, + backgroundColor: 'white', + borderRadius: screenWidth * 0.025, + padding: screenWidth * 0.025, + elevation: 5, }, + settingsModal: { backgroundColor: 'rgba(0, 0, 0, 0.5)', // Semi-transparent background }, settingsModalContainer: { - flex: 2, - justifyContent: 'center', // Center the modal vertically + flex: 1, + justifyContent: 'center', backgroundColor: 'rgba(0, 0, 0, 0.5)', }, - settingsModalContent: { + settingsModalContent: { width: '100%', - height: '80%', // Increase the height to make the modal taller + height: '80%', backgroundColor: 'white', - padding: 20, - borderTopLeftRadius: 10, - borderTopRightRadius: 10, + padding: screenWidth * 0.05, + borderTopLeftRadius: screenWidth * 0.025, + borderTopRightRadius: screenWidth * 0.025, alignItems: 'center', }, closeButton: { - marginTop: 10, - padding: 10, + marginTop: screenHeight * 0.01, + padding: screenWidth * 0.025, backgroundColor: '#ff69b4', - borderRadius: 5, + borderRadius: screenWidth * 0.0125, }, closeButtonText: { color: 'white', fontWeight: 'bold', - } + }, }); -export default QRScannerScreen; \ No newline at end of file +export default QRScannerScreen; diff --git a/temp/Sample QR/To Whatsapp.png b/temp/Sample QR/To Whatsapp.png new file mode 100644 index 0000000..349f828 Binary files /dev/null and b/temp/Sample QR/To Whatsapp.png differ