This commit is contained in:
Gustavo Nunes 2017-05-04 01:41:53 -03:00 committed by Roman Volosovskyi
parent b5edab5a21
commit 0359c2819b
2 changed files with 52 additions and 39 deletions

View File

@ -5,6 +5,7 @@
[status-im.components.common.common :as common]
[status-im.components.sticky-button :as sticky-button]
[status-im.components.status-bar :as status-bar]
[status-im.components.sync-state.offline :as offline-view]
[status-im.components.toolbar-new.actions :as act]
[status-im.components.toolbar-new.view :as toolbar]
[status-im.i18n :as i18n]
@ -51,9 +52,12 @@
(defview transaction-details []
[{:keys [id] :as transaction} [:get :selected-transaction]
{:keys [password]} [:get :confirm-transactions]
confirmed? [:get-in [:transaction-details-ui-props :confirmed?]]]
confirmed? [:get-in [:transaction-details-ui-props :confirmed?]]
sync-state [:get :sync-state]
network-status [:get :network-status]]
{:component-did-update #(when-not transaction (rf/dispatch [:navigate-to-modal :unsigned-transactions]))
:component-will-unmount #(rf/dispatch [:set-in [:transaction-details-ui-props :confirmed?] false])}
(let [offline? (or (= network-status :offline) (= sync-state :offline))]
[rn/keyboard-avoiding-view {:style st/transactions-screen}
[status-bar/status-bar {:type :transaction}]
[toolbar-view]
@ -61,7 +65,9 @@
[transactions-list-item/view transaction #(rf/dispatch [:navigate-to-modal :unsigned-transactions])]
[common/separator st/details-separator st/details-separator-wrapper]
[details transaction]]
(when confirmed? [password-form/view 1])
(when (and confirmed? (not offline?))
[password-form/view 1])
(when-not offline?
(let [confirm-text (if confirmed?
(i18n/label :t/confirm)
(i18n/label-pluralize 1 :t/confirm-transactions))
@ -69,4 +75,5 @@
#(do (rf/dispatch [:accept-transaction password id])
(rf/dispatch [:set :confirmed-transactions-count 1]))
#(rf/dispatch [:set-in [:transaction-details-ui-props :confirmed?] true]))]
[sticky-button/sticky-button confirm-text confirm-fn])])
[sticky-button/sticky-button confirm-text confirm-fn]))
[offline-view/offline-view {:top (if platform/ios? 21 0)}]]))

View File

@ -5,6 +5,7 @@
[status-im.components.react :as rn]
[status-im.components.sticky-button :as sticky-button]
[status-im.components.status-bar :as status-bar]
[status-im.components.sync-state.offline :as offline-view]
[status-im.components.toolbar-new.actions :as act]
[status-im.components.toolbar-new.view :as toolbar]
[status-im.transactions.views.list-item :as transactions-list-item]
@ -43,9 +44,12 @@
(defview unsigned-transactions []
[transactions [:transactions]
{:keys [password]} [:get :confirm-transactions]
confirmed? [:get-in [:transactions-list-ui-props :confirmed?]]]
confirmed? [:get-in [:transactions-list-ui-props :confirmed?]]
sync-state [:get :sync-state]
network-status [:get :network-status]]
{:component-did-update #(when-not (seq transactions) (rf/dispatch [:navigate-back]))
:component-will-unmount #(rf/dispatch [:set-in [:transactions-list-ui-props :confirmed?] false])}
(let [offline? (or (= network-status :offline) (= sync-state :offline))]
[(if platform/ios? rn/keyboard-avoiding-view rn/view) (merge {:behavior :padding} st/transactions-screen)
[status-bar/status-bar {:type :transaction}]
[toolbar-view transactions]
@ -54,8 +58,9 @@
:dataSource (lw/to-datasource transactions)
:renderSeparator (render-separator-fn (count transactions))
:renderRow render-row-fn}]
(when confirmed?
(when (and confirmed? (not offline?))
[password-form/view (count transactions)])]
(when-not offline?
(let [confirm-text (if confirmed?
(i18n/label :t/confirm)
(i18n/label-pluralize (count transactions) :t/confirm-transactions))
@ -63,4 +68,5 @@
#(do (rf/dispatch [:accept-transactions password])
(rf/dispatch [:set :confirmed-transactions-count (count transactions)]))
#(rf/dispatch [:set-in [:transactions-list-ui-props :confirmed?] true]))]
[sticky-button/sticky-button confirm-text confirm-fn])])
[sticky-button/sticky-button confirm-text confirm-fn]))
[offline-view/offline-view {:top (if platform/ios? 21 0)}]]))