Skip to content

Commit

Permalink
code review and fixed keyboard
Browse files Browse the repository at this point in the history
  • Loading branch information
flexsurfer committed Jun 7, 2019
1 parent 1e652ac commit 401969d
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 15 deletions.
11 changes: 5 additions & 6 deletions src/status_im/browser/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -300,14 +300,13 @@
"NOTE (andrey) we need this function, because params may be mixed up,
so we need to figure out which one is address and which message"
[params]
(let [first_param (first params)
second_param (second params)
first-param-address? (ethereum/address? first_param)
second-param-address? (ethereum/address? second_param)]
(let [[first-param second-param] params
first-param-address? (ethereum/address? first-param)
second-param-address? (ethereum/address? second-param)]
(when (or first-param-address? second-param-address?)
(if first-param-address?
[first_param second_param]
[second_param first_param]))))
[first-param second-param]
[second-param first-param]))))

(fx/defn web3-send-async
[cofx {:keys [method params id] :as payload} message-id]
Expand Down
5 changes: 5 additions & 0 deletions src/status_im/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -2113,3 +2113,8 @@
:shake-event
(fn [cofx _]
(logging/show-logs-dialog cofx)))

(re-frame/reg-fx
:dismiss-keyboard
(fn []
(react/dismiss-keyboard!)))
15 changes: 10 additions & 5 deletions src/status_im/signing/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,20 @@
(let [{:signing/keys [queue]} db
{{:keys [gas gasPrice] :as tx-obj} :tx-obj {:keys [data typed?] :as message} :message :as tx} (last queue)]
(if message
{:db (assoc db :signing/in-progress? true
{:db (assoc db
:signing/in-progress? true
:signing/queue (drop-last queue)
:signing/tx tx
:signing/sign {:type :password
:formatted-data (if typed? (types/json->clj data) (ethereum/hex-to-utf8 data))})}
(fx/merge cofx
{:db (assoc db :signing/in-progress? true
:signing/queue (drop-last queue)
:signing/tx (prepare-tx db tx))}
{:db
(assoc db
:signing/in-progress? true
:signing/queue (drop-last queue)
:signing/tx (prepare-tx db tx))
:dismiss-keyboard
nil}
#(when-not gas
{:signing/update-estimated-gas {:obj tx-obj
:success-event :signing/update-estimated-gas-success}})
Expand Down Expand Up @@ -220,7 +225,7 @@
(transaction-result cofx-in-progress-false result tx-obj))))

(fx/defn discard
"Discrad transactrion signing"
"Discrad transaction signing"
{:events [:signing.ui/cancel-is-pressed]}
[{:keys [db] :as cofx}]
(let [{:keys [on-error]} (get-in db [:signing/tx])]
Expand Down
4 changes: 1 addition & 3 deletions src/status_im/subs.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -1892,7 +1892,5 @@
(let [amount-bn (money/formatted->internal (money/bignumber amount) (:symbol token) (:decimals token))
amount-error (or (get-amount-error amount (:decimals token))
(get-sufficient-funds-error balance (:symbol token) amount-bn))]
(if amount-error
amount-error
(get-sufficient-gas-error balance (:symbol token) amount-bn gas gasPrice)))
(or amount-error (get-sufficient-gas-error balance (:symbol token) amount-bn gas gasPrice)))
(get-sufficient-gas-error balance nil nil gas gasPrice))))
2 changes: 1 addition & 1 deletion src/status_im/ui/screens/signing/views.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
:accessories [[acc-text fee fee-display-symbol] :chevron]
:on-press #(re-frame/dispatch [:signing.ui/open-fee-sheet
{:content (fn [] [sheets/fee-bottom-sheet fee-display-symbol])
:content-height 280}])}]
:content-height 270}])}]
[react/view {:align-items :center :margin-top 16 :margin-bottom 40}
[button/primary-button {:on-press #(re-frame/dispatch [:set :signing/sign {:type :password}])
:disabled? (or amount-error gas-error)}
Expand Down

0 comments on commit 401969d

Please sign in to comment.