2018-09-06 10:04:12 +00:00
|
|
|
(ns status-im.events
|
2018-09-20 16:42:07 +00:00
|
|
|
(:require [re-frame.core :as re-frame]
|
2018-09-06 10:04:12 +00:00
|
|
|
[status-im.accounts.core :as accounts]
|
|
|
|
[status-im.accounts.create.core :as accounts.create]
|
|
|
|
[status-im.accounts.login.core :as accounts.login]
|
|
|
|
[status-im.accounts.logout.core :as accounts.logout]
|
|
|
|
[status-im.accounts.recover.core :as accounts.recover]
|
|
|
|
[status-im.accounts.update.core :as accounts.update]
|
|
|
|
[status-im.bootnodes.core :as bootnodes]
|
2018-09-21 13:41:40 +00:00
|
|
|
[status-im.browser.core :as browser]
|
2018-10-05 10:27:17 +00:00
|
|
|
[status-im.node.core :as node]
|
2018-09-21 13:41:40 +00:00
|
|
|
[status-im.browser.permissions :as browser.permissions]
|
2018-10-09 08:10:47 +00:00
|
|
|
[status-im.chat.commands.input :as commands.input]
|
2018-09-24 16:27:04 +00:00
|
|
|
[status-im.chat.models :as chat]
|
|
|
|
[status-im.chat.models.input :as chat.input]
|
2018-10-09 08:10:47 +00:00
|
|
|
[status-im.chat.models.loading :as chat.loading]
|
|
|
|
[status-im.chat.models.message :as chat.message]
|
2018-10-11 08:38:23 +00:00
|
|
|
[status-im.contact.core :as contact]
|
2018-09-06 10:04:12 +00:00
|
|
|
[status-im.data-store.core :as data-store]
|
2018-10-11 15:22:43 +00:00
|
|
|
[status-im.extensions.core :as extensions]
|
2018-11-07 15:13:41 +00:00
|
|
|
[status-im.extensions.registry :as extensions.registry]
|
2018-09-06 10:04:12 +00:00
|
|
|
[status-im.fleet.core :as fleet]
|
2018-07-19 15:51:06 +00:00
|
|
|
[status-im.group-chats.core :as group-chats]
|
2018-09-18 16:27:58 +00:00
|
|
|
[status-im.hardwallet.core :as hardwallet]
|
2018-09-06 10:04:12 +00:00
|
|
|
[status-im.i18n :as i18n]
|
|
|
|
[status-im.init.core :as init]
|
|
|
|
[status-im.log-level.core :as log-level]
|
|
|
|
[status-im.mailserver.core :as mailserver]
|
|
|
|
[status-im.network.core :as network]
|
|
|
|
[status-im.notifications.core :as notifications]
|
2018-10-09 10:43:07 +00:00
|
|
|
[status-im.pairing.core :as pairing]
|
2018-09-06 10:04:12 +00:00
|
|
|
[status-im.privacy-policy.core :as privacy-policy]
|
|
|
|
[status-im.protocol.core :as protocol]
|
|
|
|
[status-im.qr-scanner.core :as qr-scanner]
|
2018-10-13 16:47:34 +00:00
|
|
|
[status-im.search.core :as search]
|
2018-09-06 10:04:12 +00:00
|
|
|
[status-im.signals.core :as signals]
|
2018-10-09 08:10:47 +00:00
|
|
|
[status-im.transport.message.core :as transport.message]
|
2018-11-07 15:13:41 +00:00
|
|
|
[status-im.ui.screens.currency-settings.models :as currency-settings.models]
|
2018-10-15 09:16:56 +00:00
|
|
|
[status-im.node.core :as node]
|
|
|
|
[status-im.web3.core :as web3]
|
2018-09-06 10:04:12 +00:00
|
|
|
[status-im.ui.screens.navigation :as navigation]
|
2018-09-24 15:59:02 +00:00
|
|
|
[status-im.utils.fx :as fx]
|
2018-09-06 10:04:12 +00:00
|
|
|
[status-im.utils.handlers :as handlers]
|
2018-10-16 09:48:12 +00:00
|
|
|
[status-im.utils.utils :as utils]
|
2018-11-14 20:49:18 +00:00
|
|
|
[taoensso.timbre :as log]
|
|
|
|
[status-im.utils.datetime :as time]
|
2018-11-20 21:43:40 +00:00
|
|
|
[status-im.chat.commands.core :as commands]
|
2018-11-14 20:49:18 +00:00
|
|
|
[status-im.chat.models.loading :as chat-loading]))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
|
|
|
;; init module
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:init.ui/data-reset-accepted
|
|
|
|
(fn [cofx _]
|
|
|
|
{:init/reset-data nil}))
|
|
|
|
|
2018-11-23 20:10:01 +00:00
|
|
|
(handlers/register-handler-fx
|
|
|
|
:init.ui/account-data-reset-accepted
|
|
|
|
(fn [_ [_ address]]
|
|
|
|
{:init/reset-account-data address}))
|
|
|
|
|
2018-09-06 10:04:12 +00:00
|
|
|
(handlers/register-handler-fx
|
|
|
|
:init.ui/data-reset-cancelled
|
|
|
|
(fn [cofx [_ encryption-key]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(init/initialize-app cofx encryption-key)))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:init/app-started
|
|
|
|
(fn [cofx _]
|
2018-09-28 14:48:59 +00:00
|
|
|
(init/start-app cofx)))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:init.callback/get-encryption-key-success
|
|
|
|
(fn [cofx [_ encryption-key]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(init/initialize-app cofx encryption-key)))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:init.callback/get-device-UUID-success
|
|
|
|
(fn [cofx [_ device-uuid]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(init/set-device-uuid cofx device-uuid)))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:init.callback/init-store-success
|
|
|
|
[(re-frame/inject-cofx :data-store/get-all-accounts)]
|
|
|
|
(fn [cofx _]
|
|
|
|
(init/load-accounts-and-initialize-views cofx)))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:init.callback/init-store-error
|
|
|
|
(fn [cofx [_ encryption-key error]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(init/handle-init-store-error cofx encryption-key)))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
2018-11-14 20:49:18 +00:00
|
|
|
:load-chats-messages
|
2018-11-20 10:34:08 +00:00
|
|
|
[(re-frame/inject-cofx :data-store/get-messages)
|
2018-11-14 20:49:18 +00:00
|
|
|
(re-frame/inject-cofx :data-store/get-referenced-messages)
|
|
|
|
(re-frame/inject-cofx :data-store/get-user-statuses)]
|
|
|
|
(fn [cofx]
|
|
|
|
(chat-loading/load-chats-messages cofx)))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:init-chats
|
2018-09-06 10:04:12 +00:00
|
|
|
[(re-frame/inject-cofx :web3/get-web3)
|
|
|
|
(re-frame/inject-cofx :get-default-dapps)
|
|
|
|
(re-frame/inject-cofx :data-store/all-chats)
|
|
|
|
(re-frame/inject-cofx :data-store/get-all-mailservers)
|
|
|
|
(re-frame/inject-cofx :data-store/transport)
|
2018-11-14 20:49:18 +00:00
|
|
|
(re-frame/inject-cofx :data-store/mailserver-topics)]
|
|
|
|
(fn [{:keys [db] :as cofx} [_ address]]
|
|
|
|
(fx/merge cofx
|
|
|
|
{:db (assoc db :chats/loading? false)}
|
|
|
|
(chat-loading/initialize-chats)
|
|
|
|
(protocol/initialize-protocol address)
|
|
|
|
(chat-loading/initialize-pending-messages))))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:init.callback/account-change-success
|
|
|
|
[(re-frame/inject-cofx :web3/get-web3)
|
|
|
|
(re-frame/inject-cofx :data-store/get-all-contacts)
|
|
|
|
(re-frame/inject-cofx :data-store/get-all-installations)
|
2018-09-06 10:04:12 +00:00
|
|
|
(re-frame/inject-cofx :data-store/all-browsers)
|
|
|
|
(re-frame/inject-cofx :data-store/all-dapp-permissions)]
|
|
|
|
(fn [cofx [_ address]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(init/initialize-account cofx address)))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:init.callback/account-change-error
|
2018-11-14 20:49:18 +00:00
|
|
|
(fn [cofx [_ error]]
|
|
|
|
(init/handle-change-account-error cofx error)))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:init.callback/keychain-reset
|
|
|
|
(fn [cofx _]
|
|
|
|
(init/initialize-keychain cofx)))
|
|
|
|
|
2018-11-23 20:10:01 +00:00
|
|
|
(handlers/register-handler-fx
|
|
|
|
:init.callback/account-db-removed
|
|
|
|
(fn [{:keys [db]} _]
|
|
|
|
{:db (assoc-in db [:accounts/login :processing] false)}))
|
|
|
|
|
2018-10-15 09:16:56 +00:00
|
|
|
;; home screen
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:home.ui/sync-info-pressed
|
|
|
|
(fn [cofx _]
|
|
|
|
(node/display-les-debug-info cofx)))
|
|
|
|
|
2018-09-06 10:04:12 +00:00
|
|
|
;; accounts module
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:accounts.ui/mainnet-warning-shown
|
|
|
|
(fn [cofx _]
|
2018-09-24 15:59:02 +00:00
|
|
|
(accounts.update/account-update cofx {:mainnet-warning-shown? true} {})))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
2018-11-06 13:23:49 +00:00
|
|
|
(handlers/register-handler-fx
|
|
|
|
:accounts.ui/desktop-alpha-release-warning-shown
|
|
|
|
(fn [cofx _]
|
|
|
|
(accounts.update/account-update cofx {:desktop-alpha-release-warning-shown? true} {})))
|
|
|
|
|
2018-09-06 10:04:12 +00:00
|
|
|
(handlers/register-handler-fx
|
|
|
|
:accounts.ui/dev-mode-switched
|
|
|
|
(fn [cofx [_ dev-mode?]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(accounts/switch-dev-mode cofx dev-mode?)))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
2018-10-19 15:50:35 +00:00
|
|
|
(handlers/register-handler-fx
|
|
|
|
:accounts.ui/notifications-enabled
|
|
|
|
(fn [cofx [_ desktop-notifications?]]
|
|
|
|
(accounts/enable-notifications cofx desktop-notifications?)))
|
|
|
|
|
2018-09-05 15:31:57 +00:00
|
|
|
(handlers/register-handler-fx
|
|
|
|
:accounts.ui/web3-opt-in-mode-switched
|
|
|
|
(fn [cofx [_ opt-in]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(accounts/switch-web3-opt-in-mode cofx opt-in)))
|
2018-09-05 15:31:57 +00:00
|
|
|
|
2018-09-06 10:04:12 +00:00
|
|
|
(handlers/register-handler-fx
|
|
|
|
:accounts.ui/wallet-set-up-confirmed
|
|
|
|
(fn [cofx [_ modal?]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(accounts/confirm-wallet-set-up cofx modal?)))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
|
|
|
;; accounts create module
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:accounts.create.ui/next-step-pressed
|
|
|
|
(fn [cofx [_ step password password-confirm]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(accounts.create/next-step cofx step password password-confirm)))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:accounts.create.ui/step-back-pressed
|
|
|
|
(fn [cofx [_ step password password-confirm]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(accounts.create/step-back cofx step)))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:accounts.create.ui/input-text-changed
|
|
|
|
(fn [cofx [_ input-key text]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(accounts.create/account-set-input-text cofx input-key text)))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:accounts.create.callback/create-account-success
|
2018-09-20 09:49:34 +00:00
|
|
|
[(re-frame/inject-cofx :random-guid-generator)
|
|
|
|
(re-frame/inject-cofx :accounts.create/get-signing-phrase)
|
2018-09-06 10:04:12 +00:00
|
|
|
(re-frame/inject-cofx :accounts.create/get-status)]
|
|
|
|
(fn [cofx [_ result password]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(accounts.create/on-account-created cofx result password false)))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
2018-09-18 16:27:58 +00:00
|
|
|
(handlers/register-handler-fx
|
|
|
|
:accounts.create.ui/create-new-account-button-pressed
|
|
|
|
(fn [cofx _]
|
|
|
|
(accounts.create/navigate-to-authentication-method cofx)))
|
|
|
|
|
2018-09-06 10:04:12 +00:00
|
|
|
;; accounts recover module
|
|
|
|
|
2018-09-20 16:42:07 +00:00
|
|
|
(handlers/register-handler-fx
|
|
|
|
:accounts.recover.ui/recover-account-button-pressed
|
|
|
|
(fn [cofx _]
|
|
|
|
(accounts.recover/navigate-to-recover-account-screen cofx)))
|
|
|
|
|
2018-09-06 10:04:12 +00:00
|
|
|
(handlers/register-handler-fx
|
|
|
|
:accounts.recover.ui/passphrase-input-changed
|
|
|
|
(fn [cofx [_ recovery-phrase]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(accounts.recover/set-phrase cofx recovery-phrase)))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:accounts.recover.ui/passphrase-input-blured
|
|
|
|
(fn [cofx _]
|
|
|
|
(accounts.recover/validate-phrase cofx)))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:accounts.recover.ui/password-input-changed
|
|
|
|
(fn [cofx [_ masked-password]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(accounts.recover/set-password cofx masked-password)))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:accounts.recover.ui/password-input-blured
|
|
|
|
(fn [cofx _]
|
|
|
|
(accounts.recover/validate-password cofx)))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:accounts.recover.ui/sign-in-button-pressed
|
|
|
|
(fn [cofx _]
|
|
|
|
(accounts.recover/recover-account-with-checks cofx)))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:accounts.recover.ui/recover-account-confirmed
|
|
|
|
(fn [cofx _]
|
|
|
|
(accounts.recover/recover-account cofx)))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:accounts.recover.callback/recover-account-success
|
2018-09-20 09:49:34 +00:00
|
|
|
[(re-frame/inject-cofx :random-guid-generator)
|
|
|
|
(re-frame/inject-cofx :accounts.create/get-signing-phrase)
|
2018-09-06 10:04:12 +00:00
|
|
|
(re-frame/inject-cofx :accounts.create/get-status)]
|
|
|
|
(fn [cofx [_ result password]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(accounts.recover/on-account-recovered cofx result password)))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
|
|
|
;; accounts login module
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:accounts.login.ui/password-input-submitted
|
|
|
|
(fn [cofx _]
|
|
|
|
(accounts.login/user-login cofx)))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:accounts.login.callback/login-success
|
|
|
|
(fn [cofx [_ login-result]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(accounts.login/user-login-callback cofx login-result)))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:accounts.login.ui/account-selected
|
|
|
|
(fn [cofx [_ address photo-path name]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(accounts.login/open-login cofx address photo-path name)))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:accounts.login.callback/get-user-password-success
|
|
|
|
(fn [cofx [_ password]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(accounts.login/open-login-callback cofx password)))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
|
|
|
;; accounts logout module
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:accounts.logout.ui/logout-pressed
|
|
|
|
(fn [cofx _]
|
2018-09-24 15:59:02 +00:00
|
|
|
(accounts.logout/show-logout-confirmation cofx)))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:accounts.logout.ui/logout-confirmed
|
|
|
|
(fn [cofx _]
|
|
|
|
(accounts.logout/logout cofx)))
|
|
|
|
|
|
|
|
;; accounts update module
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:accounts.update.callback/save-settings-success
|
|
|
|
(fn [cofx _]
|
|
|
|
(accounts.logout/logout cofx)))
|
|
|
|
|
|
|
|
;; mailserver module
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:mailserver.ui/user-defined-mailserver-selected
|
|
|
|
(fn [cofx [_ mailserver-id]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(mailserver/edit cofx mailserver-id)))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:mailserver.ui/default-mailserver-selected
|
|
|
|
(fn [cofx [_ mailserver-id]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(mailserver/show-connection-confirmation cofx mailserver-id)))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:mailserver.ui/add-pressed
|
|
|
|
(fn [cofx _]
|
2018-09-24 15:59:02 +00:00
|
|
|
(navigation/navigate-to-cofx cofx :edit-mailserver nil)))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:mailserver.ui/save-pressed
|
2018-09-24 16:27:04 +00:00
|
|
|
[(re-frame/inject-cofx :random-id-generator)]
|
2018-09-06 10:04:12 +00:00
|
|
|
(fn [cofx _]
|
|
|
|
(mailserver/upsert cofx)))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:mailserver.ui/input-changed
|
|
|
|
(fn [cofx [_ input-key value]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(mailserver/set-input cofx input-key value)))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:mailserver.ui/delete-confirmed
|
|
|
|
(fn [cofx [_ mailserver-id]]
|
2018-10-18 00:05:02 +00:00
|
|
|
(mailserver/delete cofx mailserver-id)))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:mailserver.ui/delete-pressed
|
|
|
|
(fn [cofx [_ mailserver-id]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(mailserver/show-delete-confirmation cofx mailserver-id)))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:mailserver.callback/qr-code-scanned
|
|
|
|
(fn [cofx [_ _ url]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(mailserver/set-url-from-qr cofx url)))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
2018-09-18 08:13:35 +00:00
|
|
|
(handlers/register-handler-fx
|
|
|
|
:mailserver.ui/connect-pressed
|
|
|
|
(fn [cofx [_ mailserver-id]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(mailserver/show-connection-confirmation cofx mailserver-id)))
|
2018-09-18 08:13:35 +00:00
|
|
|
|
2018-09-06 10:04:12 +00:00
|
|
|
(handlers/register-handler-fx
|
|
|
|
:mailserver.ui/connect-confirmed
|
|
|
|
(fn [cofx [_ current-fleet mailserver-id]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(mailserver/save-settings cofx current-fleet mailserver-id)))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
2018-10-18 00:05:02 +00:00
|
|
|
(handlers/register-handler-fx
|
|
|
|
:mailserver.ui/reconnect-mailserver-pressed
|
|
|
|
(fn [cofx [_ args]]
|
|
|
|
(mailserver/connect-to-mailserver cofx)))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:mailserver/check-connection-timeout
|
|
|
|
(fn [cofx _]
|
|
|
|
(mailserver/check-connection cofx)))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:mailserver.callback/generate-mailserver-symkey-success
|
|
|
|
(fn [cofx [_ mailserver sym-key-id]]
|
|
|
|
(mailserver/add-mailserver-sym-key cofx mailserver sym-key-id)))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:mailserver.callback/mark-trusted-peer-success
|
|
|
|
(fn [cofx _]
|
|
|
|
(mailserver/add-mailserver-trusted cofx)))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:mailserver.callback/mark-trusted-peer-error
|
|
|
|
(fn [cofx [_ error]]
|
|
|
|
(log/error "Error on mark-trusted-peer: " error)
|
|
|
|
(mailserver/check-connection cofx)))
|
|
|
|
|
2018-09-06 10:04:12 +00:00
|
|
|
;; network module
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:network.ui/save-network-pressed
|
2018-09-24 16:27:04 +00:00
|
|
|
[(re-frame/inject-cofx :random-id-generator)]
|
2018-09-06 10:04:12 +00:00
|
|
|
(fn [cofx]
|
|
|
|
(network/save-network cofx)))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:network.ui/input-changed
|
|
|
|
(fn [cofx [_ input-key value]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(network/set-input cofx input-key value)))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:network.ui/add-network-pressed
|
|
|
|
(fn [cofx]
|
|
|
|
(network/edit cofx)))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:network.callback/non-rpc-network-saved
|
|
|
|
(fn [_ _]
|
|
|
|
{:ui/close-application nil}))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:network.ui/save-non-rpc-network-pressed
|
|
|
|
(fn [cofx [_ network]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(network/save-non-rpc-network cofx network)))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:network.ui/remove-network-confirmed
|
|
|
|
(fn [cofx [_ network]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(network/remove-network cofx network)))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:network.ui/connect-network-pressed
|
2018-10-16 09:48:12 +00:00
|
|
|
(fn [cofx [_ network-id]]
|
|
|
|
(network/connect cofx {:network-id network-id
|
|
|
|
:on-failure (fn [{:keys [reason]} _]
|
|
|
|
(utils/show-popup "Error" (str reason)))})))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:network.ui/delete-network-pressed
|
|
|
|
(fn [cofx [_ network]]
|
|
|
|
(network/delete cofx {:network network})))
|
|
|
|
|
2018-09-26 10:06:07 +00:00
|
|
|
(handlers/register-handler-fx
|
|
|
|
:network.ui/network-entry-pressed
|
|
|
|
(fn [cofx [_ network]]
|
|
|
|
(network/open-network-details cofx network)))
|
|
|
|
|
2018-09-06 10:04:12 +00:00
|
|
|
(handlers/register-handler-fx
|
|
|
|
:network/connection-status-changed
|
|
|
|
(fn [{db :db :as cofx} [_ is-connected?]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(network/handle-connection-status-change cofx is-connected?)))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:network/network-status-changed
|
|
|
|
(fn [cofx [_ data]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(network/handle-network-status-change cofx data)))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
|
|
|
;; fleet module
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:fleet.ui/save-fleet-confirmed
|
|
|
|
(fn [cofx [_ fleet]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(fleet/save cofx fleet)))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:fleet.ui/fleet-selected
|
|
|
|
(fn [cofx [_ fleet]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(fleet/show-save-confirmation cofx fleet)))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
|
|
|
;; bootnodes module
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:bootnodes.ui/custom-bootnodes-switch-toggled
|
|
|
|
(fn [cofx [_ value]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(bootnodes/toggle-custom-bootnodes cofx value)))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:bootnodes.ui/add-bootnode-pressed
|
|
|
|
(fn [cofx [_ bootnode-id]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(bootnodes/edit cofx bootnode-id)))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
2018-09-18 08:19:13 +00:00
|
|
|
:bootnodes.callback/qr-code-scanned
|
2018-09-06 10:04:12 +00:00
|
|
|
(fn [cofx [_ _ url]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(bootnodes/set-bootnodes-from-qr cofx url)))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:bootnodes.ui/input-changed
|
|
|
|
(fn [cofx [_ input-key value]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(bootnodes/set-input cofx input-key value)))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
2018-09-18 08:19:13 +00:00
|
|
|
:bootnodes.ui/save-pressed
|
2018-09-24 16:27:04 +00:00
|
|
|
[(re-frame/inject-cofx :random-id-generator)]
|
2018-09-06 10:04:12 +00:00
|
|
|
(fn [cofx _]
|
|
|
|
(bootnodes/upsert cofx)))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:bootnodes.ui/delete-pressed
|
|
|
|
(fn [_ [_ id]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(bootnodes/show-delete-bootnode-confirmation _ id)))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:bootnodes.ui/delete-confirmed
|
|
|
|
(fn [cofx [_ bootnode-id]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(bootnodes/delete-bootnode cofx bootnode-id)))
|
2018-10-11 15:22:43 +00:00
|
|
|
|
|
|
|
;; extensions module
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:extensions.callback/qr-code-scanned
|
|
|
|
(fn [cofx [_ _ url]]
|
|
|
|
(extensions/set-extension-url-from-qr cofx url)))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
2018-10-12 20:14:44 +00:00
|
|
|
(handlers/register-handler-fx
|
|
|
|
:extensions.ui/add-extension-pressed
|
2018-11-07 15:13:41 +00:00
|
|
|
(fn [cofx [_ extension-key]]
|
|
|
|
(extensions/edit cofx extension-key)))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:extensions.ui/uninstall-extension-pressed
|
|
|
|
(fn [cofx [_ extension-key]]
|
|
|
|
(extensions.registry/uninstall cofx extension-key)))
|
2018-10-12 20:14:44 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:extensions.ui/input-changed
|
|
|
|
(fn [cofx [_ input-key value]]
|
|
|
|
(extensions/set-input cofx input-key value)))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:extensions.ui/activation-checkbox-pressed
|
2018-11-07 15:13:41 +00:00
|
|
|
(fn [cofx [_ extension-key active?]]
|
|
|
|
(extensions.registry/change-state cofx extension-key active?)))
|
2018-10-12 20:14:44 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
2018-12-10 15:40:45 +00:00
|
|
|
:extensions.ui/find-button-pressed
|
2018-10-18 12:14:12 +00:00
|
|
|
(fn [cofx [_ url]]
|
2018-11-28 16:08:57 +00:00
|
|
|
(extensions.registry/load cofx url false)))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:extensions.ui/install-extension-button-pressed
|
2018-12-10 15:40:45 +00:00
|
|
|
(fn [cofx [_ url]]
|
|
|
|
(extensions.registry/load cofx url true)))
|
2018-10-12 20:14:44 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:extensions.ui/install-button-pressed
|
2018-12-10 15:40:45 +00:00
|
|
|
(fn [cofx [_ url data modal?]]
|
|
|
|
(extensions.registry/install cofx url data modal?)))
|
2018-10-12 20:14:44 +00:00
|
|
|
|
2018-09-06 10:04:12 +00:00
|
|
|
;; log-level module
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:log-level.ui/change-log-level-confirmed
|
|
|
|
(fn [cofx [_ log-level]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(log-level/save-log-level cofx log-level)))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:log-level.ui/log-level-selected
|
|
|
|
(fn [cofx [_ log-level]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(log-level/show-change-log-level-confirmation cofx log-level)))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
2018-09-13 14:07:42 +00:00
|
|
|
;; Browser bridge module
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:browser.bridge.callback/qr-code-scanned
|
2018-10-02 14:14:35 +00:00
|
|
|
(fn [cofx [_ _ data qr-code-data]]
|
|
|
|
(browser/handle-scanned-qr-code cofx data (:data qr-code-data))))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:browser.bridge.callback/qr-code-canceled
|
|
|
|
(fn [cofx [_ _ qr-code-data]]
|
|
|
|
(browser/handle-canceled-qr-code cofx (:data qr-code-data))))
|
2018-09-13 14:07:42 +00:00
|
|
|
|
2018-09-06 10:04:12 +00:00
|
|
|
;; qr-scanner module
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:qr-scanner.ui/scan-qr-code-pressed
|
2018-09-13 14:07:42 +00:00
|
|
|
(fn [cofx [_ identifier handler & [opts]]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(qr-scanner/scan-qr-code cofx identifier (merge {:handler handler} opts))))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:qr-scanner.callback/scan-qr-code-success
|
|
|
|
(fn [cofx [_ context data]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(qr-scanner/set-qr-code cofx context data)))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
2018-10-02 14:14:35 +00:00
|
|
|
(handlers/register-handler-fx
|
|
|
|
:qr-scanner.callback/scan-qr-code-cancel
|
|
|
|
(fn [cofx [_ context]]
|
|
|
|
(qr-scanner/set-qr-code-cancel cofx context)))
|
|
|
|
|
2018-09-06 10:04:12 +00:00
|
|
|
;; privacy-policy module
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:privacy-policy/privacy-policy-button-pressed
|
2018-09-24 15:59:02 +00:00
|
|
|
(fn [cofx _]
|
|
|
|
(privacy-policy/open-privacy-policy-link cofx)))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
|
|
|
;; wallet modules
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:wallet.settings.ui/currency-selected
|
|
|
|
(fn [cofx [_ currency]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(currency-settings.models/set-currency cofx currency)))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
|
|
|
;; chat module
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:chat.ui/clear-history-pressed
|
|
|
|
(fn [_ _]
|
2018-09-24 16:27:04 +00:00
|
|
|
{:ui/show-confirmation {:title (i18n/label :t/clear-history-title)
|
|
|
|
:content (i18n/label :t/clear-history-confirmation-content)
|
2018-09-06 10:04:12 +00:00
|
|
|
:confirm-button-text (i18n/label :t/clear-history-action)
|
2018-09-24 16:27:04 +00:00
|
|
|
:on-accept #(re-frame/dispatch [:chat.ui/clear-history])}}))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
2018-09-24 16:27:04 +00:00
|
|
|
:chat.ui/remove-chat-pressed
|
2018-10-01 08:47:20 +00:00
|
|
|
(fn [_ [_ chat-id]]
|
2018-09-24 16:27:04 +00:00
|
|
|
{:ui/show-confirmation {:title (i18n/label :t/delete-confirmation)
|
|
|
|
:content (i18n/label :t/delete-chat-confirmation)
|
|
|
|
:confirm-button-text (i18n/label :t/delete)
|
|
|
|
:on-accept #(re-frame/dispatch [:chat.ui/remove-chat chat-id])}}))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:chat.ui/set-chat-ui-props
|
|
|
|
(fn [{:keys [db]} [_ kvs]]
|
|
|
|
{:db (chat/set-chat-ui-props db kvs)}))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:chat.ui/show-message-details
|
|
|
|
(fn [{:keys [db]} [_ details]]
|
|
|
|
{:db (chat/set-chat-ui-props db {:show-bottom-info? true
|
|
|
|
:bottom-info details})}))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:chat.ui/show-message-options
|
|
|
|
(fn [{:keys [db]} [_ options]]
|
|
|
|
{:db (chat/set-chat-ui-props db {:show-message-options? true
|
|
|
|
:message-options options})}))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:chat.ui/navigate-to-chat
|
|
|
|
(fn [cofx [_ chat-id opts]]
|
|
|
|
(chat/navigate-to-chat cofx chat-id opts)))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:chat.ui/load-more-messages
|
|
|
|
[(re-frame/inject-cofx :data-store/get-messages)
|
2018-10-09 13:21:25 +00:00
|
|
|
(re-frame/inject-cofx :data-store/get-user-statuses)
|
|
|
|
(re-frame/inject-cofx :data-store/get-referenced-messages)]
|
2018-09-24 16:27:04 +00:00
|
|
|
(fn [cofx _]
|
|
|
|
(chat.loading/load-more-messages cofx)))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:chat.ui/start-chat
|
|
|
|
(fn [cofx [_ contact-id opts]]
|
|
|
|
(chat/start-chat cofx contact-id opts)))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:chat.ui/start-public-chat
|
2018-10-17 11:02:34 +00:00
|
|
|
(fn [cofx [_ topic opts]]
|
|
|
|
(chat/start-public-chat cofx topic opts)))
|
2018-09-24 16:27:04 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:chat.ui/remove-chat
|
|
|
|
(fn [cofx [_ chat-id]]
|
|
|
|
(chat/remove-chat cofx chat-id)))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:chat.ui/clear-history
|
|
|
|
(fn [{{:keys [current-chat-id]} :db :as cofx} _]
|
|
|
|
(chat/clear-history cofx current-chat-id)))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:chat.ui/resend-message
|
|
|
|
(fn [cofx [_ chat-id message-id]]
|
|
|
|
(chat.message/resend-message cofx chat-id message-id)))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:chat.ui/delete-message
|
|
|
|
(fn [cofx [_ chat-id message-id]]
|
|
|
|
(chat.message/delete-message cofx chat-id message-id)))
|
|
|
|
|
2018-10-18 00:05:39 +00:00
|
|
|
(handlers/register-handler-fx
|
|
|
|
:chat.ui/message-expand-toggled
|
|
|
|
(fn [cofx [_ chat-id message-id]]
|
|
|
|
(chat.message/toggle-expand-message cofx chat-id message-id)))
|
|
|
|
|
2018-09-24 16:27:04 +00:00
|
|
|
(handlers/register-handler-fx
|
|
|
|
:chat.ui/show-profile
|
|
|
|
(fn [cofx [_ identity]]
|
|
|
|
(navigation/navigate-to-cofx
|
|
|
|
(assoc-in cofx [:db :contacts/identity] identity) :profile nil)))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:chat.ui/set-chat-input-text
|
|
|
|
(fn [cofx [_ text]]
|
|
|
|
(chat.input/set-chat-input-text cofx text)))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:chat.ui/select-chat-input-command
|
|
|
|
(fn [cofx [_ command params previous-command-message]]
|
|
|
|
(chat.input/select-chat-input-command cofx command params previous-command-message)))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:chat.ui/set-command-prefix
|
|
|
|
(fn [cofx _]
|
|
|
|
(chat.input/set-command-prefix cofx)))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:chat.ui/cancel-message-reply
|
|
|
|
(fn [cofx _]
|
|
|
|
(chat.input/cancel-message-reply cofx)))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:chat.ui/reply-to-message
|
2018-12-01 17:02:15 +00:00
|
|
|
(fn [cofx [_ message-id old-message-id]]
|
|
|
|
(chat.input/reply-to-message cofx message-id old-message-id)))
|
2018-09-24 16:27:04 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:chat.ui/send-current-message
|
|
|
|
(fn [cofx _]
|
|
|
|
(chat.input/send-current-message cofx)))
|
|
|
|
|
2018-11-20 21:43:40 +00:00
|
|
|
(handlers/register-handler-fx
|
|
|
|
:chat.ui/set-command-parameter
|
|
|
|
(fn [{{:keys [chats current-chat-id chat-ui-props id->command access-scope->command-id]} :db :as cofx} [_ value]]
|
|
|
|
(let [current-chat (get chats current-chat-id)
|
|
|
|
selection (get-in chat-ui-props [current-chat-id :selection])
|
|
|
|
commands (commands/chat-commands id->command access-scope->command-id current-chat)
|
|
|
|
{:keys [current-param-position params]} (commands.input/selected-chat-command
|
|
|
|
(:input-text current-chat) selection commands)
|
|
|
|
last-param-idx (dec (count params))]
|
|
|
|
(commands.input/set-command-parameter cofx
|
|
|
|
(= current-param-position last-param-idx)
|
|
|
|
current-param-position
|
|
|
|
value))))
|
|
|
|
|
2018-11-27 09:36:51 +00:00
|
|
|
(handlers/register-handler-fx
|
|
|
|
:chat/send-plain-text-message
|
|
|
|
(fn [{{:keys [current-chat-id]} :db :as cofx} [_ message-text]]
|
|
|
|
(chat.input/send-plain-text-message-fx cofx message-text current-chat-id)))
|
|
|
|
|
2018-09-24 16:27:04 +00:00
|
|
|
(handlers/register-handler-fx
|
|
|
|
:chat/disable-cooldown
|
|
|
|
(fn [cofx _]
|
|
|
|
(chat/disable-chat-cooldown cofx)))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:message/add
|
|
|
|
(fn [cofx [_ messages]]
|
|
|
|
(chat.message/receive-many cofx messages)))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:message/update-message-status
|
|
|
|
(fn [cofx [_ chat-id message-id status]]
|
|
|
|
(chat.message/update-message-status cofx chat-id message-id status)))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
|
|
|
;; signal module
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:signals/signal-received
|
|
|
|
(fn [cofx [_ event-str]]
|
|
|
|
(log/debug :event-str event-str)
|
2018-09-24 15:59:02 +00:00
|
|
|
(signals/process cofx event-str)))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
|
|
|
;; protocol module
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:protocol.ui/close-app-confirmed
|
2018-09-24 15:59:02 +00:00
|
|
|
(fn [cofx _]
|
|
|
|
(protocol/handle-close-app-confirmed cofx)))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:protocol/state-sync-timed-out
|
|
|
|
(fn [cofx _]
|
|
|
|
(protocol/check-sync-state cofx)))
|
|
|
|
|
|
|
|
;; web3 module
|
|
|
|
|
2018-09-20 10:05:44 +00:00
|
|
|
(handlers/register-handler-fx
|
2018-09-06 10:04:12 +00:00
|
|
|
:web3.callback/get-syncing-success
|
|
|
|
(fn [cofx [_ error sync]]
|
2018-10-15 09:16:56 +00:00
|
|
|
(web3/update-syncing-progress cofx error sync)))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:web3.callback/get-block-number
|
|
|
|
(fn [cofx [_ error block-number]]
|
|
|
|
(node/update-block-number cofx error block-number)))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
|
|
|
;; notifications module
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:notifications/notification-event-received
|
|
|
|
(fn [cofx [_ event]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(notifications/handle-push-notification cofx event)))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
2018-09-20 10:05:44 +00:00
|
|
|
(handlers/register-handler-fx
|
2018-09-06 10:04:12 +00:00
|
|
|
:notifications.callback/get-fcm-token-success
|
2018-09-20 10:05:44 +00:00
|
|
|
(fn [{:keys [db]} [_ fcm-token]]
|
|
|
|
{:db (assoc-in db [:notifications :fcm-token] fcm-token)}))
|
2018-09-06 10:04:12 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:notifications.callback/request-notifications-permissions-granted
|
|
|
|
(fn [cofx _]
|
|
|
|
(accounts/show-mainnet-is-default-alert cofx)))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:notifications.callback/request-notifications-permissions-denied
|
|
|
|
(fn [cofx _]
|
|
|
|
(accounts/show-mainnet-is-default-alert cofx)))
|
2018-09-18 16:27:58 +00:00
|
|
|
|
|
|
|
;; hardwallet module
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:hardwallet.callback/check-nfc-support-success
|
|
|
|
(fn [cofx [_ supported?]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(hardwallet/set-nfc-support cofx supported?)))
|
2018-09-18 16:27:58 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:hardwallet.callback/check-nfc-enabled-success
|
|
|
|
(fn [cofx [_ enabled?]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(hardwallet/set-nfc-enabled cofx enabled?)))
|
2018-09-18 16:27:58 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:hardwallet.ui/status-hardwallet-option-pressed
|
|
|
|
(fn [cofx _]
|
|
|
|
(hardwallet/navigate-to-connect-screen cofx)))
|
|
|
|
|
2018-09-20 16:36:12 +00:00
|
|
|
(handlers/register-handler-fx
|
|
|
|
:hardwallet.ui/password-option-pressed
|
|
|
|
(fn [cofx _]
|
|
|
|
(accounts.create/navigate-to-create-account-screen cofx)))
|
|
|
|
|
2018-09-18 16:27:58 +00:00
|
|
|
(handlers/register-handler-fx
|
|
|
|
:hardwallet.ui/go-to-settings-button-pressed
|
|
|
|
(fn [_ _]
|
|
|
|
{:hardwallet/open-nfc-settings nil}))
|
2018-09-21 13:41:40 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:hardwallet.ui/connect-info-button-pressed
|
|
|
|
(fn [cofx _]
|
2018-09-24 15:59:02 +00:00
|
|
|
(browser/open-url cofx "https://hardwallet.status.im")))
|
2018-09-21 13:41:40 +00:00
|
|
|
|
2018-09-20 11:24:14 +00:00
|
|
|
(handlers/register-handler-fx
|
|
|
|
:hardwallet.ui/hold-card-button-pressed
|
|
|
|
(fn [{:keys [db] :as cofx} _]
|
2018-09-24 15:59:02 +00:00
|
|
|
(fx/merge cofx
|
|
|
|
{:db (assoc-in db [:hardwallet :setup-step] :begin)}
|
|
|
|
(navigation/navigate-to-cofx :hardwallet-setup nil))))
|
2018-09-20 11:24:14 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:hardwallet.ui/begin-setup-button-pressed
|
|
|
|
(fn [{:keys [db]} _]
|
2018-10-01 16:35:06 +00:00
|
|
|
{:db (assoc-in db [:hardwallet :setup-step] :preparing)}))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:hardwallet.ui/pair-card-button-pressed
|
|
|
|
(fn [{:keys [db]} _]
|
|
|
|
{:db (assoc-in db [:hardwallet :setup-step] :enter-pair-code)}))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:hardwallet.ui/pair-code-input-changed
|
|
|
|
(fn [{:keys [db]} [_ pair-code]]
|
|
|
|
{:db (assoc-in db [:hardwallet :pair-code] pair-code)}))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:hardwallet.ui/pair-code-next-button-pressed
|
|
|
|
(fn [{:keys [db]} _]))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:hardwallet.ui/no-pairing-slots-help-button-pressed
|
|
|
|
(fn [cofx _]
|
|
|
|
(browser/open-url "https://hardwallet.status.im" cofx)))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:hardwallet.ui/card-already-linked-help-button-pressed
|
|
|
|
(fn [cofx _]
|
|
|
|
(browser/open-url "https://hardwallet.status.im" cofx)))
|
2018-09-20 11:24:14 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:hardwallet/connection-error
|
|
|
|
(fn [_ _]
|
|
|
|
{:utils/show-popup {:title (i18n/label :t/cant-read-card)
|
|
|
|
:content (i18n/label :t/cant-read-card-error-explanation)
|
|
|
|
:on-dismiss #(re-frame/dispatch [:hardwallet.ui/connection-error-confirm-button-pressed])}}))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:hardwallet.ui/connection-error-confirm-button-pressed
|
|
|
|
(fn [{:keys [db] :as cofx} _]
|
2018-09-24 15:59:02 +00:00
|
|
|
(fx/merge cofx
|
|
|
|
{:db (assoc-in db [:hardwallet :setup-step] :begin)}
|
|
|
|
(navigation/navigate-to-cofx :hardwallet-setup nil))))
|
2018-09-20 11:24:14 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:hardwallet.ui/secret-keys-next-button-pressed
|
|
|
|
(fn [_ _]
|
|
|
|
{:ui/show-confirmation {:title (i18n/label :t/secret-keys-confirmation-title)
|
|
|
|
:content (i18n/label :t/secret-keys-confirmation-text)
|
|
|
|
:confirm-button-text (i18n/label :t/secret-keys-confirmation-confirm)
|
|
|
|
:cancel-button-text (i18n/label :t/secret-keys-confirmation-cancel)
|
|
|
|
:on-accept #(re-frame/dispatch [:hardwallet.ui/secret-keys-dialog-confirm-pressed])
|
|
|
|
:on-cancel #()}}))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:hardwallet.ui/secret-keys-dialog-confirm-pressed
|
|
|
|
(fn [{:keys [db]} _]
|
|
|
|
{:db (assoc-in db [:hardwallet :setup-step] :complete)}))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:hardwallet.ui/success-button-pressed
|
|
|
|
(fn [cofx _]
|
2018-09-24 15:59:02 +00:00
|
|
|
(navigation/navigate-to-cofx cofx :home nil)))
|
2018-09-20 11:24:14 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:hardwallet.ui/pin-numpad-button-pressed
|
|
|
|
(fn [cofx [_ number step]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(hardwallet/process-pin-input cofx number step)))
|
2018-09-20 11:24:14 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:hardwallet.ui/pin-numpad-delete-button-pressed
|
|
|
|
(fn [{:keys [db]} [_ step]]
|
|
|
|
(when-not (empty? (get-in db [:hardwallet :pin step]))
|
|
|
|
{:db (update-in db [:hardwallet :pin step] pop)})))
|
|
|
|
|
2018-10-03 13:16:28 +00:00
|
|
|
(handlers/register-handler-fx
|
|
|
|
:hardwallet.ui/create-pin-button-pressed
|
|
|
|
(fn [{:keys [db]} _]
|
|
|
|
{:db (update-in db [:hardwallet :setup-step] :pin)}))
|
|
|
|
|
2018-09-21 13:41:40 +00:00
|
|
|
;; browser module
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:browser.ui/browser-item-selected
|
|
|
|
(fn [cofx [_ browser-id]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(browser/open-existing-browser cofx browser-id)))
|
2018-09-21 13:41:40 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:browser.ui/url-input-pressed
|
|
|
|
(fn [cofx _]
|
2018-09-24 15:59:02 +00:00
|
|
|
(browser/update-browser-option cofx :url-editing? true)))
|
2018-09-21 13:41:40 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:browser.ui/url-input-blured
|
|
|
|
(fn [cofx _]
|
2018-09-24 15:59:02 +00:00
|
|
|
(browser/update-browser-option cofx :url-editing? false)))
|
2018-09-21 13:41:40 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:browser.ui/url-submitted
|
|
|
|
(fn [cofx [_ url]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(browser/open-url-in-current-browser cofx url)))
|
2018-09-21 13:41:40 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:browser.ui/message-link-pressed
|
|
|
|
(fn [cofx [_ link]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(browser/handle-message-link cofx link)))
|
2018-09-21 13:41:40 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:browser.ui/remove-browser-pressed
|
|
|
|
(fn [cofx [_ browser-id]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(browser/remove-browser cofx browser-id)))
|
2018-09-21 13:41:40 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:browser.ui/lock-pressed
|
|
|
|
(fn [cofx [_ secure?]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(browser/update-browser-option cofx :show-tooltip (if secure? :secure :not-secure))))
|
2018-09-21 13:41:40 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:browser.ui/close-tooltip-pressed
|
|
|
|
(fn [cofx _]
|
2018-09-24 15:59:02 +00:00
|
|
|
(browser/update-browser-option cofx :show-tooltip nil)))
|
2018-09-21 13:41:40 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:browser.ui/previous-page-button-pressed
|
|
|
|
(fn [cofx _]
|
|
|
|
(browser/navigate-to-previous-page cofx)))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:browser.ui/next-page-button-pressed
|
|
|
|
(fn [cofx _]
|
|
|
|
(browser/navigate-to-next-page cofx)))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:browser/navigation-state-changed
|
|
|
|
(fn [cofx [_ event error?]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(browser/navigation-state-changed cofx event error?)))
|
2018-09-21 13:41:40 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:browser/bridge-message-received
|
|
|
|
(fn [cofx [_ message]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(browser/process-bridge-message cofx message)))
|
2018-09-21 13:41:40 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:browser/error-occured
|
|
|
|
(fn [cofx _]
|
|
|
|
(browser/handle-browser-error cofx)))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:browser/loading-started
|
|
|
|
(fn [cofx _]
|
2018-09-24 15:59:02 +00:00
|
|
|
(browser/update-browser-option cofx :error? false)))
|
2018-09-21 13:41:40 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:browser.callback/resolve-ens-multihash-success
|
|
|
|
(fn [cofx [_ hash]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(browser/resolve-ens-multihash-success cofx hash)))
|
2018-09-21 13:41:40 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:browser.callback/resolve-ens-multihash-error
|
|
|
|
(fn [cofx _]
|
2018-11-06 15:09:58 +00:00
|
|
|
(browser/resolve-ens-multihash-error cofx)))
|
2018-09-21 13:41:40 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:browser.callback/call-rpc
|
|
|
|
(fn [cofx [_ message]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(browser/send-to-bridge cofx message)))
|
2018-09-21 13:41:40 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:browser.permissions.ui/dapp-permission-allowed
|
2018-09-28 13:40:19 +00:00
|
|
|
(fn [cofx _]
|
|
|
|
(browser.permissions/allow-permission cofx)))
|
2018-09-21 13:41:40 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:browser.permissions.ui/dapp-permission-denied
|
2018-09-28 13:40:19 +00:00
|
|
|
(fn [cofx _]
|
|
|
|
(browser.permissions/deny-permission cofx)))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:browser.permissions.ui/permission-animation-finished
|
2018-09-21 13:41:40 +00:00
|
|
|
(fn [cofx [_ dapp-name]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(browser.permissions/process-next-permission cofx dapp-name)))
|
2018-09-21 13:41:40 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:browser.ui/open-in-status-option-selected
|
|
|
|
(fn [cofx [_ url]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(browser/open-url cofx url)))
|
2018-09-21 13:41:40 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:browser.ui/open-dapp-button-pressed
|
|
|
|
(fn [cofx [_ dapp-url]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(browser/open-url cofx dapp-url)))
|
2018-09-21 13:41:40 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:browser.ui/dapp-url-submitted
|
|
|
|
(fn [cofx [_ dapp-url]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(browser/open-url cofx dapp-url)))
|
2018-09-06 14:08:20 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:browser.ui/open-modal-chat-button-pressed
|
|
|
|
(fn [cofx [_ host]]
|
2018-09-24 15:59:02 +00:00
|
|
|
(browser/open-chat-from-browser cofx host)))
|
2018-07-19 15:51:06 +00:00
|
|
|
|
|
|
|
;; group-chats module
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:group-chats.ui/create-pressed
|
|
|
|
[(re-frame/inject-cofx :random-guid-generator)]
|
|
|
|
(fn [cofx [_ chat-name]]
|
|
|
|
(group-chats/create cofx chat-name)))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:group-chats.ui/name-changed
|
|
|
|
(fn [cofx [_ chat-name]]
|
|
|
|
(group-chats/handle-name-changed cofx chat-name)))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:group-chats.ui/save-pressed
|
|
|
|
(fn [cofx _]
|
|
|
|
(group-chats/save cofx)))
|
|
|
|
|
2018-10-01 08:47:20 +00:00
|
|
|
(handlers/register-handler-fx
|
|
|
|
:group-chats.ui/add-members-pressed
|
|
|
|
(fn [cofx _]
|
|
|
|
(group-chats/add-members cofx)))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:group-chats.ui/remove-member-pressed
|
|
|
|
(fn [cofx [_ chat-id public-key]]
|
|
|
|
(group-chats/remove-member cofx chat-id public-key)))
|
|
|
|
|
2018-11-29 10:06:06 +00:00
|
|
|
(handlers/register-handler-fx
|
|
|
|
:group-chats.ui/make-admin-pressed
|
|
|
|
(fn [cofx [_ chat-id public-key]]
|
|
|
|
(group-chats/make-admin cofx chat-id public-key)))
|
|
|
|
|
2018-10-01 08:47:20 +00:00
|
|
|
(handlers/register-handler-fx
|
|
|
|
:group-chats.ui/remove-chat-pressed
|
|
|
|
(fn [_ [_ chat-id group?]]
|
|
|
|
{:ui/show-confirmation {:title (i18n/label :t/delete-confirmation)
|
|
|
|
:content (i18n/label :t/delete-chat-confirmation)
|
|
|
|
:confirm-button-text (i18n/label :t/delete)
|
|
|
|
:on-accept #(re-frame/dispatch [:group-chats.ui/remove-chat-confirmed chat-id])}}))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:group-chats.ui/remove-chat-confirmed
|
|
|
|
(fn [cofx [_ chat-id]]
|
|
|
|
(group-chats/remove cofx chat-id)))
|
|
|
|
|
2018-07-19 15:51:06 +00:00
|
|
|
(handlers/register-handler-fx
|
|
|
|
:group-chats.callback/sign-success
|
|
|
|
[(re-frame/inject-cofx :random-guid-generator)]
|
|
|
|
(fn [cofx [_ group-update]]
|
|
|
|
(group-chats/handle-sign-success cofx group-update)))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
2018-10-01 08:47:20 +00:00
|
|
|
:group-chats.callback/extract-signature-success
|
2018-12-03 15:34:26 +00:00
|
|
|
(fn [cofx [_ group-update raw-payload sender-signature]]
|
|
|
|
(group-chats/handle-membership-update cofx group-update raw-payload sender-signature)))
|
2018-10-01 08:26:47 +00:00
|
|
|
|
2018-10-09 08:10:47 +00:00
|
|
|
;; profile module
|
|
|
|
|
2018-10-01 08:26:47 +00:00
|
|
|
(handlers/register-handler-fx
|
|
|
|
:profile.ui/ens-names-button-pressed
|
|
|
|
(fn [cofx]
|
|
|
|
(browser/open-url cofx "names.statusnet.eth")))
|
2018-10-09 08:10:47 +00:00
|
|
|
|
|
|
|
;; transport module
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:transport/messages-received
|
|
|
|
[handlers/logged-in (re-frame/inject-cofx :random-id-generator)]
|
|
|
|
(fn [cofx [_ js-error js-messages chat-id]]
|
|
|
|
(transport.message/receive-whisper-messages cofx js-error js-messages chat-id)))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:transport/send-status-message-error
|
|
|
|
(fn [{:keys [db] :as cofx} [_ err]]
|
|
|
|
(log/error :send-status-message-error err)))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:transport/message-sent
|
|
|
|
(fn [cofx [_ chat-id message-id message-type envelope-hash-js]]
|
|
|
|
(transport.message/set-message-envelope-hash cofx chat-id message-id message-type envelope-hash-js)))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:transport/contact-message-sent
|
|
|
|
(fn [cofx [_ chat-id envelope-hash]]
|
|
|
|
(transport.message/set-contact-message-envelope-hash cofx chat-id envelope-hash)))
|
2018-10-11 08:38:23 +00:00
|
|
|
|
|
|
|
;; contact module
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:contact.ui/add-to-contact-pressed
|
|
|
|
[(re-frame/inject-cofx :random-id-generator)]
|
2018-10-26 18:06:23 +00:00
|
|
|
(fn [cofx [_ public-key]]
|
|
|
|
(contact/add-contact cofx public-key)))
|
2018-10-11 08:38:23 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:contact.ui/close-contact-pressed
|
2018-10-26 18:06:23 +00:00
|
|
|
(fn [cofx [_ public-key]]
|
|
|
|
(contact/hide-contact cofx public-key)))
|
2018-10-11 08:38:23 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:contact/qr-code-scanned
|
|
|
|
[(re-frame/inject-cofx :random-id-generator)]
|
|
|
|
(fn [cofx [_ _ contact-identity]]
|
|
|
|
(contact/handle-qr-code cofx contact-identity)))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:contact.ui/start-group-chat-pressed
|
|
|
|
(fn [{:keys [db] :as cofx} _]
|
|
|
|
(contact/open-contact-toggle-list cofx)))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:contact.ui/send-message-pressed
|
|
|
|
[(re-frame/inject-cofx :random-id-generator)]
|
2018-10-26 18:06:23 +00:00
|
|
|
(fn [cofx [_ {:keys [public-key]}]]
|
|
|
|
(contact/add-contact-and-open-chat cofx public-key)))
|
2018-10-11 08:38:23 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:contact.ui/contact-code-submitted
|
|
|
|
[(re-frame/inject-cofx :random-id-generator)]
|
|
|
|
(fn [cofx _]
|
|
|
|
(contact/add-new-identity-to-contacts cofx)))
|
2018-10-13 16:47:34 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:contact.ui/add-tag
|
|
|
|
(fn [cofx _]
|
|
|
|
(contact/add-tag cofx)))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:contact.ui/set-tag-input-field
|
|
|
|
(fn [cofx [_ text]]
|
|
|
|
{:db (assoc-in (:db cofx) [:ui/contact :contact/new-tag] text)}))
|
|
|
|
|
|
|
|
;; search module
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:search/filter-changed
|
|
|
|
(fn [cofx [_ search-filter]]
|
|
|
|
(search/filter-changed cofx search-filter)))
|
2018-10-09 10:43:07 +00:00
|
|
|
|
|
|
|
;; pairing module
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:pairing.ui/pair-devices-pressed
|
|
|
|
(fn [cofx _]
|
2018-11-02 13:48:45 +00:00
|
|
|
(pairing/pair-installation cofx)))
|
2018-10-09 10:43:07 +00:00
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:pairing.ui/synchronize-installation-pressed
|
|
|
|
(fn [cofx _]
|
2018-11-08 13:07:29 +00:00
|
|
|
(pairing/send-installation-messages cofx)))
|
2018-11-02 13:48:45 +00:00
|
|
|
|
2018-10-27 19:24:47 +00:00
|
|
|
(handlers/register-handler-fx
|
|
|
|
:set-initial-props
|
|
|
|
(fn [cofx [_ initial-props]]
|
|
|
|
{:db (assoc (:db cofx) :initial-props initial-props)}))
|
|
|
|
|
2018-11-02 13:48:45 +00:00
|
|
|
(handlers/register-handler-fx
|
|
|
|
:pairing.ui/enable-installation-pressed
|
|
|
|
(fn [cofx [_ installation-id]]
|
|
|
|
(pairing/enable-fx cofx installation-id)))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:pairing.ui/disable-installation-pressed
|
|
|
|
(fn [cofx [_ installation-id]]
|
|
|
|
(pairing/disable-fx cofx installation-id)))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:pairing.callback/enable-installation-success
|
|
|
|
(fn [cofx [_ installation-id]]
|
|
|
|
(pairing/enable cofx installation-id)))
|
|
|
|
|
|
|
|
(handlers/register-handler-fx
|
|
|
|
:pairing.callback/disable-installation-success
|
|
|
|
(fn [cofx [_ installation-id]]
|
|
|
|
(pairing/disable cofx installation-id)))
|