diff --git a/src/status_im/ui/screens/accounts/events.cljs b/src/status_im/ui/screens/accounts/events.cljs index a1d4fd205a..6d526557ee 100644 --- a/src/status_im/ui/screens/accounts/events.cljs +++ b/src/status_im/ui/screens/accounts/events.cljs @@ -155,19 +155,22 @@ (fn [cofx [_ dev-mode]] (accounts.utils/account-update {:dev-mode? dev-mode} cofx))) -(defn wallet-set-up-passed [db cofx] +(defn chat-send? [transaction] + (and (seq transaction) + (not (:in-progress? transaction)) + (:from-chat? transaction))) + +(defn wallet-set-up-passed [db modal? cofx] (let [transaction (get-in db [:wallet :send-transaction])] - (merge - {:db (navigation/navigate-back db)} - (when (and (seq transaction) - (not (:in-progress? transaction)) - (:from-chat? transaction)) - {:dispatch [:navigate-to :wallet-send-transaction-chat]})))) + (cond modal? {:dispatch [:navigate-to-modal :wallet-send-transaction-modal]} + (chat-send? transaction) {:db (navigation/navigate-back db) + :dispatch [:navigate-to :wallet-send-transaction-chat]} + :else {:db (navigation/navigate-back db)}))) (handlers/register-handler-fx :wallet-set-up-passed - (fn [{:keys [db] :as cofx}] + (fn [{:keys [db] :as cofx} [_ modal?]] (handlers-macro/merge-fx cofx - (wallet-set-up-passed db) + (wallet-set-up-passed db modal?) (accounts.utils/account-update {:wallet-set-up-passed? true})))) diff --git a/src/status_im/ui/screens/views.cljs b/src/status_im/ui/screens/views.cljs index 3c87c71d11..5e6f78506b 100644 --- a/src/status_im/ui/screens/views.cljs +++ b/src/status_im/ui/screens/views.cljs @@ -111,6 +111,7 @@ :wallet-transaction-sent-modal transaction-sent-modal :wallet-sign-message-modal sign-message-modal :wallet-transaction-fee wallet.send/transaction-fee + :wallet-onboarding-setup-modal wallet.onboarding.setup/modal [react/view [react/text (str "Unknown modal view: " modal-view)]])) (defview main-modal [] diff --git a/src/status_im/ui/screens/wallet/onboarding/setup/styles.cljs b/src/status_im/ui/screens/wallet/onboarding/setup/styles.cljs index 510073c211..fed2111e36 100644 --- a/src/status_im/ui/screens/wallet/onboarding/setup/styles.cljs +++ b/src/status_im/ui/screens/wallet/onboarding/setup/styles.cljs @@ -40,4 +40,8 @@ :padding-vertical 8}) (def got-it-button-text - {:padding-horizontal 0}) \ No newline at end of file + {:padding-horizontal 0}) + +(def modal + {:flex 1 + :background-color colors/blue}) \ No newline at end of file diff --git a/src/status_im/ui/screens/wallet/onboarding/setup/views.cljs b/src/status_im/ui/screens/wallet/onboarding/setup/views.cljs index 7feca11b8c..49cc68da0a 100644 --- a/src/status_im/ui/screens/wallet/onboarding/setup/views.cljs +++ b/src/status_im/ui/screens/wallet/onboarding/setup/views.cljs @@ -6,12 +6,13 @@ [status-im.react-native.resources :as resources] [status-im.ui.components.react :as react] [status-im.ui.components.styles :as components.styles] - [status-im.ui.screens.wallet.components :as comp] + [status-im.ui.screens.wallet.components :as wallet.components] [status-im.ui.screens.wallet.onboarding.setup.styles :as styles] [status-im.ui.components.bottom-buttons.view :as bottom-buttons] [status-im.ui.components.button.view :as button] [status-im.utils.utils :as utils] - [status-im.ui.components.toolbar.actions :as actions])) + [status-im.ui.components.toolbar.actions :as actions] + [status-im.ui.components.status-bar.view :as status-bar])) (defn signing-word [word] [react/view styles/signing-word @@ -20,17 +21,19 @@ :number-of-lines 1} word]]) -(defn display-confirmation [] +(defn display-confirmation [modal?] (utils/show-question (i18n/label :t/wallet-set-up-confirm-title) (i18n/label :t/wallet-set-up-confirm-description) - #(re-frame/dispatch [:wallet-set-up-passed]))) + #(re-frame/dispatch [:wallet-set-up-passed modal?]))) -(views/defview screen [] +(views/defview onboarding-panel [modal?] (views/letsubs [{:keys [signing-phrase]} [:get-current-account]] - (let [signing-words (string/split signing-phrase #" ")] - [comp/simple-screen {:avoid-keyboard? true} - [comp/toolbar + (let [signing-words (string/split signing-phrase #" ") + container (if modal? react/view wallet.components/simple-screen) + container-opts (if modal? components.styles/flex {:avoid-keyboard? true})] + [container container-opts + [wallet.components/toolbar {} (actions/back-white #(re-frame/dispatch [:wallet-setup-navigate-back])) (i18n/label :t/wallet-set-up-title)] @@ -46,8 +49,16 @@ (i18n/label :t/wallet-set-up-signing-phrase)] [bottom-buttons/bottom-buttons styles/bottom-buttons nil - [button/button {:on-press display-confirmation + [button/button {:on-press (partial display-confirmation modal?) :text-style styles/got-it-button-text :accessibility-label :done-button} (i18n/label :t/got-it) - nil]]]]))) \ No newline at end of file + nil]]]]))) + +(views/defview screen [] + [onboarding-panel false]) + +(views/defview modal [] + [react/view styles/modal + [status-bar/status-bar {:type :modal-wallet}] + [onboarding-panel true]]) \ No newline at end of file diff --git a/src/status_im/ui/screens/wallet/send/events.cljs b/src/status_im/ui/screens/wallet/send/events.cljs index d5dc7e2a74..3edb6b53c4 100644 --- a/src/status_im/ui/screens/wallet/send/events.cljs +++ b/src/status_im/ui/screens/wallet/send/events.cljs @@ -194,20 +194,23 @@ ;;SEND TRANSACTION (= method constants/web3-send-transaction) - (let [{:keys [gas gasPrice]} args - transaction (prepare-transaction queued-transaction now) - sending-from-bot-or-dapp? (not (get-in db [:wallet :send-transaction :waiting-signal?])) - new-db (assoc-in db' [:wallet :transactions-unsigned id] transaction) - sending-db {:id id - :method method - :from-chat? (or - sending-from-bot-or-dapp? + (let [{:keys [gas gasPrice]} args + transaction (prepare-transaction queued-transaction now) + sending-from-dapp? (not (get-in db [:wallet :send-transaction :waiting-signal?])) + new-db (assoc-in db' [:wallet :transactions-unsigned id] transaction) + sender-account (:account/account db) + sending-db {:id id + :method method + :from-chat? (or sending-from-dapp? ;;TODO(goranjovic): figure out why we need to + ;; have from-chat? flag for dapp txs and get rid of this (get-in db [:wallet :send-transaction :from-chat?]))}] - (if sending-from-bot-or-dapp? - ;;SENDING FROM BOT (CHAT) OR DAPP + (if sending-from-dapp? + ;;SENDING FROM DAPP {:db (assoc-in new-db [:wallet :send-transaction] sending-db) ; we need to completely reset sending state here :dispatch-n [[:update-wallet] - [:navigate-to-modal :wallet-send-transaction-modal] + [:navigate-to-modal (if (:wallet-set-up-passed? sender-account) + :wallet-send-transaction-modal + :wallet-onboarding-setup-modal)] (when-not (seq gas) [:wallet/update-estimated-gas transaction]) (when-not (seq gasPrice) diff --git a/src/status_im/ui/screens/wallet/send/views.cljs b/src/status_im/ui/screens/wallet/send/views.cljs index 312419d5a2..64f85c250c 100644 --- a/src/status_im/ui/screens/wallet/send/views.cljs +++ b/src/status_im/ui/screens/wallet/send/views.cljs @@ -260,22 +260,20 @@ (defview send-transaction [] (letsubs [transaction [:wallet.send/transaction] - symbol [:wallet.send/symbol] advanced? [:wallet.send/advanced?] network [:get-current-account-network] scroll (atom nil)] [send-transaction-panel {:modal? false :transaction transaction :scroll scroll :advanced? advanced? - :symbol symbol :network network}])) + :network network}])) (defview send-transaction-modal [] (letsubs [transaction [:wallet.send/unsigned-transaction] - symbol [:wallet.send/symbol] advanced? [:wallet.send/advanced?] network [:get-current-account-network] scroll (atom nil)] (if transaction [send-transaction-panel {:modal? true :transaction transaction :scroll scroll :advanced? advanced? - symbol symbol :network network}] + :network network}] [react/view wallet.styles/wallet-modal-container [react/view components.styles/flex [status-bar/status-bar {:type :modal-wallet}]