2016-05-19 16:31:56 +00:00
|
|
|
(ns status-im.subs
|
|
|
|
(:require-macros [reagent.ratom :refer [reaction]])
|
2016-09-17 12:35:01 +00:00
|
|
|
(:require [re-frame.core :refer [register-sub subscribe]]
|
2016-05-19 16:31:56 +00:00
|
|
|
status-im.chat.subs
|
|
|
|
status-im.group-settings.subs
|
2016-11-22 16:07:33 +00:00
|
|
|
status-im.discover.subs
|
2016-05-19 16:31:56 +00:00
|
|
|
status-im.contacts.subs
|
2016-05-21 13:07:37 +00:00
|
|
|
status-im.new-group.subs
|
2016-06-30 16:00:44 +00:00
|
|
|
status-im.participants.subs
|
|
|
|
status-im.transactions.subs))
|
2016-05-19 16:31:56 +00:00
|
|
|
|
|
|
|
(register-sub :get
|
|
|
|
(fn [db [_ k]]
|
|
|
|
(reaction (k @db))))
|
2016-05-21 13:07:37 +00:00
|
|
|
|
2016-08-01 10:29:10 +00:00
|
|
|
(register-sub :get-current-account
|
|
|
|
(fn [db [_ _]]
|
|
|
|
(reaction (let [current-account-id (:current-account-id @db)]
|
|
|
|
(get-in @db [:accounts current-account-id])))))
|
|
|
|
|
2016-05-21 13:07:37 +00:00
|
|
|
(register-sub :get-in
|
|
|
|
(fn [db [_ path]]
|
|
|
|
(reaction (get-in @db path))))
|
2016-06-10 08:18:10 +00:00
|
|
|
|
|
|
|
(register-sub :animations
|
|
|
|
(fn [db [_ k]]
|
|
|
|
(reaction (get-in @db [:animations k]))))
|
2016-09-17 12:35:01 +00:00
|
|
|
|
|
|
|
(register-sub :signed-up?
|
|
|
|
(fn []
|
|
|
|
(let [account-id (subscribe [:get :current-account-id])
|
|
|
|
accounts (subscribe [:get :accounts])]
|
|
|
|
(reaction (when (and @accounts @account-id)
|
|
|
|
(get-in @accounts [@account-id :signed-up?]))))))
|