ui: new event fx for sign later in chat

This commit is contained in:
kwingram25 2018-04-25 21:37:32 -07:00
parent 2558fbcfa1
commit 31f41e2d04
3 changed files with 27 additions and 8 deletions

View File

@ -40,8 +40,12 @@
(re-frame/reg-fx
::show-transaction-moved
(fn []
(utils/show-popup (i18n/label :t/transaction-moved-title) (i18n/label :t/transaction-moved-text))))
(fn [modal?]
(utils/show-popup
(i18n/label :t/transaction-moved-title)
(i18n/label :t/transaction-moved-text)
(when modal?
#(re-frame/dispatch [:navigate-back])))))
(re-frame/reg-fx
::show-transaction-error
@ -93,6 +97,11 @@
(doseq [result results]
(dispatch-transaction-completed result))))
(handlers/register-handler-fx
:sign-later-from-chat
(fn [_ _]
{::show-transaction-moved true}))
;;TRANSACTION QUEUED signal from status-go
(handlers/register-handler-fx
:sign-request-queued
@ -140,7 +149,7 @@
;;SIGN LATER
{:db (assoc-in new-db' [:wallet :send-transaction :waiting-signal?] false)
:dispatch [:navigate-back]
::show-transaction-moved nil}
::show-transaction-moved false}
;;SIGN NOW
{:db new-db'
::accept-transaction {:id id

View File

@ -29,7 +29,7 @@
(i18n/label :t/sign-later-title)
(i18n/label :t/sign-later-text)
#(re-frame/dispatch (if from-chat?
[:navigate-back]
[:sign-later-from-chat]
[:wallet/sign-transaction true]))))
(defview sign-panel [message?]

View File

@ -2,10 +2,20 @@
(:require [status-im.i18n :as i18n]
[status-im.react-native.js-dependencies :as rn-dependencies]))
(defn show-popup [title content]
(.alert (.-Alert rn-dependencies/react-native)
title
content))
(defn show-popup
([title content]
(show-popup title content nil))
([title content on-dismiss]
(.alert (.-Alert rn-dependencies/react-native)
title
content
(clj->js
(vector (merge {:text "OK"
:style "cancel"
:accessibility-label :cancel-button}
(when on-dismiss {:onPress on-dismiss}))))
(when on-dismiss
(clj->js {:cancelable false})))))
(defn show-confirmation
([title content on-accept]