Fix some typos in develop
This commit is contained in:
parent
a995f73638
commit
40e006ef00
|
@ -50,22 +50,22 @@
|
||||||
:message-status :seen})))
|
:message-status :seen})))
|
||||||
|
|
||||||
(handlers/register-handler-fx
|
(handlers/register-handler-fx
|
||||||
:start-listening-confirmation-code-sms
|
:start-listening-confirmation-code-sms
|
||||||
[re-frame/trim-v]
|
[re-frame/trim-v]
|
||||||
(fn [{:keys [db]} [sms-listener]]
|
(fn [{:keys [db]} [sms-listener]]
|
||||||
{:db (if-not (:confirmation-code-sms-listener db)
|
{:db (if-not (:confirmation-code-sms-listener db)
|
||||||
(assoc db :confirmation-code-sms-listener sms-listener)
|
(assoc db :confirmation-code-sms-listener sms-listener)
|
||||||
db)}))
|
db)}))
|
||||||
|
|
||||||
(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
|
||||||
(fn [subscription]
|
(fn [subscription]
|
||||||
(sms-listener/remove-sms-listener subscription)))
|
(sms-listener/remove-sms-listener subscription)))
|
||||||
|
|
||||||
(defn- sms-receive-handler [{confirmation-code :body}]
|
(defn- sms-receive-handler [{confirmation-code :body}]
|
||||||
(when-let [matches (re-matches #"(\d{4})" confirmation-code)]
|
(when-let [matches (re-matches #"(\d{4})" confirmation-code)]
|
||||||
|
@ -79,15 +79,15 @@
|
||||||
(re-frame/dispatch [:start-listening-confirmation-code-sms listener])))])
|
(re-frame/dispatch [:start-listening-confirmation-code-sms listener])))])
|
||||||
|
|
||||||
(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)
|
||||||
;; create automatic way for receiving confirmation code
|
;; create automatic way for receiving confirmation code
|
||||||
start-listening-confirmation-code-sms-event]}
|
start-listening-confirmation-code-sms-event]}
|
||||||
(message-seen message-id))))
|
(message-seen message-id))))
|
||||||
|
|
||||||
(defn- extract-last-phone-number [chats]
|
(defn- extract-last-phone-number [chats]
|
||||||
(let [phone-message (->> (get-in chats ["console" :messages])
|
(let [phone-message (->> (get-in chats ["console" :messages])
|
||||||
|
@ -103,18 +103,15 @@
|
||||||
(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
|
#(re-frame/dispatch [:sync-contacts (fn [contacts]
|
||||||
(update :dispatch-n conj [:request-permissions [:read-contacts]
|
[::contacts-synced contacts])])]))]
|
||||||
#(re-frame/dispatch [:sync-contacts (fn [contacts]
|
(cond-> fx
|
||||||
[::contacts-synced contacts])])])
|
last-phone-number (accounts-events/account-update {:phone last-phone-number
|
||||||
|
:last-updated now}))))
|
||||||
last-phone-number
|
|
||||||
(accounts-events/account-update {:phone last-phone-number
|
|
||||||
:last-updated now}))))
|
|
||||||
|
|
||||||
(handlers/register-handler-fx
|
(handlers/register-handler-fx
|
||||||
::sign-up-confirm-response
|
::sign-up-confirm-response
|
||||||
|
|
|
@ -31,14 +31,14 @@
|
||||||
;;;; COFX
|
;;;; COFX
|
||||||
|
|
||||||
(re-frame/reg-cofx
|
(re-frame/reg-cofx
|
||||||
:get-new-keypair!
|
:get-new-keypair!
|
||||||
(fn [coeffects _]
|
(fn [coeffects _]
|
||||||
(assoc coeffects :keypair (protocol/new-keypair!))))
|
(assoc coeffects :keypair (protocol/new-keypair!))))
|
||||||
|
|
||||||
(re-frame/reg-cofx
|
(re-frame/reg-cofx
|
||||||
::get-all-accounts
|
::get-all-accounts
|
||||||
(fn [coeffects _]
|
(fn [coeffects _]
|
||||||
(assoc coeffects :all-accounts (accounts-store/get-all))))
|
(assoc coeffects :all-accounts (accounts-store/get-all))))
|
||||||
|
|
||||||
;;;; FX
|
;;;; FX
|
||||||
|
|
||||||
|
@ -138,9 +138,9 @@
|
||||||
;;workaround for realm bug, migrating account v4
|
;;workaround for realm bug, migrating account v4
|
||||||
events (mapv #(when (empty? (:networks %)) [:account-update-networks (:address %)]) (vals accounts))]
|
events (mapv #(when (empty? (:networks %)) [:account-update-networks (:address %)]) (vals accounts))]
|
||||||
(merge
|
(merge
|
||||||
{:db (assoc db :accounts/accounts accounts)}
|
{:db (assoc db :accounts/accounts accounts)}
|
||||||
(when-not (empty? events)
|
(when-not (empty? events)
|
||||||
{:dispatch-n events})))))
|
{:dispatch-n events})))))
|
||||||
|
|
||||||
(handlers/register-handler-fx
|
(handlers/register-handler-fx
|
||||||
:account-update-networks
|
:account-update-networks
|
||||||
|
@ -162,18 +162,16 @@
|
||||||
{: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]))))))
|
|
||||||
|
|
||||||
(handlers/register-handler-fx
|
(handlers/register-handler-fx
|
||||||
:account-update-keys
|
:account-update-keys
|
||||||
|
|
Loading…
Reference in New Issue