Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Add Android specific header style (#846)
Leendert de Borstadb2f9a3d6cf
diff --git a/apps/mobile-app/app/(tabs)/credentials/_layout.tsx b/apps/mobile-app/app/(tabs)/credentials/_layout.tsxindex 1b18c6e83..1bfdf8963 100644--- a/apps/mobile-app/app/(tabs)/credentials/_layout.tsx+++ b/apps/mobile-app/app/(tabs)/credentials/_layout.tsx@@ -1,10 +1,12 @@import { Stack } from 'expo-router';-import { Platform } from 'react-native';+import { Platform, Text } from 'react-native';import { defaultHeaderOptions } from '@/components/themed/ThemedHeader';+import { AndroidHeader } from '@/components/ui/AndroidHeader';/*** Credentials layout.+ * @returns {React.ReactNode} The credentials layout component*/export default function CredentialsLayout(): React.ReactNode {return (@@ -12,7 +14,15 @@ export default function CredentialsLayout(): React.ReactNode {<Stack.Screenname="index"options={{- headerShown: false,+ title: 'Credentials',+ headerShown: Platform.OS === 'android',+ /**+ * On Android, we use a custom header component that includes the AliasVault logo.+ * On iOS, we don't show the header as a custom collapsible header is used.+ * @returns {React.ReactNode} The header component+ */+ headerTitle: (): React.ReactNode => Platform.OS === 'android' ? <AndroidHeader title="Credentials" /> : <Text>Credentials</Text>,+ ...defaultHeaderOptions,}}/><Stack.Screendiff --git a/apps/mobile-app/app/(tabs)/credentials/index.tsx b/apps/mobile-app/app/(tabs)/credentials/index.tsxindex d745e0844..de6b52c30 100644--- a/apps/mobile-app/app/(tabs)/credentials/index.tsx+++ b/apps/mobile-app/app/(tabs)/credentials/index.tsx@@ -222,7 +222,7 @@ export default function CredentialsScreen() : React.ReactNode {flex: 1,paddingBottom: insets.bottom,paddingHorizontal: 14,- paddingTop: insets.top,+ paddingTop: Platform.OS === 'android' ? insets.top + 24 : insets.top,},contentContainer: {paddingBottom: 40,diff --git a/apps/mobile-app/app/(tabs)/emails/_layout.tsx b/apps/mobile-app/app/(tabs)/emails/_layout.tsxindex 988148489..b4d4f60d6 100644--- a/apps/mobile-app/app/(tabs)/emails/_layout.tsx+++ b/apps/mobile-app/app/(tabs)/emails/_layout.tsx@@ -1,4 +1,8 @@import { Stack } from 'expo-router';+import { Platform, Text } from 'react-native';++import { defaultHeaderOptions } from '@/components/themed/ThemedHeader';+import { AndroidHeader } from '@/components/ui/AndroidHeader';/*** Emails layout.@@ -9,7 +13,15 @@ export default function EmailsLayout(): React.ReactNode {<Stack.Screenname="index"options={{- headerShown: false,+ title: 'Emails',+ headerShown: Platform.OS === 'android',+ /**+ * On Android, we use a custom header component that includes the AliasVault logo.+ * On iOS, we don't show the header as a custom collapsible header is used.+ * @returns {React.ReactNode} The header component+ */+ headerTitle: (): React.ReactNode => Platform.OS === 'android' ? <AndroidHeader title="Emails" /> : <Text>Emails</Text>,+ ...defaultHeaderOptions,}}/><Stack.Screendiff --git a/apps/mobile-app/app/(tabs)/emails/index.tsx b/apps/mobile-app/app/(tabs)/emails/index.tsxindex 23bd3b64b..afc6d4fac 100644--- a/apps/mobile-app/app/(tabs)/emails/index.tsx+++ b/apps/mobile-app/app/(tabs)/emails/index.tsx@@ -159,7 +159,7 @@ export default function EmailsScreen() : React.ReactNode {flex: 1,paddingBottom: insets.bottom,paddingHorizontal: 14,- paddingTop: insets.top,+ paddingTop: Platform.OS === 'android' ? insets.top + 24 : insets.top,},contentContainer: {paddingBottom: 40,diff --git a/apps/mobile-app/app/(tabs)/settings/_layout.tsx b/apps/mobile-app/app/(tabs)/settings/_layout.tsxindex cb4f58f42..648ae4c4e 100644--- a/apps/mobile-app/app/(tabs)/settings/_layout.tsx+++ b/apps/mobile-app/app/(tabs)/settings/_layout.tsx@@ -1,6 +1,8 @@import { Stack } from 'expo-router';+import { Platform, Text } from 'react-native';import { defaultHeaderOptions } from '@/components/themed/ThemedHeader';+import { AndroidHeader } from '@/components/ui/AndroidHeader';/*** Settings layout.@@ -11,7 +13,15 @@ export default function SettingsLayout(): React.ReactNode {<Stack.Screenname="index"options={{- headerShown: false,+ title: 'Settings',+ headerShown: Platform.OS === 'android',+ /**+ * On Android, we use a custom header component that includes the AliasVault logo.+ * On iOS, we don't show the header as a custom collapsible header is used.+ * @returns {React.ReactNode} The header component+ */+ headerTitle: (): React.ReactNode => Platform.OS === 'android' ? <AndroidHeader title="Settings" /> : <Text>Settings</Text>,+ ...defaultHeaderOptions,}}/><Stack.Screendiff --git a/apps/mobile-app/app/(tabs)/settings/index.tsx b/apps/mobile-app/app/(tabs)/settings/index.tsxindex e6911ff83..056d2b454 100644--- a/apps/mobile-app/app/(tabs)/settings/index.tsx+++ b/apps/mobile-app/app/(tabs)/settings/index.tsx@@ -130,7 +130,7 @@ export default function SettingsScreen() : React.ReactNode {flex: 1,paddingBottom: insets.bottom,paddingHorizontal: 14,- paddingTop: insets.top,+ paddingTop: Platform.OS === 'android' ? insets.top + 24 : insets.top,},scrollContent: {paddingBottom: 40,diff --git a/apps/mobile-app/components/themed/ThemedHeader.tsx b/apps/mobile-app/components/themed/ThemedHeader.tsxindex 049a72046..2b2aa4f4f 100644--- a/apps/mobile-app/components/themed/ThemedHeader.tsx+++ b/apps/mobile-app/components/themed/ThemedHeader.tsx@@ -13,6 +13,10 @@ export function ThemedHeader(): React.ReactNode {const colors = useColors();const styles = StyleSheet.create({+ androidHeader: {+ backgroundColor: colors.headerBackgroundAndroid,+ height: 56,+ },header: {flex: 1,},@@ -32,12 +36,19 @@ export function ThemedHeader(): React.ReactNode {<BlurViewtint={colorScheme === 'dark' ? 'dark' : 'light'}intensity={colorScheme === 'dark' ? 90 : 100}- style={[StyleSheet.absoluteFill, { backgroundColor: colors.headerBackground }]}+ style={[StyleSheet.absoluteFill, { backgroundColor: colors.headerBackgroundIos }]}/><View style={[styles.headerBorder, { backgroundColor: colors.headerBorder }]} /></View>);}+ else if (Platform.OS === 'android') {+ return (+ <View style={[styles.header, styles.androidHeader]}>+ <View style={[styles.headerBorder, { backgroundColor: colors.headerBorder }]} />+ </View>+ );+ }return null;}diff --git a/apps/mobile-app/components/ui/AndroidHeader.tsx b/apps/mobile-app/components/ui/AndroidHeader.tsxnew file mode 100644index 000000000..01a163d3b--- /dev/null+++ b/apps/mobile-app/components/ui/AndroidHeader.tsx@@ -0,0 +1,37 @@+import { View, StyleSheet } from 'react-native';+import { ThemedText } from '@/components/themed/ThemedText';+import Logo from '@/assets/images/logo.svg';++interface IAndroidHeaderProps {+ title: string;+}++/**+ * Custom header component for Android that includes the AliasVault logo.+ * @param {IAndroidHeaderProps} props - The component props+ * @returns {React.ReactNode} The Android header component+ */+export function AndroidHeader({ title }: IAndroidHeaderProps): React.ReactNode {+ return (+ <View style={styles.headerContainer}>+ <Logo width={40} height={40} style={styles.logo} />+ <ThemedText style={styles.headerTitle}>{title}</ThemedText>+ </View>+ );+}++const styles = StyleSheet.create({+ headerContainer: {+ alignItems: 'center',+ flexDirection: 'row',+ gap: 8,+ verticalAlign: 'middle',+ },+ headerTitle: {+ fontSize: 22,+ fontWeight: 'bold',+ },+ logo: {+ marginBottom: 0,+ },+});\ No newline at end of filediff --git a/apps/mobile-app/components/ui/CollapsibleHeader.tsx b/apps/mobile-app/components/ui/CollapsibleHeader.tsxindex ed8e41fff..1ea217cb7 100644--- a/apps/mobile-app/components/ui/CollapsibleHeader.tsx+++ b/apps/mobile-app/components/ui/CollapsibleHeader.tsx@@ -26,6 +26,8 @@ type CollapsibleHeaderProps = {/*** Collapsible header component.+ * For iOS: Shows a collapsible header with blur effect+ * For Android: Returns null and uses native header instead*/export function CollapsibleHeader({title,@@ -38,6 +40,11 @@ export function CollapsibleHeader({const colorScheme = useColorScheme();const insets = useSafeAreaInsets();+ // For Android, let the native header handle it. We do add a padding to the top of the screen to account for the status bar.+ if (Platform.OS === 'android') {+ return null;+ }+// Calculate header opacity and transforms based on scrollconst headerOpacity = scrollY.interpolate({inputRange: [10, 60],@@ -58,16 +65,11 @@ export function CollapsibleHeader({outputRange: [-20, 0],});- const headerBackground = headerOpacity.interpolate({- inputRange: [0, 1],- outputRange: [colors.background, colors.accentBackground],- });-const styles = StyleSheet.create({floatingHeader: {alignItems: 'flex-end',flexDirection: 'row',- height: Platform.OS === 'ios' ? insets.top + 44 : 64,+ height: insets.top + 44,justifyContent: 'center',left: 0,overflow: 'hidden',@@ -78,14 +80,14 @@ export function CollapsibleHeader({},floatingTitle: {color: colors.text,- fontSize: Platform.OS === 'ios' ? 20 : 17,+ fontSize: 20,fontWeight: '600',marginTop: insets.top,textAlign: 'center',},floatingTitleContainer: {flex: 1,- height: Platform.OS === 'ios' ? insets.top + 44 : 64,+ height: insets.top + 44,justifyContent: 'center',},headerBorder: {@@ -97,7 +99,7 @@ export function CollapsibleHeader({right: 0,},headerButton: {- bottom: Platform.OS === 'ios' ? 6 : 16,+ bottom: 6,padding: 4,position: 'absolute',},@@ -123,22 +125,14 @@ export function CollapsibleHeader({},]}>- {Platform.OS === 'ios' ? (- <Animated.View style={[StyleSheet.absoluteFill, { opacity: headerOpacity }]}>- <AnimatedBlurView- tint={colorScheme === 'dark' ? 'dark' : 'light'}- intensity={colorScheme === 'dark' ? 80 : 100}- style={[StyleSheet.absoluteFill, { backgroundColor: colors.headerBackground }]}- />- <View style={styles.headerBorder} />- </Animated.View>- ) : (- <Animated.View- style={[StyleSheet.absoluteFill, { backgroundColor: headerBackground }]}- >- <View style={styles.headerBorder} />- </Animated.View>- )}+ <Animated.View style={[StyleSheet.absoluteFill, { opacity: headerOpacity }]}>+ <AnimatedBlurView+ tint={colorScheme === 'dark' ? 'dark' : 'light'}+ intensity={colorScheme === 'dark' ? 80 : 100}+ style={[StyleSheet.absoluteFill, { backgroundColor: colors.headerBackground }]}+ />+ <View style={styles.headerBorder} />+ </Animated.View><Animated.Viewstyle={[diff --git a/apps/mobile-app/components/ui/TitleContainer.tsx b/apps/mobile-app/components/ui/TitleContainer.tsxindex 91f01777f..d5e0ff98b 100644--- a/apps/mobile-app/components/ui/TitleContainer.tsx+++ b/apps/mobile-app/components/ui/TitleContainer.tsx@@ -1,4 +1,4 @@-import { StyleSheet, View } from 'react-native';+import { Platform, StyleSheet, View } from 'react-native';import { OfflineBanner } from '@/components/OfflineBanner';import { ThemedText } from '@/components/themed/ThemedText';@@ -13,6 +13,15 @@ type TitleContainerProps = {* Title container component.*/export function TitleContainer({ title, showLogo = true }: TitleContainerProps): React.ReactNode {+ // On Android, we don't show the title container as the native header is used, so we only return the offline banner.+ if (Platform.OS === 'android') {+ return (+ <>+ <OfflineBanner />+ </>+ );+ }+return (<><OfflineBanner />diff --git a/apps/mobile-app/constants/Colors.ts b/apps/mobile-app/constants/Colors.tsindex a330782c3..4beb3d5bc 100644--- a/apps/mobile-app/constants/Colors.ts+++ b/apps/mobile-app/constants/Colors.ts@@ -17,7 +17,8 @@ export const Colors = {icon: '#687076',tabIconDefault: '#687076',tabIconSelected: '#f49541',- headerBackground: 'rgba(255, 255, 255, 0.7)',+ headerBackgroundAndroid: '#f3f2f7',+ headerBackgroundIos: 'rgba(255, 255, 255, 0.7)',headerBorder: '#eae9eb',tabBarBackground: '#fff',primary: '#f49541',@@ -44,7 +45,8 @@ export const Colors = {icon: '#9BA1A6',tabIconDefault: '#9BA1A6',tabIconSelected: '#f49541',- headerBackground: 'rgba(0, 0, 0, 0.3)',+ headerBackgroundAndroid: '#000000',+ headerBackgroundIos: 'rgba(0, 0, 0, 0.3)',headerBorder: '#2f2e30',tabBarBackground: '#202020',primary: '#f49541',