2023-12-19 17:41:30 +00:00
|
|
|
(ns legacy.status-im.subs.browser
|
2023-10-16 22:03:18 +00:00
|
|
|
(:require
|
2023-12-19 17:41:30 +00:00
|
|
|
[legacy.status-im.browser.core :as browser]
|
|
|
|
[re-frame.core :as re-frame]))
|
2022-09-21 14:03:06 +00:00
|
|
|
|
|
|
|
(re-frame/reg-sub
|
|
|
|
:browser/browsers
|
|
|
|
:<- [:browsers]
|
|
|
|
(fn [browsers]
|
|
|
|
(reduce (fn [acc [k browser]]
|
|
|
|
(update acc k assoc :url (browser/get-current-url browser)))
|
|
|
|
browsers
|
|
|
|
browsers)))
|
|
|
|
|
|
|
|
(re-frame/reg-sub
|
|
|
|
:browser/browsers-vals
|
|
|
|
:<- [:browser/browsers]
|
|
|
|
(fn [browsers]
|
|
|
|
(reverse (vals browsers))))
|
|
|
|
|
|
|
|
(re-frame/reg-sub
|
|
|
|
:get-current-browser
|
|
|
|
:<- [:browser/options]
|
|
|
|
:<- [:browser/browsers]
|
|
|
|
(fn [[options browsers]]
|
|
|
|
(let [browser (get browsers (:browser-id options))]
|
|
|
|
(assoc browser :secure? (browser/secure? browser options)))))
|
|
|
|
|
|
|
|
(re-frame/reg-sub
|
|
|
|
:bookmarks/active
|
|
|
|
:<- [:bookmarks]
|
|
|
|
(fn [bookmarks]
|
2023-07-04 19:40:13 +00:00
|
|
|
(into {} (remove #(:removed (second %)) bookmarks))))
|