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

View File

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

View File

@ -2,10 +2,20 @@
(:require [status-im.i18n :as i18n] (:require [status-im.i18n :as i18n]
[status-im.react-native.js-dependencies :as rn-dependencies])) [status-im.react-native.js-dependencies :as rn-dependencies]))
(defn show-popup [title content] (defn show-popup
([title content]
(show-popup title content nil))
([title content on-dismiss]
(.alert (.-Alert rn-dependencies/react-native) (.alert (.-Alert rn-dependencies/react-native)
title title
content)) 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 (defn show-confirmation
([title content on-accept] ([title content on-accept]