Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Show family sharing in separate section in settings (#2159)

Leendert de Borst5a286491e64d
diff --git a/apps/browser-extension/src/entrypoints/popup/pages/settings/Settings.tsx b/apps/browser-extension/src/entrypoints/popup/pages/settings/Settings.tsx
index caa94a039..eaad274ca 100644
--- a/apps/browser-extension/src/entrypoints/popup/pages/settings/Settings.tsx
+++ b/apps/browser-extension/src/entrypoints/popup/pages/settings/Settings.tsx
@@ -331,47 +331,51 @@ const Settings: React.FC = () => {
</div>
</section>
- {/* Settings Navigation Section */}
- <section>
- <div className="bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700">
- <div className="divide-y divide-gray-200 dark:divide-gray-700">
- {/* Family Sharing */}
- {hasCapability(CapabilityKeys.VaultSharing) && (
- <button
- onClick={navigateToFamilySharingSettings}
- className="w-full px-4 py-3 flex items-center justify-between hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors"
- >
- <div className="flex items-center">
- <svg
- className="w-5 h-5 mr-3 text-gray-600 dark:text-gray-400"
- fill="none"
- stroke="currentColor"
- strokeWidth={2}
- viewBox="0 0 24 24"
- >
- <path
- strokeLinecap="round"
- strokeLinejoin="round"
- d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"
- />
- </svg>
- <span className="text-gray-900 dark:text-white text-left">{t('settings.familySharing')}</span>
- <span className="ml-2 px-1.5 py-0.5 text-[10px] font-semibold rounded-full bg-primary-100 dark:bg-primary-900 text-primary-700 dark:text-primary-300 uppercase tracking-wide">
- {t('sharing.family.beta')}
- </span>
- </div>
+ {/* Family Sharing Section */}
+ {hasCapability(CapabilityKeys.VaultSharing) && (
+ <section>
+ <div className="bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 overflow-hidden">
+ <button
+ onClick={navigateToFamilySharingSettings}
+ className="w-full px-4 py-3 flex items-center justify-between hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors"
+ >
+ <div className="flex items-center">
<svg
- className="w-4 h-4 text-gray-400"
+ className="w-5 h-5 mr-3 text-gray-600 dark:text-gray-400"
fill="none"
stroke="currentColor"
strokeWidth={2}
viewBox="0 0 24 24"
>
- <path strokeLinecap="round" strokeLinejoin="round" d="M9 5l7 7-7 7" />
+ <path
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"
+ />
</svg>
- </button>
- )}
+ <span className="text-gray-900 dark:text-white text-left">{t('settings.familySharing')}</span>
+ <span className="ml-2 px-1.5 py-0.5 text-[10px] font-semibold rounded-full bg-primary-100 dark:bg-primary-900 text-primary-700 dark:text-primary-300 uppercase tracking-wide">
+ {t('sharing.family.beta')}
+ </span>
+ </div>
+ <svg
+ className="w-4 h-4 text-gray-400"
+ fill="none"
+ stroke="currentColor"
+ strokeWidth={2}
+ viewBox="0 0 24 24"
+ >
+ <path strokeLinecap="round" strokeLinejoin="round" d="M9 5l7 7-7 7" />
+ </svg>
+ </button>
+ </div>
+ </section>
+ )}
+ {/* Settings Navigation Section */}
+ <section>
+ <div className="bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700">
+ <div className="divide-y divide-gray-200 dark:divide-gray-700">
{/* Autofill Settings */}
<button
onClick={navigateToAutofillSettings}
diff --git a/apps/mobile-app/app/(tabs)/items/index.tsx b/apps/mobile-app/app/(tabs)/items/index.tsx
index 662dfaa01..2ae21d100 100644
--- a/apps/mobile-app/app/(tabs)/items/index.tsx
+++ b/apps/mobile-app/app/(tabs)/items/index.tsx
@@ -433,24 +433,20 @@ export default function ItemsScreen(): React.ReactNode {
loadItems();
}, [isAuthenticated, isDatabaseAvailable, loadItems, setIsLoadingItems]);
- /**
- * Track previous syncing state to detect when sync completes.
- */
- const wasSyncingRef = useRef(dbContext.isSyncing);
-
- /**
- * Reload items when background sync completes (isSyncing goes from true to false).
- * This ensures newly synced data is displayed without requiring manual pull-to-refresh.
+ /*
+ * Reload once a sync completes, so newly synced data shows up without a manual pull-to-refresh.
*/
useEffect(() => {
- const wasSyncing = wasSyncingRef.current;
- wasSyncingRef.current = dbContext.isSyncing;
+ const vaultSyncedSub = emitter.addListener('vaultSynced', () => {
+ if (isAuthenticated && isDatabaseAvailable) {
+ loadItems();
+ }
+ });
- // Only reload when sync just completed (was syncing, now not syncing)
- if (wasSyncing && !dbContext.isSyncing && isAuthenticated && isDatabaseAvailable) {
- loadItems();
- }
- }, [dbContext.isSyncing, isAuthenticated, isDatabaseAvailable, loadItems]);
+ return (): void => {
+ vaultSyncedSub.remove();
+ };
+ }, [isAuthenticated, isDatabaseAvailable, loadItems]);
// Set header for Android
useEffect(() => {
diff --git a/apps/mobile-app/app/(tabs)/settings/index.tsx b/apps/mobile-app/app/(tabs)/settings/index.tsx
index 4ab6d2ce0..15a583471 100644
--- a/apps/mobile-app/app/(tabs)/settings/index.tsx
+++ b/apps/mobile-app/app/(tabs)/settings/index.tsx
@@ -404,29 +404,29 @@ export default function SettingsScreen() : React.ReactNode {
>
<TitleContainer title={t('settings.title')} onLogoPress={registerTap} />
<UsernameDisplay />
- <View style={styles.section}>
- {hasCapability(CapabilityKeys.VaultSharing) && (
- <>
- <TouchableOpacity
- style={styles.settingItem}
- onPress={() => navigate(() => router.push('/(tabs)/settings/family-sharing'))}
- >
- <View style={styles.settingItemIcon}>
- <Ionicons name="people-outline" size={20} color={colors.text} />
- </View>
- <View style={styles.settingItemContent}>
- <View style={styles.settingItemLabel}>
- <ThemedText style={styles.settingItemLabelText}>{t('sharing.family.title')}</ThemedText>
- <View style={styles.betaBadge}>
- <ThemedText style={styles.betaBadgeText}>{t('sharing.family.beta')}</ThemedText>
- </View>
+ {hasCapability(CapabilityKeys.VaultSharing) && (
+ <View style={styles.section}>
+ <TouchableOpacity
+ style={styles.settingItem}
+ onPress={() => navigate(() => router.push('/(tabs)/settings/family-sharing'))}
+ >
+ <View style={styles.settingItemIcon}>
+ <Ionicons name="people-outline" size={20} color={colors.text} />
+ </View>
+ <View style={styles.settingItemContent}>
+ <View style={styles.settingItemLabel}>
+ <ThemedText style={styles.settingItemLabelText}>{t('sharing.family.title')}</ThemedText>
+ <View style={styles.betaBadge}>
+ <ThemedText style={styles.betaBadgeText}>{t('sharing.family.beta')}</ThemedText>
</View>
- <Ionicons name="chevron-forward" size={20} color={colors.textMuted} />
</View>
- </TouchableOpacity>
- <View style={styles.separator} />
- </>
- )}
+ <Ionicons name="chevron-forward" size={20} color={colors.textMuted} />
+ </View>
+ </TouchableOpacity>
+ </View>
+ )}
+
+ <View style={styles.section}>
{Platform.OS === 'ios' && (
<>
<TouchableOpacity