2 Commits

Author SHA1 Message Date
heyethereum
7475215d44 hide email section for defaultUser 2024-08-21 22:06:16 +08:00
heyethereum
a7d4f693fa fix default user sign in without gmail scan 2024-08-19 22:58:59 +08:00
5 changed files with 55 additions and 25 deletions

View File

@@ -1,2 +1,2 @@
NODE_ENV=development NODE_ENV=development
BASE_URL=http://192.168.10.247:8080 BASE_URL=http://192.168.1.30:8080

View File

@@ -0,0 +1,20 @@
{
"version": 3,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "com.safeqr.safeqr",
"variantName": "release",
"elements": [
{
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 1,
"versionName": "1.0.0",
"outputFile": "app-release.apk"
}
],
"elementType": "File"
}

BIN
android/keystore Normal file

Binary file not shown.

View File

@@ -34,18 +34,18 @@ const EmailScreen: React.FC = () => {
if (userInfo && userInfo.email) { if (userInfo && userInfo.email) {
setUserEmail(userInfo.email); setUserEmail(userInfo.email);
if (userInfo.email.endsWith('@gmail.com')) { if (userInfo.source === 'Google') {
startInboxScanning(); startInboxScanning();
} else { } else {
setEmptyMessage('Please login using a Gmail account to view Emails'); setEmptyMessage('Please Sign in with Google to scan your Gmails for QR Codes');
setLoading(false); setLoading(false);
} }
} else { } else {
setEmptyMessage('Please login using a Gmail account to view Emails'); setEmptyMessage('Please Sign in with Google to scan your Gmails for QR Codes');
setLoading(false); setLoading(false);
} }
} catch (error) { } catch (error) {
setEmptyMessage('Please login using a Gmail account to view Emails'); setEmptyMessage('Please Sign in with Google to scan your Gmails for QR Codes');
setLoading(false); setLoading(false);
} }
}; };
@@ -370,6 +370,8 @@ const styles = StyleSheet.create({
errorText: { errorText: {
color: '#ff69b4', color: '#ff69b4',
fontSize: screenWidth * 0.04, fontSize: screenWidth * 0.04,
fontWeight: 'bold',
textAlign: 'center',
}, },
rescanIndicator: { rescanIndicator: {
justifyContent: 'center', justifyContent: 'center',

View File

@@ -16,7 +16,7 @@ const handleSignInWithRedirect = async () => {
try { try {
await signInWithRedirect(); await signInWithRedirect();
} catch (error) { } catch (error) {
console.error('Error during sign in:', error); console.log('Error during sign in:', error);
} }
}; };
@@ -24,14 +24,18 @@ const SettingsScreen: React.FC = () => {
const { userAttributes } = useFetchUserAttributes(); const { userAttributes } = useFetchUserAttributes();
const [googleAccessToken, setGoogleAccessToken] = useState<string | null>(null); const [googleAccessToken, setGoogleAccessToken] = useState<string | null>(null);
const [userEmail, setUserEmail] = useState<string | null>(null); const [userEmail, setUserEmail] = useState<string | null>(null);
const [userSource, setUserSource] = useState<string | null>(null);
const fetchUserEmail = async () => { const fetchUserEmail = async () => {
try { try {
console.log('fetchUserEmail triggered'); console.log('fetchUserEmail triggered');
const userInfo = await getUserInfo(); const userInfo = await getUserInfo();
console.log("User Source: ", userInfo.source);
setUserSource(userInfo.source)
setUserEmail(userInfo.email); // Assuming userInfo has an email property setUserEmail(userInfo.email); // Assuming userInfo has an email property
} catch (error) { } catch (error) {
console.error('Error fetching user email:', error); console.log('Error fetching user email:', error);
} }
}; };
@@ -64,8 +68,8 @@ const SettingsScreen: React.FC = () => {
try { try {
parsedPayload = JSON.parse(decodedPayload); parsedPayload = JSON.parse(decodedPayload);
} catch (parseError) { } catch (parseError) {
console.error('Error parsing payload:', parseError); console.log('Error parsing payload:', parseError);
console.error(`Parse error: ${parseError.message}\nPayload: ${decodedPayload}`); console.log(`Parse error: ${parseError.message}\nPayload: ${decodedPayload}`);
return; return;
} }
@@ -92,13 +96,13 @@ const SettingsScreen: React.FC = () => {
console.log("date created: ", new Date(1721715837500).toLocaleString('en-US', options)); console.log("date created: ", new Date(1721715837500).toLocaleString('en-US', options));
} else { } else {
console.error('No Google access token found in the payload'); console.log('No Google access token found in the payload');
} }
} else { } else {
console.error('No ID token found in the session'); console.log('No ID token found in the session');
} }
} catch (error) { } catch (error) {
console.error('Error getting Google access token:', error); console.log('Error getting Google access token:', error);
} }
}; };
@@ -176,19 +180,23 @@ const SettingsScreen: React.FC = () => {
<View style={styles.divider} /> <View style={styles.divider} />
{/* Email Section */} {/* Email Section - Only show when userSource is "Google" */}
<View style={styles.section}> {userSource === "Google" && (
<View style={styles.emailRow}> <>
<Text style={styles.sectionTitle}>Email: </Text> <View style={styles.section}>
<Text style={styles.userEmail}>{userEmail || 'Loading...'}</Text> <View style={styles.emailRow}>
</View> <Text style={styles.sectionTitle}>Email: </Text>
<TouchableOpacity style={styles.deleteAllButton} onPress={handleDeleteAllEmails}> <Text style={styles.userEmail}>{userEmail || 'Loading...'}</Text>
<Ionicons name="trash-outline" size={24} color="#fff" style={styles.buttonIcon} /> </View>
<Text style={styles.deleteAllButtonText}>Delete All Email</Text> <TouchableOpacity style={styles.deleteAllButton} onPress={handleDeleteAllEmails}>
</TouchableOpacity> <Ionicons name="trash-outline" size={24} color="#fff" style={styles.buttonIcon} />
</View> <Text style={styles.deleteAllButtonText}>Delete All Email</Text>
</TouchableOpacity>
</View>
<View style={styles.divider} />
</>
)}
<View style={styles.divider} />
{/* History & Bookmarks Section */} {/* History & Bookmarks Section */}
<View style={styles.section}> <View style={styles.section}>