removed contacts groups and debug console

Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
This commit is contained in:
Andrey Shovkoplyas 2018-05-17 17:02:39 +03:00
parent 7574a1dc25
commit 3f3684cddf
No known key found for this signature in database
GPG Key ID: EAAB7C8622D860A4
38 changed files with 62 additions and 1060 deletions

View File

@ -237,8 +237,7 @@
(:qr-viewer
:recipient-qr-code) "#2f3031"
(:accounts :login
:wallet-transactions-filter
:contact-list-modal) styles/color-white
:wallet-transactions-filter) styles/color-white
:transparent)})
children (cond-> children
(#{:wallet

View File

@ -1,35 +0,0 @@
{
"dapps":
{
"name":
{
"en": "ÐApps"
},
"contacts":
[
"oaken-water-meter",
"melonport",
"bchat",
"Dentacoin",
"Augur",
"Ethlance",
"Commiteth",
"cryptokitties",
"cryptopunks",
"name-bazaar",
"cent",
"erc-dex",
"oasis-direct",
"etherbots",
"peepeth",
"hexel",
"kyber",
"bancor",
"opensea",
"decentraland",
"cryptocribs",
"cryptofighters",
"airswap"
]
}
}

View File

@ -175,7 +175,7 @@
(handlers/register-handler-fx
:initialize-chats
[(re-frame/inject-cofx :get-default-contacts-and-groups)
[(re-frame/inject-cofx :get-default-contacts)
(re-frame/inject-cofx :data-store/all-chats)
(re-frame/inject-cofx :data-store/get-messages)
(re-frame/inject-cofx :data-store/unviewed-messages)
@ -206,7 +206,6 @@
(handlers-macro/merge-fx cofx
{:db (assoc db :chats chats)}
(init-console-chat)
(group.events/add-default-groups)
(add-default-contacts)))))
(handlers/register-handler-fx

View File

@ -2,14 +2,10 @@
(:require [status-im.constants :as constants]
[status-im.i18n :as i18n]
[status-im.chat.console :as console-chat]
[status-im.ui.screens.accounts.utils :as account.utils]
[taoensso.timbre :as log]
[status-im.i18n :as i18n]
[goog.string :as gstring]
goog.string.format
[status-im.utils.handlers-macro :as handlers-macro]))
;;;; Helper fns
goog.string.format))
(defn console-respond-command-messages
[{:keys [name] :as command} handler-data random-id-seq]
@ -42,7 +38,7 @@
(def console-commands->fx
{"faucet"
(fn [{:keys [db random-id] :as cofx} {:keys [params]}]
(fn [{:keys [db random-id]} {:keys [params]}]
(let [current-address (get-in db [:account/account :address])
faucet-url (faucet-base-url->url (:url params))]
{:http-get {:url (gstring/format faucet-url current-address)
@ -54,24 +50,9 @@
(log/error "Faucet error" event)
(faucet-response-event
random-id
(i18n/label :t/faucet-error)))}}))
"debug"
(fn [{:keys [db random-id now] :as cofx} {:keys [params]}]
(let [debug? (= "On" (:mode params))]
(handlers-macro/merge-fx cofx
{:dispatch-n (if debug?
[[:initialize-debugging {:force-start? true}]
[:chat-received-message/add
[(console-chat/console-message
{:message-id random-id
:content (i18n/label :t/debug-enabled)
:content-type constants/text-content-type})]]]
[[:stop-debugging]])}
(account.utils/account-update {:debug? debug?
:last-updated now}))))})
(i18n/label :t/faucet-error)))}}))})
(def commands-names (set (keys console-commands->fx)))
(def commands-with-delivery-status
(disj commands-names "faucet" "debug"))
(disj commands-names "faucet"))

View File

@ -1,178 +0,0 @@
(ns status-im.commands.handlers.debug
(:require [re-frame.core :as re-frame]
[status-im.ui.components.react :as react]
[status-im.commands.events.loading :as loading-events]
[status-im.data-store.messages :as messages]
[status-im.data-store.accounts :as accounts]
[status-im.utils.handlers :as handlers]
[status-im.utils.platform :as platform]
[status-im.utils.types :as types]
[taoensso.timbre :as log]))
(def debug-server-port 5561)
(defn respond [data]
(.respond react/http-bridge
200
"application/json"
(types/clj->json data)))
(defn debug-server-start []
(.start react/http-bridge
debug-server-port
(if platform/ios?
"Status iOS"
"Status Android")
(fn [req]
(try
(let [{:keys [postData url]} (js->clj req :keywordize-keys true)
postData (if (string? postData)
(-> (.parse js/JSON postData)
(js->clj :keywordize-keys true))
postData)]
(re-frame/dispatch [::process-request url postData]))
(catch js/Error e
(log/debug "Error: " e))))))
;;;; Specific debug methods
;; TODO: there are still a lot of dispatch calls here. we can remove or restructure most of them,
;; but to do this we need to also rewrite a lot of already existing functions
(defn add-contact
[{:contacts/keys [contacts]} {:keys [name whisper-identity dapp-url bot-url] :as dapp-data}]
(if (and name
whisper-identity
(or dapp-url bot-url))
(if (or (not (get contacts whisper-identity))
(get-in contacts [whisper-identity :debug?]))
(let [dapp (merge dapp-data {:dapp? true
:debug? true})]
(re-frame/dispatch [:update-chat! {:chat-id whisper-identity
:name name
:debug? true}])
(if (get contacts whisper-identity)
(do (re-frame/dispatch [:update-contact! dapp])
(respond {:type :ok
:text "The DApp or bot has been updated."}))
(do (re-frame/dispatch [:open-chat-with-contact dapp])
(respond {:type :ok
:text "The DApp or bot has been added."}))))
(respond {:type :error
:text "Your DApp or bot should be debuggable."}))
(respond {:type :error
:text (str "You can add either DApp or bot. The object should contain \"name\", "
"\"whisper-identity\", and \"dapp-url\" or \"bot-url\" fields.")})))
(defn remove-contact
[{:keys [chats]} {:keys [whisper-identity]}]
(if (get chats whisper-identity)
(if (get-in chats [whisper-identity :debug?])
(do (re-frame/dispatch [:remove-chat-and-navigate-home whisper-identity])
(respond {:type :ok
:text "The DApp or bot has been removed."}))
(respond {:type :error
:text "Your DApp or bot should be debuggable."}))
(respond {:type :error
:text "There is no such DApp or bot."}))
(re-frame/dispatch [:remove-contact whisper-identity]))
(defn contact-changed
[{:keys [webview-bridge current-chat-id]
:contacts/keys [contacts]} {:keys [whisper-identity] :as dapp-data}]
(when (get-in contacts [whisper-identity :debug?])
(when (and (= current-chat-id whisper-identity)
webview-bridge)
(.reload webview-bridge))
(when-let [bot-url (get-in contacts [whisper-identity :bot-url])]
(re-frame/dispatch [::load-commands! {:whisper-identity whisper-identity
:bot-url bot-url}])))
(respond {:type :ok
:text "Command has been executed."}))
(defn switch-node
[{:keys [account/account]} {:keys [url]}]
(re-frame/dispatch [:initialize-protocol (:address account) url])
(respond {:type :ok
:text "You've successfully switched the node."}))
(defn dapps-list
[{:contacts/keys [contacts]}]
(let [contacts (->> (vals contacts)
(filter :debug?)
(map #(select-keys % [:name :whisper-identity :dapp-url :bot-url])))]
(if (seq contacts)
(respond {:type :ok
:data contacts})
(respond {:type :error
:text "No DApps or bots found."}))))
(defn log [db {:keys [identity]}]
(let [log (messages/get-log-messages identity)]
(if (seq log)
(respond {:type :ok
:data log})
(respond {:type :error
:text "No log messages found."}))))
;;;; FX
(re-frame/reg-fx
::initialize-debugging-fx
(fn [[address force-start?]]
(if force-start?
(debug-server-start)
(let [{:keys [debug?]} (accounts/get-by-address address)]
(when debug?
(debug-server-start))))))
(re-frame/reg-fx
::stop-debugging-fx
(fn [_]
(.stop react/http-bridge)))
(re-frame/reg-fx
::process-request-fx
(fn [[{:keys [web3] :as db} url {:keys [encoded] :as post-data}]]
(try
(let [json (some->> encoded
(.toAscii web3)
(.parse js/JSON))
obj (when json
(js->clj json :keywordize-keys true))]
(case url
"/add-dapp" (add-contact db obj)
"/remove-dapp" (remove-contact db obj)
"/dapp-changed" (contact-changed db obj)
"/switch-node" (switch-node db obj)
"/list" (dapps-list db)
"/log" (log db post-data)
:default))
(catch js/Error e
(respond {:type :error :text (str "Error: " e)})
(log/debug "Error: " e)))))
;;;; Handlers
(handlers/register-handler-fx
:initialize-debugging
[re-frame/trim-v]
(fn [_ [{:keys [address force-start?]}]]
{::initialize-debugging-fx [address force-start?]}))
(handlers/register-handler-fx
:stop-debugging
(fn [_]
{::stop-debugging-fx nil}))
(handlers/register-handler-fx
::process-request
[re-frame/trim-v]
(fn [{:keys [db]} [url post-data]]
{::process-request-fx [db url post-data]}))
;; TODO(janherich) once `contact-changed` fn is refactored, get rid of this unnecessary event
(handlers/register-handler-fx
::load-commands
[re-frame/trim-v (re-frame/inject-cofx :data-store/get-local-storage-data)]
(fn [cofx [contact]]
(loading-events/load-commands-for-bot cofx {} contact)))

View File

@ -1,35 +0,0 @@
(ns status-im.data-store.contact-groups
(:require [goog.object :as object]
[re-frame.core :as re-frame]
[status-im.data-store.realm.core :as core]))
(re-frame/reg-cofx
:data-store/get-all-contact-groups
(fn [cofx _]
(assoc cofx :all-contact-groups (into {}
(map (juxt :group-id identity))
(-> @core/account-realm
(core/get-all :contact-group)
(core/all-clj :contact-group))))))
(defn save-contact-group-tx
"Returns tx function for saving contact group"
[{:keys [group-id] :as group}]
(fn [realm]
(core/create realm :contact-group group (core/exists? realm :contact-group :group-id group-id))))
(defn save-contact-groups-tx
"Returns tx function for saving contact groups"
[groups]
(fn [realm]
(doseq [group groups]
((save-contact-group-tx group) realm))))
(defn add-contacts-to-contact-group-tx
"Returns tx function for adding contacts to contact group"
[group-id contacts]
(fn [realm]
(let [group (core/single (core/get-by-field realm :contact-group :group-id group-id))
existing-contacts (object/get group "contacts")]
(aset group "contacts" (clj->js (into #{} (concat contacts
(core/list->clj existing-contacts))))))))

View File

@ -9,7 +9,6 @@
status-im.data-store.browser
status-im.data-store.accounts
status-im.data-store.local-storage
status-im.data-store.contact-groups
status-im.data-store.requests))
(defn init [encryption-key]

View File

@ -1,13 +0,0 @@
(ns status-im.data-store.realm.schemas.account.v1.contact-group
(:require [taoensso.timbre :as log]))
(def schema {:name :contact-group
:primaryKey :group-id
:properties {:group-id :string
:name :string
:timestamp :int
:order :int
:contacts {:type "string[]"}}})
(defn migration [old-realm new-realm]
(log/debug "migrating group schema v1"))

View File

@ -5,13 +5,9 @@
[status-im.data-store.realm.schemas.account.v1.message :as message]
[status-im.data-store.realm.schemas.account.v1.request :as request]
[status-im.data-store.realm.schemas.account.v1.user-status :as user-status]
[status-im.data-store.realm.schemas.account.v1.contact-group :as contact-group]
[status-im.data-store.realm.schemas.account.v1.local-storage :as local-storage]
[status-im.data-store.realm.schemas.account.v1.browser :as browser]
[goog.object :as object]
[taoensso.timbre :as log]
[cljs.reader :as reader]
[clojure.string :as string]))
[taoensso.timbre :as log]))
(def schema [chat/schema
transport/schema
@ -19,7 +15,6 @@
message/schema
request/schema
user-status/schema
contact-group/schema
local-storage/schema
browser/schema])

View File

@ -8,8 +8,7 @@
[status-im.native-module.core :as status]
[status-im.utils.config :as config]
[status-im.utils.keychain :as keychain]
[status-im.utils.utils :as utils]
[status-im.constants :as constants]))
[status-im.utils.utils :as utils]))
;;;; FX
@ -28,8 +27,8 @@
(reg-fx
::change-account
(fn [[address]]
;; if we don't add delay when running app without status-go
;; "null is not an object (evaluating 'realm.schema')" error appears
;; if we don't add delay when running app without status-go
;; "null is not an object (evaluating 'realm.schema')" error appears
(keychain/get-encryption-key-then
(fn [encryption-key]
(let [change-account-fn (fn [] (data-store/change-account address
@ -92,8 +91,8 @@
:login-account
(fn [{{:keys [network status-node-started?] :as db} :db} [_ address password]]
(let [{account-network :network} (get-network-by-address db address)
db' (-> db
(assoc-in [:accounts/login :processing] true))
db' (-> db
(assoc-in [:accounts/login :processing] true))
wrap-fn (cond (not status-node-started?)
wrap-with-initialize-geth-fx
@ -112,7 +111,7 @@
success (zero? (count error))
db' (assoc-in db [:accounts/login :processing] false)]
(if success
{:db db
{:db db
::clear-web-data nil
::change-account [address]}
{:db (assoc-in db' [:accounts/login :error] error)}))))
@ -121,12 +120,10 @@
:change-account-handler
(fn [{{:keys [view-id] :as db} :db} [_ error address]]
(if (nil? error)
{:db (cond-> (dissoc db :accounts/login)
(= view-id :create-account)
(assoc-in [:accounts/create :step] :enter-name))
:dispatch-n (concat
[[:stop-debugging]
[:initialize-account address
(when (not= view-id :create-account)
[[:navigate-to-clean :home]])]])}
{:db (cond-> (dissoc db :accounts/login)
(= view-id :create-account)
(assoc-in [:accounts/create :step] :enter-name))
:dispatch [:initialize-account address
(when (not= view-id :create-account)
[[:navigate-to-clean :home]])]}
(log/debug "Error changing acount: " error))))

View File

@ -29,7 +29,7 @@
:accessibility-label :start-group-chat-button
:icon :icons/contacts
:icon-opts {:color colors/blue}
:on-press #(re-frame/dispatch [:open-contact-toggle-list :chat-group])}])
:on-press #(re-frame/dispatch [:open-contact-toggle-list])}])
[action-button/action-separator]
[action-button/action-button
{:label (i18n/label :t/new-public-group-chat)

View File

@ -1,53 +0,0 @@
(ns status-im.ui.screens.contacts.contact-list.views
(:require-macros [status-im.utils.views :refer [defview letsubs]])
(:require [re-frame.core :as re-frame]
[status-im.ui.components.contact.contact :as contact-view]
[status-im.ui.components.list.views :as list]
[status-im.ui.components.react :as react]
[status-im.ui.components.status-bar.view :as status-bar]
[status-im.ui.components.toolbar.view :as toolbar]
[status-im.ui.components.toolbar.actions :as act]
[status-im.ui.screens.contacts.styles :as styles]
[status-im.ui.screens.contacts.views :as contact-options]
[status-im.i18n :as i18n]))
;; TODO(alwx): this namespace is not used; should it be removed?
(defn render-row [group edit?]
(fn [row _ _]
[contact-view/contact-view {:contact row
:on-press #(re-frame/dispatch [:open-chat-with-contact %])
:extended? edit?
:extend-options (contact-options/contact-options row group)}]))
(defview contact-list-toolbar-edit [group]
[toolbar/toolbar {}
[toolbar/nav-button (act/back #(re-frame/dispatch [:set-in [:contacts/list-ui-props :edit?] false]))]
[toolbar/content-title
(if-not group
(i18n/label :t/contacts)
(or (:name group) (i18n/label :t/contacts-group-new-chat)))]])
(defview contacts-list-view [group edit?]
(letsubs [contacts [:get-all-added-group-contacts (:group-id group)]]
[list/flat-list {:style styles/contacts-list
:data contacts
:key-fn :address
:render-fn (render-row group edit?)
:enableEmptySections true
:keyboardShouldPersistTaps :always
:header list/default-header
:footer list/default-footer}]))
(defview contact-list []
(letsubs [edit? [:get-in [:contacts/list-ui-props :edit?]]
group [:get-contact-group]]
[react/view {:flex 1}
[react/view
[status-bar/status-bar]
(if edit?
[contact-list-toolbar-edit group]
[toolbar/simple-toolbar (if-not group
(i18n/label :t/contacts)
(or (:name group) (i18n/label :t/contacts-group-new-chat)))])]
[contacts-list-view group edit?]]))

View File

@ -1,67 +0,0 @@
(ns status-im.ui.screens.contacts.contact-list-modal.views
(:require-macros [status-im.utils.views :refer [defview letsubs]])
(:require [re-frame.core :refer [dispatch]]
[status-im.ui.components.common.common :as common]
[status-im.ui.components.contact.contact :refer [contact-view]]
[status-im.ui.components.action-button.action-button :refer [action-button
action-separator]]
[status-im.ui.components.action-button.styles :refer [actions-list]]
[status-im.ui.components.list.views :as list]
[status-im.ui.components.react :as react]
[status-im.ui.components.status-bar.view :refer [status-bar]]
[status-im.ui.components.toolbar.view :as toolbar]
[status-im.ui.screens.contacts.styles :as st]
[status-im.i18n :as i18n]))
(defn actions-view [action click-handler]
[react/view actions-list
[action-button
{:label (i18n/label :t/enter-address)
:icon :icons/address
:icon-opts {:color :blue}
:on-press #(do
(dispatch [:chat-webview-bridge/send-to-bridge
{:event (name :webview-send-transaction)}])
(dispatch [:navigate-back]))}]
[action-separator]
(if (= :request action)
[action-button {:label (i18n/label :t/show-qr)
:icon :icons/qr
:icon-opts {:color :blue}
:on-press #(click-handler :qr-scan action)}]
[action-button {:label (i18n/label :t/scan-qr)
:icon :icons/fullscreen
:icon-opts {:color :blue}
:on-press #(click-handler :qr-scan action)}])])
(defn render-row [click-handler action params]
(fn [row _ _]
[contact-view {:contact row
:on-press #(when click-handler
(click-handler row action params))}]))
(defview contact-list-modal []
(letsubs [contacts [:all-added-people-contacts]
click-handler [:get :contacts/click-handler]
action [:get :contacts/click-action]
params [:get :contacts/click-params]]
[react/view {:flex 1 :background-color :white}
[status-bar {:type :modal-white}]
[toolbar/simple-toolbar (i18n/label :t/contacts)]
[list/flat-list {:style st/contacts-list-modal
:data contacts
:key-fn :address
:render-fn (render-row click-handler action params)
:header (when-not (:hide-actions? params)
[react/view
[actions-view action click-handler]
[common/bottom-shadow]
[common/form-title (i18n/label :t/choose-from-contacts)
{:count-value (count contacts)}]
[common/list-header]])
:footer [react/view
[common/list-footer]
[common/bottom-shadow]]
:enableEmptySections true
:bounces false
:keyboardShouldPersistTaps :always}]]))

View File

@ -1,9 +1,6 @@
(ns status-im.ui.screens.contacts.core
(:require [re-frame.core :as re-frame]
[status-im.utils.handlers-macro :as handlers-macro]
[status-im.data-store.messages :as data-store.messages]
(:require [status-im.utils.handlers-macro :as handlers-macro]
[status-im.chat.models :as chat.models]
[status-im.constants :as constants]
[status-im.data-store.contacts :as contacts-store]))
(defn receive-contact-request

View File

@ -1,7 +1,6 @@
(ns status-im.ui.screens.contacts.db
(:require-macros [status-im.utils.db :refer [allowed-keys]])
(:require [cljs.spec.alpha :as spec]
[clojure.string :as string]
status-im.utils.db))
;;;; DB

View File

@ -1,23 +1,21 @@
(ns status-im.ui.screens.contacts.events
(:require [clojure.set :as set]
[cljs.reader :as reader]
(:require [cljs.reader :as reader]
[re-frame.core :as re-frame]
[status-im.utils.handlers :as handlers]
[status-im.utils.handlers-macro :as handlers-macro]
[status-im.utils.contacts :as utils.contacts]
[status-im.constants :as constants]
[status-im.utils.identicon :as identicon]
[status-im.utils.gfycat.core :as gfycat.core]
[status-im.ui.screens.contacts.navigation]
[status-im.ui.screens.navigation :as navigation]
[status-im.ui.screens.group.events :as group.events]
[status-im.chat.console :as console-chat]
[status-im.chat.events :as chat.events]
[status-im.chat.models :as chat.models]
[status-im.transport.message.core :as transport]
[status-im.transport.message.v1.contact :as message.v1.contact]
[status-im.ui.screens.add-new.new-chat.db :as new-chat.db]
[status-im.data-store.contacts :as contacts-store]))
[status-im.data-store.contacts :as contacts-store]
[status-im.utils.js-resources :as js-res]))
(re-frame/reg-cofx
:get-default-contacts
(fn [coeffects _]
(assoc coeffects :default-contacts js-res/default-contacts)))
;;;; Handlers
@ -93,26 +91,10 @@
fx
(add-contact-and-open-chat contact-identity))))))
(handlers/register-handler-fx
:hide-contact
(fn [cofx [_ {:keys [whisper-identity] :as contact}]]
(update-contact {:whisper-identity whisper-identity
:pending? true}
cofx)))
;;used only by status-dev-cli
(handlers/register-handler-fx
:remove-contact
(fn [{:keys [db]} [_ whisper-identity]]
(when-let [contact (get-in db [:contacts/contacts whisper-identity])]
{:db (update db :contacts/contacts dissoc whisper-identity)
:data-store/tx [(contacts-store/delete-contact-tx whisper-identity)]})))
(handlers/register-handler-db
:open-contact-toggle-list
(fn [db [_ group-type]]
(fn [db _]
(-> (assoc db
:group/group-type group-type
:group/selected-contacts #{}
:new-chat-name "")
(navigation/navigate-to :contact-toggle-list))))
@ -120,7 +102,7 @@
(handlers/register-handler-fx
:open-chat-with-contact
[(re-frame/inject-cofx :random-id)]
(fn [{:keys [db] :as cofx} [_ {:keys [whisper-identity] :as contact}]]
(fn [cofx [_ {:keys [whisper-identity]}]]
(handlers-macro/merge-fx cofx
(navigation/navigate-to-clean :home)
(add-contact whisper-identity)
@ -129,6 +111,6 @@
(handlers/register-handler-fx
:add-contact-handler
[(re-frame/inject-cofx :random-id)]
(fn [{{:contacts/keys [new-identity] :as db} :db :as cofx} _]
(fn [{{:contacts/keys [new-identity]} :db :as cofx} _]
(when (seq new-identity)
(add-contact-and-open-chat new-identity cofx))))

View File

@ -1,15 +0,0 @@
(ns status-im.ui.screens.contacts.navigation
(:require [status-im.ui.screens.navigation :as nav]))
(defmethod nav/preload-data! :contact-list
[db [_ _ click-handler]]
(-> db
(assoc-in [:contacts/list-ui-props :edit?] false)
(assoc-in [:contacts/ui-props :edit?] false)
(assoc :contacts/click-handler click-handler)))
(defmethod nav/preload-data! :contact-list-modal
[db [_ _ {:keys [handler action params]}]]
(assoc db :contacts/click-handler handler
:contacts/click-action action
:contacts/click-params params))

View File

@ -1,95 +0,0 @@
(ns status-im.ui.screens.contacts.styles
(:require-macros [status-im.utils.styles :refer [defnstyle defstyle]])
(:require [status-im.ui.components.styles :as common]))
(def toolbar-actions
{:flex-direction :row})
(def contact-groups
{:flex 1
:background-color common/color-light-gray})
(def contacts-list-container
{:flex 1})
(def contacts-list
{:background-color common/color-white})
(def contacts-list-modal
{:background-color common/color-light-gray})
(def empty-contact-groups
(merge contact-groups
{:align-items :center
:justify-content :center}))
(def empty-contacts-icon
{:height 62
:width 62})
(def empty-contacts-text
{:margin-top 12
:font-size 16
:color common/color-gray2})
(def contact-group-count
{:margin-left 8
:opacity 0.6})
(defstyle show-all
{:flex-direction :row
:align-items :center
:background-color common/color-white
:padding-left 72
:android {:height 56}
:ios {:height 64}})
(defstyle show-all-text
{:android {:font-size 14
:color common/color-blue
:letter-spacing 0.5}
:ios {:font-size 16
:color common/color-gray4
:letter-spacing -0.2}})
(def option-inner-image
{:width 24
:height 18
:top 16
:left 13})
(def group-icon
(assoc option-inner-image
:tint-color common/color-gray))
; New contact
(def contact-form-container
{:flex 1
:color :white
:background-color :white})
(def gradient-background
{:position :absolute
:top 0
:right 0
:bottom 0
:left 0})
(def form-container
{:margin-left 16
:margin-top 8
:height 72})
(def address-explication-container
{:flex 1
:margin-top 30
:padding-left 16
:padding-right 16})
(def address-explication
{:text-align :center
:color common/color-gray})
(def qr-input
{:margin-right 42})

View File

@ -1,6 +1,5 @@
(ns status-im.ui.screens.contacts.subs
(:require [clojure.string :as string]
[re-frame.core :refer [reg-sub subscribe]]
(:require [re-frame.core :refer [reg-sub subscribe]]
[status-im.utils.ethereum.core :as ethereum]
[status-im.utils.identicon :as identicon]
[status-im.utils.contacts :as utils.contacts]))
@ -59,12 +58,6 @@
(let [group-contacts' (into #{} group-contacts)]
(filter #(group-contacts' (:whisper-identity %)) contacts)))
(reg-sub :get-all-added-group-contacts
:<- [:all-added-contacts]
:<- [:get-contact-groups]
(fn [[contacts contact-groups] [_ group-id]]
(filter-group-contacts (get-in contact-groups [group-id :contacts]) contacts)))
(reg-sub :get-contact-by-identity
:<- [:get-contacts]
(fn [contacts [_ identity]]

View File

@ -1,26 +0,0 @@
(ns status-im.ui.screens.contacts.views
(:require-macros [status-im.utils.views :refer [defview letsubs]])
(:require [re-frame.core :refer [dispatch]]
[status-im.ui.components.react :refer [view text touchable-highlight scroll-view]]
[status-im.ui.components.contact.contact :refer [contact-view]]
[status-im.utils.platform :refer [platform-specific ios? android?]]
[status-im.utils.utils :as u]
[status-im.i18n :refer [label]]
[status-im.ui.components.styles :refer [color-blue]]))
(defn contact-options [{:keys [unremovable?] :as contact} group]
(let [delete-contact-opt {:action #(u/show-confirmation
(str (label :t/delete-contact) "?") (label :t/delete-contact-confirmation)
(label :t/delete)
(fn [] (dispatch [:hide-contact contact])))
:label (label :t/delete-contact)
:destructive? true}
options (if unremovable? [] [delete-contact-opt])]
(if group
(conj options
{:action #(dispatch [:remove-contact-from-group
(:whisper-identity contact)
(:group-id group)])
:label (label :t/remove-from-group)})
options)))

View File

@ -25,7 +25,6 @@
:navigation-stack '()
:contacts/contacts {}
:qr-codes {}
:group/contact-groups {}
:group/selected-contacts #{}
:chats {}
:current-chat-id nil
@ -148,11 +147,7 @@
:contacts/click-handler
:contacts/click-action
:contacts/click-params
:group/contact-groups
:group/contact-group-id
:group/group-type
:group/selected-contacts
:group/groups-order
:accounts/accounts
:accounts/create
:accounts/recover

View File

@ -3,7 +3,6 @@
status-im.chat.events
status-im.commands.handlers.jail
status-im.commands.events.loading
status-im.commands.handlers.debug
status-im.network.events
status-im.transport.handlers
status-im.protocol.handlers
@ -309,10 +308,8 @@
[:fetch-web3-node-version]
[:initialize-sync-listener]
[:load-contacts]
[:load-contact-groups]
[:initialize-chats]
[:initialize-browsers]
[:initialize-debugging {:address address}]
[:send-account-update-if-needed]
[:process-pending-messages]
[:update-wallet]

View File

@ -7,8 +7,7 @@
[status-im.ui.components.react :as react]
[status-im.ui.components.status-bar.view :refer [status-bar]]
[status-im.ui.components.toolbar.view :as toolbar]
[status-im.ui.screens.group.styles :as styles]
[status-im.ui.screens.contacts.styles :as contacts.styles]))
[status-im.ui.screens.group.styles :as styles]))
(defn- on-toggle [checked? whisper-identity]
(let [action (if checked? :deselect-contact :select-contact)]
@ -35,43 +34,28 @@
(defn toggle-list [contacts render-function]
[react/view {:flex 1}
[list/flat-list {:style contacts.styles/contacts-list
[list/flat-list {:style styles/contacts-list
:data contacts
:key-fn :address
:render-fn render-function
:keyboardShouldPersistTaps :always}]])
;; Start group chat
(defview contact-toggle-list []
(letsubs [contacts [:all-added-people-contacts]
selected-contacts-count [:selected-contacts-count]
group-type [:get-group-type]]
(letsubs [contacts [:all-added-people-contacts]
selected-contacts-count [:selected-contacts-count]]
[react/keyboard-avoiding-view {:style styles/group-container}
[status-bar]
[toggle-list-toolbar {:handler #(re-frame/dispatch [:navigate-to :new-group])
:label (i18n/label :t/next)
:count (pos? selected-contacts-count)}
(i18n/label (if (= group-type :contact-group)
:t/new-group
:t/group-chat))]
[toggle-list contacts group-toggle-contact]]))
(defview add-contacts-toggle-list []
(letsubs [contacts [:all-group-not-added-contacts]
group [:get-contact-group]
selected-contacts-count [:selected-contacts-count]]
[react/keyboard-avoiding-view {:style styles/group-container}
[status-bar]
[toggle-list-toolbar {:count selected-contacts-count
:handler #(do
(re-frame/dispatch [:add-selected-contacts-to-group])
(re-frame/dispatch [:navigate-back]))
:label (i18n/label :t/save)}
(:name group)]
(i18n/label :t/group-chat)]
[toggle-list contacts group-toggle-contact]]))
;; Add participants to existing group chat
(defview add-participants-toggle-list []
(letsubs [contacts [:get-all-contacts-not-in-current-chat]
{:keys [name]} [:get-current-chat]
{:keys [name]} [:get-current-chat]
selected-contacts-count [:selected-participants-count]]
[react/keyboard-avoiding-view {:style styles/group-container}
[status-bar]

View File

@ -10,12 +10,10 @@
[status-im.data-store.chats :as chats-store]
[status-im.data-store.messages :as messages-store]))
;;;; Handlers
(handlers/register-handler-fx
:show-group-chat-profile
[re-frame/trim-v]
(fn [{:keys [db] :as cofx} [chat-id]]
(fn [{:keys [db]} [chat-id]]
{:db (-> db
(assoc :new-chat-name (get-in db [:chats chat-id :name])
:group/group-type :chat-group)

View File

@ -1,33 +0,0 @@
(ns status-im.ui.screens.group.chat-settings.subs
(:require [re-frame.core :refer [reg-sub]]
[status-im.constants :refer [max-chat-name-length]]))
(reg-sub
:selected-participant
(fn [db]
(let [identity (first (:selected-participants db))]
(get-in db [:contacts/contacts identity]))))
(defn get-chat-name-validation-messages [chat-name]
(filter some?
(list (when (zero? (count chat-name))
"Chat name can't be empty")
(when (< max-chat-name-length (count chat-name))
"Chat name is too long"))))
(reg-sub
:new-chat-name
(fn [db]
(:new-chat-name db)))
(reg-sub
:new-chat-name-validation-messages
:<- [:new-chat-name]
(fn [chat-name]
(get-chat-name-validation-messages chat-name)))
(reg-sub
:new-chat-name-valid?
:<- [:new-chat-name]
(fn [chat-name]
(zero? (count (get-chat-name-validation-messages chat-name)))))

View File

@ -1,33 +1,5 @@
(ns status-im.ui.screens.group.db
(:require-macros [status-im.utils.db :refer [allowed-keys]])
(:require [cljs.spec.alpha :as spec]
status-im.utils.db
[status-im.constants :refer [console-chat-id]]
[clojure.string :as string]
[status-im.utils.homoglyph :as utils]))
(:require [cljs.spec.alpha :as spec]))
(spec/def ::name :global/not-empty-string)
;;;; DB
(spec/def :group/group-id :global/not-empty-string)
(spec/def :group/name :global/not-empty-string)
(spec/def :group/timestamp int?)
(spec/def :group/pending? boolean?)
(spec/def :group/order int?)
(spec/def :group/contact :global/not-empty-string)
(spec/def :group/contacts (spec/nilable (spec/* :group/contact)))
(spec/def :group/contact-group (allowed-keys
:req-un [:group/group-id :group/name :group/timestamp
:group/order :group/contacts]
:opt-un [:group/pending?]))
(spec/def :group/contact-groups (spec/nilable (spec/map-of :global/not-empty-string :group/contact-group)))
;;used during editing contact group
(spec/def :group/contact-group-id (spec/nilable string?))
(spec/def :group/group-type (spec/nilable #{:chat-group :contact-group}))
(spec/def :group/selected-contacts (spec/nilable (spec/* string?)))
;;list of group ids
(spec/def :group/groups-order (spec/nilable (spec/* string?)))

View File

@ -1,50 +0,0 @@
(ns status-im.ui.screens.group.edit-contacts.views
(:require-macros [status-im.utils.views :refer [defview letsubs]])
(:require [re-frame.core :as re-frame]
[status-im.ui.components.contact.contact :refer [contact-view]]
[status-im.ui.components.list.views :as list]
[status-im.ui.components.react :as react]
[status-im.ui.components.status-bar.view :refer [status-bar]]
[status-im.ui.components.toolbar.view :as toolbar]
[status-im.ui.screens.group.styles :as styles]
[status-im.i18n :as i18n]))
(defn contacts-list [contacts extended? extend-options]
[react/view {:flex 1}
[list/flat-list {:data contacts
:enableEmptySections true
:key-fn :address
:render-fn (fn [contact]
[contact-view {:contact contact
:extended? extended?
:extend-options (extend-options contact)}])
:bounces false
:keyboardShouldPersistTaps :always
:footer list/default-footer
:header list/default-header}]])
(defn chat-extended-options [item]
[{:action #(re-frame/dispatch [:remove-group-chat-participants #{(:whisper-identity item)}])
:label (i18n/label :t/remove)}])
(defn contact-extended-options [group-id]
(fn [item]
[{:action #(re-frame/dispatch [:remove-contact-from-group
(:whisper-identity item)
group-id])
:accessibility-label :remove-button
:label (i18n/label :t/remove-from-group)}]))
(defview contacts-list-view [group-id]
(letsubs [contacts [:get-all-added-group-contacts group-id]]
[contacts-list
contacts
true
(contact-extended-options group-id)]))
(defview edit-contact-group-contact-list []
(letsubs [group [:get-contact-group]]
[react/view styles/group-container
[status-bar]
[toolbar/simple-toolbar (:name group)]
[contacts-list-view (:group-id group)]]))

View File

@ -1,21 +1,6 @@
(ns status-im.ui.screens.group.events
(:require [clojure.set :as set]
[re-frame.core :as re-frame]
[status-im.utils.js-resources :as js-res]
[status-im.utils.handlers :as handlers]
[status-im.ui.screens.group.navigation]
[status-im.data-store.contact-groups :as contact-groups-store]))
;;;; COFX
(re-frame/reg-cofx
:get-default-contacts-and-groups
(fn [coeffects _]
(assoc coeffects
:default-contacts js-res/default-contacts
:default-groups js-res/default-contact-groups)))
;;;; Handlers
(:require [status-im.utils.handlers :as handlers]
[status-im.ui.screens.group.navigation]))
(handlers/register-handler-db
:deselect-contact
@ -36,68 +21,3 @@
:select-participant
(fn [db [_ id]]
(update db :selected-participants conj id)))
(handlers/register-handler-fx
:create-new-contact-group
[re-frame/trim-v (re-frame/inject-cofx :now) (re-frame/inject-cofx :random-id)]
(fn [{{:group/keys [contact-groups selected-contacts] :as db} :db group-id :random-id now :now} [group-name]]
(let [new-group {:group-id group-id
:name group-name
:order (count contact-groups)
:timestamp now
:contacts selected-contacts}]
{:db (assoc-in db [:group/contact-groups group-id] new-group)
:data-store/tx [(contact-groups-store/save-contact-group-tx new-group)]})))
(defn add-default-groups
[{:keys [db now default-groups]}]
(let [new-groups (into {}
(map (fn [[id props]]
(let [group-id (name id)]
[group-id {:group-id group-id
:name (-> props :name :en)
:order 0
:timestamp now
:contacts (:contacts props)}])))
default-groups)
existing-groups (:group/contact-groups db)
groups-to-add (select-keys new-groups (set/difference (set (keys new-groups))
(set (keys existing-groups))))]
{:db (update db :group/contact-groups merge groups-to-add)
:data-store/tx [(contact-groups-store/save-contact-groups-tx
(vals groups-to-add))]}))
(handlers/register-handler-fx
:load-contact-groups
[(re-frame/inject-cofx :data-store/get-all-contact-groups)]
(fn [{:keys [db all-contact-groups]} _]
{:db (assoc db :group/contact-groups all-contact-groups)}))
(handlers/register-handler-fx
:set-contact-group-name
(fn [{{:keys [new-chat-name] :group/keys [contact-group-id] :as db} :db} _]
{:db (assoc-in db
[:group/contact-groups contact-group-id :name]
new-chat-name)
:data-store/tx [(contact-groups-store/save-contact-group-tx
{:group-id contact-group-id
:name new-chat-name})]}))
(handlers/register-handler-fx
:add-selected-contacts-to-group
(fn [{{:group/keys [contact-groups contact-group-id selected-contacts] :as db} :db} _]
{:db (update-in db
[:group/contact-groups contact-group-id :contacts]
#(into [] (set (concat % selected-contacts))))
:data-store/tx [(contact-groups-store/add-contacts-to-contact-group-tx
contact-group-id selected-contacts)]}))
(handlers/register-handler-fx
:remove-contact-from-group
[re-frame/trim-v]
(fn [{:keys [db]} [whisper-identity group-id]]
(let [group (-> db
(get-in [:group/contact-groups group-id])
(update :contacts (partial remove #(= whisper-identity %))))]
{:db (assoc-in db [:group/contact-groups group-id] group)
:data-store/tx [(contact-groups-store/save-contact-group-tx group)]})))

View File

@ -1,10 +1,6 @@
(ns status-im.ui.screens.group.navigation
(:require [status-im.ui.screens.navigation :as nav]))
(defmethod nav/preload-data! :add-contacts-toggle-list
[db _]
(assoc db :group/selected-contacts #{}))
(defmethod nav/preload-data! :add-participants-toggle-list
[db _]
(assoc db :selected-participants #{}))

View File

@ -1,6 +1,6 @@
(ns status-im.ui.screens.group.styles
(:require-macros [status-im.utils.styles :refer [defstyle]])
(:require [status-im.ui.components.styles :as common]))
(:require [status-im.ui.components.colors :as colors]))
(defn toolbar-icon [enabled?]
{:width 20
@ -10,163 +10,10 @@
(def group-container
{:flex 1
:flex-direction :column
:background-color common/color-white})
(defstyle reorder-list-container
{:flex 1
:android {:padding-top 16}})
(def add-button-container
{:margin-left 16})
(defstyle group-name-text
{:letter-spacing -0.1
:color common/color-gray4
:ios {:font-size 13}
:android {:font-size 12}})
(defstyle members-text
{:color common/color-gray4
:ios {:letter-spacing -0.2
:font-size 16}
:android {:font-size 14}})
(defstyle members-text-count
{:margin-left 8
:color common/color-gray4
:opacity 0.6
:ios {:letter-spacing -0.2
:font-size 16}
:android {:font-size 14}})
(def add-container
{:flex-direction :row
:align-items :center
:height 64
:margin-top 12})
(defstyle settings-icon-container
{:width 40
:height 40
:align-items :center
:justify-content :center
:ios {:background-color "#628fe333"
:border-radius 50}})
(def add-icon
{:align-items :center
:width 24
:height 24})
(defstyle add-group-text
{:color common/color-light-blue
:ios {:color common/color-light-blue
:letter-spacing -0.2
:font-size 17
:line-height 20}
:android {:letter-spacing 0.5
:font-size 16}})
(def settings-group-text
add-group-text)
(def settings-group-text-container
{:padding-left 16})
(def delete-group-text
(merge add-group-text
{:color common/color-light-red}))
(defstyle delete-group-prompt-text
{:color common/color-gray4
:padding-top 5
:ios {:font-size 14
:letter-spacing -0.2}
:android {:font-size 12}})
(defstyle contact-container
{:flex-direction :row
:justify-content :center
:align-items :center
:ios {:height 63}
:android {:height 56}})
:background-color colors/white})
(def contact
{:padding-left 0})
(defstyle settings-group-container
{:ios {:margin-top 25}
:android {:margin-top 23}})
(defstyle settings-group-item
{:padding-left 16
:flex-direction :row
:align-items :center
:ios {:height 64}
:android {:height 56}})
(defstyle delete-icon-container
{:width 40
:height 40
:align-items :center
:justify-content :center
:ios {:background-color "#d84b4b33"
:border-radius 50}})
(def order-item-container
{:background-color common/color-white})
(defstyle order-item-inner-container
{:flex-direction :row
:align-items :center
:android {:padding-top 17
:padding-bottom 15
:min-height 56
:background-color common/color-white}
:ios {:padding-vertical 22
:min-height 63}})
(defstyle order-item-label
{:padding-left 16
:flex-shrink 1
:android {:font-size 16
:color common/color-black
:line-height 24}
:ios {:font-size 17
:line-height 20
:letter-spacing -0.2}})
(defstyle order-item-contacts
{:padding-left 8
:color common/color-gray4
:ios {:font-size 17
:line-height 20
:letter-spacing -0.2}
:android {:font-size 16
:line-height 24}})
(defstyle order-item-icon
{:android {:padding-horizontal 16}
:ios {:padding-horizontal 20}})
(def order-item-separator-wrapper
{:background-color common/color-white})
(def order-item-separator
{:height 1
:background-color common/color-gray5
:ios {:margin-left 16
:opacity 0.5}})
(defstyle toolbar-container
{:flex 1
:android {:padding-left 18}
:ios {:align-items :center}})
(def separator
{:background-color common/color-gray5
:height 1
:opacity 0.5})
(def list-view-container
{:flex 1
:margin-top 10})
(def contacts-list
{:background-color colors/white})

View File

@ -1,5 +1,5 @@
(ns status-im.ui.screens.group.subs
(:require [re-frame.core :refer [reg-sub subscribe]]
(:require [re-frame.core :refer [reg-sub]]
[status-im.utils.subs :as utils]))
(reg-sub
@ -35,25 +35,3 @@
:<- [:all-added-contacts]
(fn [[selected-contacts added-contacts]]
(filter-contacts selected-contacts added-contacts)))
(reg-sub
:get-contact-groups
(fn [db]
(:group/contact-groups db)))
(reg-sub
:get-contact-group-id
(fn [db]
(:group/contact-group-id db)))
(reg-sub
:get-contact-group
:<- [:get-contact-groups]
:<- [:get-contact-group-id]
(fn [[groups group-id]]
(get groups group-id)))
(reg-sub
:get-group-type
(fn [db]
(:group/group-type db)))

View File

@ -10,8 +10,7 @@
[status-im.utils.platform :as platform]
[status-im.ui.components.contact.contact :as contact]
[status-im.ui.screens.add-new.styles :as add-new.styles]
[status-im.ui.screens.group.styles :as styles]
[status-im.ui.screens.group.db :as v]))
[status-im.ui.screens.group.styles :as styles]))
(views/defview group-name-view []
(views/letsubs [new-group-name [:get :new-chat-name]]
@ -44,10 +43,11 @@
:accessibility-label :create-button}
(i18n/label :t/create)])))])
;; New Group Chat
(views/defview new-group []
(views/letsubs [contacts [:selected-group-contacts]
group-name [:get :new-chat-name]]
(let [save-btn-enabled? (and (spec/valid? ::v/name group-name) (pos? (count contacts)))]
(let [save-btn-enabled? (and (spec/valid? :global/not-empty-string group-name) (pos? (count contacts)))]
[react/keyboard-avoiding-view (merge {:behavior :padding}
styles/group-container)
[status-bar/status-bar]
@ -55,9 +55,9 @@
[group-name-view]
[list/list-with-label {:flex 1}
(i18n/label :t/members-title)
[list/flat-list {:data contacts
:key-fn :address
:render-fn render-contact
:bounces false
:keyboardShouldPersistTaps :always
:enableEmptySections true}]]])))
[list/flat-list {:data contacts
:key-fn :address
:render-fn render-contact
:bounces false
:keyboard-should-persist-taps :always
:enable-empty-sections true}]]])))

View File

@ -7,7 +7,6 @@
[status-im.ui.components.contact.contact :as contact]
[status-im.ui.components.list.views :as list]
[status-im.ui.components.colors :as colors]
[status-im.ui.components.styles :as components.styles]
[status-im.ui.components.status-bar.view :as status-bar]
[status-im.ui.components.toolbar.view :as toolbar]
[re-frame.core :as re-frame]

View File

@ -4,7 +4,6 @@
status-im.commands.subs
status-im.ui.screens.accounts.subs
status-im.ui.screens.home.subs
status-im.ui.screens.group.chat-settings.subs
status-im.ui.screens.contacts.subs
status-im.ui.screens.group.subs
status-im.ui.screens.wallet.subs

View File

@ -15,16 +15,11 @@
[status-im.ui.screens.add-new.new-chat.views :refer [new-chat]]
[status-im.ui.screens.add-new.new-public-chat.view :refer [new-public-chat]]
[status-im.ui.screens.contacts.contact-list-modal.views :refer [contact-list-modal]]
[status-im.ui.screens.qr-scanner.views :refer [qr-scanner]]
[status-im.ui.screens.group.views :refer [new-group]]
[status-im.ui.screens.group.edit-contacts.views :refer [edit-contact-group-contact-list]]
[status-im.ui.screens.group.add-contacts.views :refer [contact-toggle-list
add-contacts-toggle-list
add-participants-toggle-list]]
[status-im.ui.screens.profile.user.views :as profile.user]
[status-im.ui.screens.profile.contact.views :as profile.contact]
[status-im.ui.screens.profile.group-chat.views :as profile.group-chat]
@ -136,9 +131,7 @@
:wallet-request-assets wallet.components/request-assets
:new add-new
:new-group new-group
:add-contacts-toggle-list add-contacts-toggle-list
:add-participants-toggle-list add-participants-toggle-list
:edit-group-contact-list edit-contact-group-contact-list
:new-public-chat new-public-chat
:contact-toggle-list contact-toggle-list
:new-chat new-chat
@ -165,7 +158,6 @@
(defn get-modal-component [modal-view]
(case modal-view
:qr-scanner qr-scanner
:contact-list-modal contact-list-modal
:wallet-transactions-filter wallet-transactions/filter-history
:wallet-settings-assets wallet-settings/manage-assets
:wallet-send-transaction-modal send-transaction-modal

View File

@ -9,7 +9,6 @@
(and (string? url) (s/starts-with? url local-protocol)))
(def default-contacts (json->clj (slurp "resources/default_contacts.json")))
(def default-contact-groups (json->clj (slurp "resources/default_contact_groups.json")))
(def transactor-js (slurp-bot :transactor))

View File

@ -63,7 +63,7 @@
:trigger [:show-profile]
:properties {:target :show-profile}}
{:label "Tap"
:trigger [:open-contact-toggle-list :chat-group]
:trigger [:open-contact-toggle-list]
:properties {:target :new-group-chat}}
{:label "Tap"
:trigger [:navigate-to :new-public-chat]

View File

@ -5,11 +5,9 @@
[day8.re-frame.test :refer-macros [run-test-sync]]
status-im.ui.screens.db
[status-im.ui.screens.contacts.events :as contacts-events]
[status-im.ui.screens.group.events :as group-events]
status-im.ui.screens.subs
[status-im.ui.screens.events :as events]
[status-im.utils.js-resources :as js-res]
[status-im.utils.datetime :as datetime]))
[status-im.utils.js-resources :as js-res]))
(def test-contact-group
{:group-id "1501682106404-685e041e-38e7-593e-b42c-fb4cabd7faa4"
@ -70,12 +68,6 @@
(rf/reg-fx ::contacts-events/stop-watching-contact #())
(rf/reg-fx ::contacts-events/send-contact-request-fx #())
(rf/reg-fx ::group-events/save-contact-group #())
(rf/reg-fx ::group-events/save-contact-groups #())
(rf/reg-fx ::group-events/add-contacts-to-contact-group #())
(rf/reg-fx ::group-events/save-contact-group-property #())
(rf/reg-fx ::group-events/add-contacts-to-contact-group #())
(rf/reg-fx :data-store/save-chat #())
(rf/reg-cofx
@ -88,18 +80,11 @@
(fn [cofx]
(assoc cofx :get-local-storage-data (constantly nil))))
(rf/reg-cofx
::group-events/get-all-contact-groups
(fn [coeffects _]
(assoc coeffects :all-groups {(:group-id test-contact-group) test-contact-group})))
;;TODO implement tests later for :add-chat? and :bot-url
(rf/reg-cofx
::contacts-events/get-default-contacts-and-groups
(fn [coeffects _]
(assoc coeffects
:default-contacts (select-keys js-res/default-contacts [:demo-bot])
:default-groups (select-keys js-res/default-contact-groups [:dapps])))))
(assoc coeffects :default-contacts (select-keys js-res/default-contacts [:demo-bot])))))
#_(deftest contacts-events
"load-contacts