From 0996ef3612c57cf1cb9ae3f09fe91c1bff3b82b4 Mon Sep 17 00:00:00 2001 From: Alex Jbanca <47811206+alexjba@users.noreply.github.com> Date: Mon, 7 Nov 2022 17:21:03 +0200 Subject: [PATCH] Fix showMessageLinksSwitch bindings Property bindings were added for showMessageLinksSwitch in order for it to change the checked state whenever previewableSites model has any item checked or displayChatImages setting is true. --- .../AppLayouts/Profile/views/MessagingView.qml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/ui/app/AppLayouts/Profile/views/MessagingView.qml b/ui/app/AppLayouts/Profile/views/MessagingView.qml index 572573c5b4..7dd51add9e 100644 --- a/ui/app/AppLayouts/Profile/views/MessagingView.qml +++ b/ui/app/AppLayouts/Profile/views/MessagingView.qml @@ -144,8 +144,8 @@ SettingsContentBase { RootStore.updateWhitelistedUnfurlingSites(item.address, false) } } - checked: false - onCheckedChanged: { + checked: previewableSites.anyWhitelisted || localAccountSensitiveSettings.displayChatImages + onToggled: { if (checked === false) { switchOffPreviewableSites() } @@ -153,7 +153,10 @@ SettingsContentBase { } ] onClicked: { - showMessageLinksSwitch.checked = !showMessageLinksSwitch.checked + showMessageLinksSwitch.toggle() + if (showMessageLinksSwitch.checked === false) { + showMessageLinksSwitch.switchOffPreviewableSites() + } } } @@ -177,8 +180,8 @@ SettingsContentBase { function populatePreviewableSites() { const [anyWhitelisted, whitelist] = buildPreviewablesSitesJSON() - showMessageLinksSwitch.checked = anyWhitelisted previewableSites.populateModel(whitelist) + previewableSites.anyWhitelisted = anyWhitelisted } Component.onCompleted: { @@ -219,6 +222,8 @@ SettingsContentBase { previewableSites.remove(jsonModel.length - 1, rowsToDelete) } } + + property bool anyWhitelisted: false } Connections { @@ -243,11 +248,6 @@ SettingsContentBase { // TODO find a better icon for this asset.name: Style.svg('globe') asset.isImage: true - Component.onCompleted: { - if (localAccountSensitiveSettings.displayChatImages) { - showMessageLinksSwitch.checked = true - } - } components: [ StatusSwitch { id: imageSwitch