From 24ba37bee125e620b00feb15e3443ed997aa7d91 Mon Sep 17 00:00:00 2001 From: Amoghhosamane Date: Fri, 26 Jun 2026 01:42:32 +0530 Subject: [PATCH] fix: sync profile visibility across sessions and browser refreshes --- CHANGELOG.md | 2 ++ lib/src/services/solid_profile_service.dart | 29 +++++++++++++++++++-- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 93c2a3d2..8a0df133 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,8 @@ The package is available from ## 1.1 Consolidate Android Login ++ Sync profile visibility state across sessions and browser refreshes #301 [1.0.12 20260626 amogh] ++ Fix unhandled keyring lock exceptions in login and auto-login #350 [1.0.12 20260626 amogh] + REGISTER popup. Change PASSWD from profile [1.0.11 20260623 tonypioneer] + Add account and change password dialogs (CSS v7+) [1.0.10 20260617 anushkavidanage] + Support writing large files to external pod [1.0.9 20260618 tonypioneer] diff --git a/lib/src/services/solid_profile_service.dart b/lib/src/services/solid_profile_service.dart index c634f654..9744b26e 100644 --- a/lib/src/services/solid_profile_service.dart +++ b/lib/src/services/solid_profile_service.dart @@ -130,8 +130,6 @@ class SolidProfileService { // Load. - /// Loads profile data from the POD into [solidProfileNotifier]. - Future loadProfile() async { if (!await isUserLoggedIn()) return; @@ -139,6 +137,14 @@ class SolidProfileService { try { await ensureProfileFolder(); + + // Check the actual encryption status on the POD to sync multi-session state + final detectedPrivacy = await _detectPrivacyFromPod(); + if (detectedPrivacy != null) { + solidProfileNotifier.setPrivacy(detectedPrivacy); + await _persistPrivacyPreference(detectedPrivacy); + } + await Future.wait([_loadAvatar(), _loadDisplayName()]); } catch (e) { debugPrint('SolidProfileService.loadProfile: $e'); @@ -321,6 +327,25 @@ class SolidProfileService { } } + Future _detectPrivacyFromPod() async { + try { + final displayNameUrl = await _displayNameUrl(); + if (await checkResourceStatus(displayNameUrl) == ResourceStatus.exist) { + final encrypted = await isFileEncrypted(displayNameUrl, pathType: PathType.absoluteUrl); + return encrypted ? SolidProfilePrivacy.private : SolidProfilePrivacy.public; + } + + final avatarUrl = await _avatarUrl(); + if (await checkResourceStatus(avatarUrl) == ResourceStatus.exist) { + final encrypted = await isFileEncrypted(avatarUrl, pathType: PathType.absoluteUrl); + return encrypted ? SolidProfilePrivacy.private : SolidProfilePrivacy.public; + } + } catch (e) { + debugPrint('SolidProfileService._detectPrivacyFromPod: $e'); + } + return null; + } + // Build the linked-data turtle for the display name. The user's WebID is // used as the subject so the triple is meaningful when read independently // by other agents and queries. We emit both `foaf:name` (the most widely