Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Add native InAppBrowserView component for handling external links (#771)
Leendert de Borste2e0413912a7
diff --git a/apps/mobile-app/app/login-settings.tsx b/apps/mobile-app/app/login-settings.tsxindex 5e61527aa..5f5d2ef36 100644--- a/apps/mobile-app/app/login-settings.tsx+++ b/apps/mobile-app/app/login-settings.tsx@@ -110,10 +110,11 @@ export default function SettingsScreen() : React.ReactNode {},optionButtonText: {color: colors.text,- fontSize: 16,+ fontSize: 14,},optionButtonTextSelected: {- color: colors.text,+ color: colors.primarySurfaceText,+ fontWeight: 'bold',},title: {color: colors.text,diff --git a/apps/mobile-app/app/login.tsx b/apps/mobile-app/app/login.tsxindex da52384ae..43a29ed7e 100644--- a/apps/mobile-app/app/login.tsx+++ b/apps/mobile-app/app/login.tsx@@ -9,7 +9,6 @@ import {TextInput,TouchableOpacity,ActivityIndicator,- Linking,Animated,ScrollView,KeyboardAvoidingView,@@ -38,6 +37,7 @@ import { LoginResponse } from '@/utils/types/webapi/Login';import { VaultResponse } from '@/utils/types/webapi/VaultResponse';import { EncryptionKeyDerivationParams } from '@/utils/types/messaging/EncryptionKeyDerivationParams';import { useVaultSync } from '@/hooks/useVaultSync';+import { InAppBrowserView } from '@/components/ui/InAppBrowserView';/*** Login screen.@@ -347,7 +347,7 @@ export default function LoginScreen() : React.ReactNode {height: 12,width: 12,},- clickableDomain: {+ clickableLink: {color: colors.primary,textDecorationLine: 'underline',},@@ -360,6 +360,12 @@ export default function LoginScreen() : React.ReactNode {flex: 1,padding: 16,},+ createNewVaultContainer: {+ alignItems: 'center',+ flexDirection: 'row',+ justifyContent: 'center',+ marginTop: 16,+ },errorContainer: {backgroundColor: colors.errorBackground,borderColor: colors.errorBorder,@@ -432,12 +438,6 @@ export default function LoginScreen() : React.ReactNode {alignItems: 'center',marginBottom: 8,},- noteText: {- color: colors.textMuted,- fontSize: 14,- marginTop: 16,- textAlign: 'center',- },primaryButton: {backgroundColor: colors.primary,},@@ -456,6 +456,9 @@ export default function LoginScreen() : React.ReactNode {secondaryButton: {backgroundColor: colors.secondary,},+ textMuted: {+ color: colors.textMuted,+ },});return (@@ -491,7 +494,7 @@ export default function LoginScreen() : React.ReactNode {<Text style={styles.headerSubtitle}>Connecting to{' '}<Text- style={styles.clickableDomain}+ style={styles.clickableLink}onPress={() => router.push('/login-settings')}>{getDisplayUrl()}@@ -554,7 +557,7 @@ export default function LoginScreen() : React.ReactNode {<Text style={styles.buttonText}>Cancel</Text></TouchableOpacity></View>- <Text style={styles.noteText}>+ <Text style={styles.textMuted}>Note: if you don't have access to your authenticator device, you can reset your 2FA with a recovery code by logging in via the website.</Text></View>@@ -617,15 +620,14 @@ export default function LoginScreen() : React.ReactNode {<Text style={styles.buttonText}>Login</Text>)}</TouchableOpacity>- <Text style={styles.noteText}>- No account yet?{' '}- <Text- style={styles.clickableDomain}- onPress={() => Linking.openURL('https://app.aliasvault.net')}- >- Create new vault- </Text>- </Text>+ <View style={styles.createNewVaultContainer}>+ <Text style={styles.textMuted}>No account yet? </Text>+ <InAppBrowserView+ url="https://app.aliasvault.net/user/setup"+ title="Create new vault"+ textStyle={styles.clickableLink}+ />+ </View></View>)}</>diff --git a/apps/mobile-app/components/ui/InAppBrowserView.tsx b/apps/mobile-app/components/ui/InAppBrowserView.tsxnew file mode 100644index 000000000..2d49f940e--- /dev/null+++ b/apps/mobile-app/components/ui/InAppBrowserView.tsx@@ -0,0 +1,50 @@+import React from 'react';+import { TouchableOpacity, Text, ViewStyle, TextStyle } from 'react-native';+import * as WebBrowser from 'expo-web-browser';++import { useColors } from '@/hooks/useColorScheme';++type InAppBrowserViewProps = {+ url: string;+ title?: string;+ onPress?: () => void;+ style?: ViewStyle;+ textStyle?: TextStyle;+}++/**+ * A component that opens URLs in a native Safari View Controller on iOS,+ * or the default browser on Android.+ */+export function InAppBrowserView({ url, title, onPress, style, textStyle }: InAppBrowserViewProps): React.ReactNode {+ const colors = useColors();++ /**+ * Handles the press event by opening the URL in a Safari View Controller.+ */+ const handlePress = async (): Promise<void> => {+ if (onPress) {+ onPress();+ }++ try {+ await WebBrowser.openBrowserAsync(url, {+ presentationStyle: WebBrowser.WebBrowserPresentationStyle.PAGE_SHEET,+ controlsColor: colors.primary,+ toolbarColor: colors.accentBackground,+ enableBarCollapsing: true,+ showInRecents: true,+ });+ } catch (error) {+ console.error('Error opening Safari View:', error);+ }+ };++ return (+ <TouchableOpacity onPress={handlePress} style={style}>+ <Text style={textStyle}>+ {title ?? url}+ </Text>+ </TouchableOpacity>+ );+}diff --git a/apps/mobile-app/ios/AliasVault.xcodeproj/project.pbxproj b/apps/mobile-app/ios/AliasVault.xcodeproj/project.pbxprojindex 469b9063c..630a50d05 100644--- a/apps/mobile-app/ios/AliasVault.xcodeproj/project.pbxproj+++ b/apps/mobile-app/ios/AliasVault.xcodeproj/project.pbxproj@@ -1035,7 +1035,7 @@ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;CLANG_ENABLE_MODULES = YES;CODE_SIGN_ENTITLEMENTS = AliasVault/AliasVault.entitlements;- CURRENT_PROJECT_VERSION = 1;+ CURRENT_PROJECT_VERSION = 2;DEVELOPMENT_TEAM = 8PHW4HN3F7;ENABLE_BITCODE = NO;GCC_PREPROCESSOR_DEFINITIONS = (@@ -1074,7 +1074,7 @@ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;CLANG_ENABLE_MODULES = YES;CODE_SIGN_ENTITLEMENTS = AliasVault/AliasVault.entitlements;- CURRENT_PROJECT_VERSION = 1;+ CURRENT_PROJECT_VERSION = 2;DEVELOPMENT_TEAM = 8PHW4HN3F7;INFOPLIST_FILE = AliasVault/Info.plist;INFOPLIST_KEY_CFBundleDisplayName = AliasVault;@@ -1605,7 +1605,7 @@CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;CODE_SIGN_ENTITLEMENTS = autofill/autofill.entitlements;CODE_SIGN_STYLE = Automatic;- CURRENT_PROJECT_VERSION = 1;+ CURRENT_PROJECT_VERSION = 2;DEBUG_INFORMATION_FORMAT = dwarf;DEVELOPMENT_TEAM = 8PHW4HN3F7;ENABLE_USER_SCRIPT_SANDBOXING = YES;@@ -1650,7 +1650,7 @@CODE_SIGN_ENTITLEMENTS = autofill/autofill.entitlements;CODE_SIGN_STYLE = Automatic;COPY_PHASE_STRIP = NO;- CURRENT_PROJECT_VERSION = 1;+ CURRENT_PROJECT_VERSION = 2;DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";DEVELOPMENT_TEAM = 8PHW4HN3F7;ENABLE_USER_SCRIPT_SANDBOXING = YES;