Fix some typos in develop

This commit is contained in:
janherich 2017-11-06 16:17:03 +01:00 committed by Roman Volosovskyi
parent a995f73638
commit 40e006ef00
2 changed files with 43 additions and 48 deletions

View File

@ -59,8 +59,8 @@
(defn stop-listening-confirmation-code-sms [{:keys [db] :as fx}] (defn stop-listening-confirmation-code-sms [{:keys [db] :as fx}]
(-> fx (-> fx
(update db dissoc :confirmation-code-sms-listener) (update :db dissoc :confirmation-code-sms-listener)
(update ::remove-sms-listener assoc (:confirmation-code-sms-listener db)))) (assoc ::remove-sms-listener (:confirmation-code-sms-listener db))))
(re-frame/reg-fx (re-frame/reg-fx
::remove-sms-listener ::remove-sms-listener
@ -81,7 +81,7 @@
(handlers/register-handler-fx (handlers/register-handler-fx
::sign-up-success ::sign-up-success
[re-frame/trim-v (re-frame/inject-cofx :random-id)] [re-frame/trim-v (re-frame/inject-cofx :random-id)]
(fn [{:keys [db random-id]} message-id] (fn [{:keys [db random-id]} [message-id]]
(-> {:db db (-> {:db db
:dispatch-n [;; create manual way for entering confirmation code :dispatch-n [;; create manual way for entering confirmation code
(sign-up/enter-confirmation-code-event random-id) (sign-up/enter-confirmation-code-event random-id)
@ -103,17 +103,14 @@
(sign-up-confirm db confirmation-code message-id))) (sign-up-confirm db confirmation-code message-id)))
(defn- sign-up-confirmed [{:keys [db] :as fx} now] (defn- sign-up-confirmed [{:keys [db] :as fx} now]
(let [last-phone-number (extract-last-phone-number (:chats db))] (let [last-phone-number (extract-last-phone-number (:chats db))
(cond-> fx (-> (stop-listening-confirmation-code-sms fx)
(stop-listening-confirmation-code-sms fx) (update :dispatch-n conj
[:request-permissions [:read-contacts]
true
(update :dispatch-n conj [:request-permissions [:read-contacts]
#(re-frame/dispatch [:sync-contacts (fn [contacts] #(re-frame/dispatch [:sync-contacts (fn [contacts]
[::contacts-synced contacts])])]) [::contacts-synced contacts])])]))]
(cond-> fx
last-phone-number last-phone-number (accounts-events/account-update {:phone last-phone-number
(accounts-events/account-update {:phone last-phone-number
:last-updated now})))) :last-updated now}))))
(handlers/register-handler-fx (handlers/register-handler-fx

View File

@ -162,16 +162,14 @@
{:dispatch [:broadcast-status status hashtags]})))))) {:dispatch [:broadcast-status status hashtags]}))))))
(defn account-update (defn account-update
"Takes map of coeffects containing `:db` and `:now` keys + new account fields, "Takes effects (containing :db) + new account fields, adds all effects necessary for account update."
returns all effects necessary for account update."
[{{:accounts/keys [accounts current-account-id] :as db} :db :as fx} new-account-fields] [{{:accounts/keys [accounts current-account-id] :as db} :db :as fx} new-account-fields]
(let [current-account (get accounts current-account-id) (let [current-account (get accounts current-account-id)
new-account (merge current-account new-account-fields)] new-account (merge current-account new-account-fields)]
(-> fx (-> fx
(assoc-in [:db :accounts/accounts current-account-id] new-account) (assoc-in [:db :accounts/accounts current-account-id] new-account)
(assoc ::save-account new-account) (assoc ::save-account new-account
(assoc ::broadcast-account-update (merge ::broadcast-account-update (merge (select-keys db [:current-public-key :web3])
(select-keys db [:current-public-key :web3])
(select-keys new-account [:name :photo-path :status (select-keys new-account [:name :photo-path :status
:updates-public-key :updates-private-key])))))) :updates-public-key :updates-private-key]))))))