diff --git a/CHANGELOG.md b/CHANGELOG.md index f858b09d..0dc7f86b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,8 @@ The package is available from ## 1.1 Consolidate Android Login -+ Check for locked keyring on Linux [1.0.13 20260626 amoghhosamane] ++ Sync profile visibility state across sessions and browser refreshes #301 [1.0.14 20260626 amogh] ++ Fix unhandled keyring lock exceptions in login and auto-login #350 [1.0.13 20260626 amogh] + Show animation while obtaining key [1.0.12 20260626 anushkavidanage] + REGISTER popup. Change PASSWD from profile [1.0.11 20260623 tonypioneer] + Add account and change password dialogs (CSS v7+) [1.0.10 20260617 anushkavidanage] 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