[#11843] "Enable all" is disabled after relogin for 3 or 4 chat link previews after relogin
Signed-off-by: andrey <motor4ik@gmail.com>
This commit is contained in:
parent
a9124d0fd2
commit
51178ab1b2
|
@ -16,6 +16,17 @@
|
|||
(disj (get multiaccount :link-previews-enabled-sites #{}) site))
|
||||
{})))
|
||||
|
||||
(fx/defn enable-all
|
||||
{:events [::enable-all]}
|
||||
[{{:keys [multiaccount]} :db :as cofx} link-previews-whitelist enabled?]
|
||||
(fx/merge cofx
|
||||
(multiaccounts.update/multiaccount-update
|
||||
:link-previews-enabled-sites
|
||||
(if enabled?
|
||||
(into #{} (map :title link-previews-whitelist))
|
||||
#{})
|
||||
{})))
|
||||
|
||||
(fx/defn load-link-preview-data
|
||||
{:events [::load-link-preview-data]}
|
||||
[cofx link]
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
(views/defview link-previews-settings []
|
||||
(views/letsubs [link-previews-whitelist [:link-preview/whitelist]
|
||||
link-previews-enabled-sites [:link-preview/enabled-sites]]
|
||||
(let [all-enabled (= (count link-previews-whitelist) (count link-previews-enabled-sites))]
|
||||
[react/view {:flex 1}
|
||||
[topbar/topbar {:title (i18n/label :t/chat-link-previews)}]
|
||||
[react/image {:source (resources/get-theme-image :unfurl)
|
||||
|
@ -36,16 +37,17 @@
|
|||
[quo/list-header (i18n/label :t/websites)]
|
||||
|
||||
(when (> (count link-previews-whitelist) 1)
|
||||
[quo/button {:on-press #(doseq [site (map :title link-previews-whitelist)]
|
||||
(re-frame/dispatch
|
||||
[::link-preview/enable site true]))
|
||||
[quo/button {:on-press #(re-frame/dispatch [::link-preview/enable-all
|
||||
link-previews-whitelist
|
||||
(not all-enabled)])
|
||||
:type :secondary
|
||||
:style styles/enable-all}
|
||||
(i18n/label :t/enable-all)])]
|
||||
|
||||
(if all-enabled
|
||||
(i18n/label :t/disable-all)
|
||||
(i18n/label :t/enable-all))])]
|
||||
[list/flat-list
|
||||
{:data (vec (map (prepare-urls-items-data link-previews-enabled-sites) link-previews-whitelist))
|
||||
:key-fn (fn [_ i] (str i))
|
||||
:render-fn quo/list-item
|
||||
:footer [quo/text {:color :secondary
|
||||
:style {:margin 16}} (i18n/label :t/previewing-may-share-metadata)]}]]))
|
||||
:style {:margin 16}} (i18n/label :t/previewing-may-share-metadata)]}]])))
|
||||
|
|
|
@ -1414,6 +1414,7 @@
|
|||
"previewing-may-share-metadata" : "Previewing links from these websites may share your metadata with their owners",
|
||||
"websites" : "Websites",
|
||||
"enable-all" : "Enable all",
|
||||
"disable-all" : "Disable all",
|
||||
"warning-sending-to-contract-descr": "The address you entered is a smart contract, sending funds to this address may result in loss of funds. To interact with a DApp, open the DApp in the Status DApp Browser.",
|
||||
"dont-ask": "Don't ask me again",
|
||||
"enable-link-previews": "Enable link previews in chat?",
|
||||
|
|
Loading…
Reference in New Issue