From 6a00ec453db4f470f561420e78baa0db0faeb3f3 Mon Sep 17 00:00:00 2001 From: Isky Date: Fri, 16 Aug 2024 15:31:16 +0800 Subject: [PATCH] Added hasIpAddress display. Fixed Unknown User name for non-gmail users --- components/ScannedDataBox.tsx | 8 ++++++++ screens/SettingsScreen.tsx | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/components/ScannedDataBox.tsx b/components/ScannedDataBox.tsx index 01e7fc1..4adec6e 100644 --- a/components/ScannedDataBox.tsx +++ b/components/ScannedDataBox.tsx @@ -81,6 +81,9 @@ const ScannedDataBox: React.FC = ({ qrCodeId, clearScanData const isShorteningService = details.shorteningService === 'Yes'; const classification = details.classifications || 'Unknown'; + // New state to check if the URL contains an IP address + const hasIpAddress = details.hasIpAddress || ''; + // Function to get security text and icon based on the URL description const getSecurityStatus = () => { if (data.info?.description === "Secure Uniform Resource Locator") { @@ -250,6 +253,10 @@ const ScannedDataBox: React.FC = ({ qrCodeId, clearScanData {isShorteningService && ( This is a shortening service )} + {/* Conditionally display the IP address message */} + {hasIpAddress && ( + {hasIpAddress} + )} @@ -554,6 +561,7 @@ const ScannedDataBox: React.FC = ({ qrCodeId, clearScanData ); }; + const styles = StyleSheet.create({ // Row styles row: { diff --git a/screens/SettingsScreen.tsx b/screens/SettingsScreen.tsx index 402794b..69ba4a3 100644 --- a/screens/SettingsScreen.tsx +++ b/screens/SettingsScreen.tsx @@ -148,6 +148,9 @@ const SettingsScreen: React.FC = () => { ]); }; + + const userName = userAttributes?.name || (userEmail ? userEmail.split('@')[0] : 'Unknown User'); + return ( Settings @@ -156,7 +159,7 @@ const SettingsScreen: React.FC = () => { - Hello, {userAttributes?.name || 'Unknown User'} + Hello, {userName} {userAttributes ? (