hide email section for defaultUser

This commit is contained in:
heyethereum
2024-08-21 22:06:16 +08:00
parent a7d4f693fa
commit 7475215d44
3 changed files with 48 additions and 20 deletions

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

@@ -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,7 +180,9 @@ const SettingsScreen: React.FC = () => {
<View style={styles.divider} /> <View style={styles.divider} />
{/* Email Section */} {/* Email Section - Only show when userSource is "Google" */}
{userSource === "Google" && (
<>
<View style={styles.section}> <View style={styles.section}>
<View style={styles.emailRow}> <View style={styles.emailRow}>
<Text style={styles.sectionTitle}>Email: </Text> <Text style={styles.sectionTitle}>Email: </Text>
@@ -187,8 +193,10 @@ const SettingsScreen: React.FC = () => {
<Text style={styles.deleteAllButtonText}>Delete All Email</Text> <Text style={styles.deleteAllButtonText}>Delete All Email</Text>
</TouchableOpacity> </TouchableOpacity>
</View> </View>
<View style={styles.divider} /> <View style={styles.divider} />
</>
)}
{/* History & Bookmarks Section */} {/* History & Bookmarks Section */}
<View style={styles.section}> <View style={styles.section}>