mirror of
https://github.com/status-im/status-mobile.git
synced 2025-01-28 01:16:50 +00:00
show onboarding for transaction from chat [#4456]
This commit is contained in:
parent
68eb36f7b1
commit
83afbd515a
@ -12,11 +12,14 @@
|
|||||||
:gas (ethereum/estimate-gas :ETH)
|
:gas (ethereum/estimate-gas :ETH)
|
||||||
:from-chat? true)))
|
:from-chat? true)))
|
||||||
|
|
||||||
(defn send-shortcut-fx [db contact params]
|
(defn send-shortcut-fx [{:account/keys [account] :as db} contact params]
|
||||||
(merge {:db (-> db
|
(merge {:db (-> db
|
||||||
(send.events/set-and-validate-amount-db (:amount params) :ETH 18)
|
(send.events/set-and-validate-amount-db (:amount params) :ETH 18)
|
||||||
(choose-recipient.events/fill-request-details (transaction-details contact))
|
(choose-recipient.events/fill-request-details (transaction-details contact))
|
||||||
(navigation/navigate-to :wallet-send-transaction-chat))}
|
(navigation/navigate-to
|
||||||
|
(if (:wallet-set-up-passed? account)
|
||||||
|
:wallet-send-transaction-chat
|
||||||
|
:wallet-onboarding-setup)))}
|
||||||
(send.events/update-gas-price db false)))
|
(send.events/update-gas-price db false)))
|
||||||
|
|
||||||
(def shortcuts
|
(def shortcuts
|
||||||
|
@ -18,7 +18,8 @@
|
|||||||
status-im.ui.screens.accounts.create.navigation
|
status-im.ui.screens.accounts.create.navigation
|
||||||
[status-im.chat.models :as chat.models]
|
[status-im.chat.models :as chat.models]
|
||||||
[status-im.ui.screens.accounts.utils :as accounts.utils]
|
[status-im.ui.screens.accounts.utils :as accounts.utils]
|
||||||
[status-im.data-store.accounts :as accounts-store]))
|
[status-im.data-store.accounts :as accounts-store]
|
||||||
|
[status-im.ui.screens.navigation :as navigation]))
|
||||||
|
|
||||||
;;;; COFX
|
;;;; COFX
|
||||||
|
|
||||||
@ -161,7 +162,17 @@
|
|||||||
(fn [cofx [_ dev-mode]]
|
(fn [cofx [_ dev-mode]]
|
||||||
(accounts.utils/account-update {:dev-mode? dev-mode} cofx)))
|
(accounts.utils/account-update {:dev-mode? dev-mode} cofx)))
|
||||||
|
|
||||||
|
(defn wallet-set-up-passed [db cofx]
|
||||||
|
(let [transaction (seq (get-in db [:wallet :send-transaction]))]
|
||||||
|
(merge
|
||||||
|
{:db (navigation/navigate-back db)}
|
||||||
|
(when transaction
|
||||||
|
{:dispatch [:navigate-to :wallet-send-transaction-chat]}))))
|
||||||
|
|
||||||
(handlers/register-handler-fx
|
(handlers/register-handler-fx
|
||||||
:wallet-set-up-passed
|
:wallet-set-up-passed
|
||||||
(fn [cofx]
|
(fn [{:keys [db] :as cofx}]
|
||||||
(accounts.utils/account-update {:wallet-set-up-passed? true} cofx)))
|
(handlers-macro/merge-fx
|
||||||
|
cofx
|
||||||
|
(wallet-set-up-passed db)
|
||||||
|
(accounts.utils/account-update {:wallet-set-up-passed? true}))))
|
@ -90,10 +90,7 @@
|
|||||||
(fn [cofx [_ view-id]]
|
(fn [cofx [_ view-id]]
|
||||||
(replace-view view-id cofx)))
|
(replace-view view-id cofx)))
|
||||||
|
|
||||||
(handlers/register-handler-db
|
(defn navigate-back [{:keys [navigation-stack view-id modal] :as db}]
|
||||||
:navigate-back
|
|
||||||
(re-frame/enrich -preload-data!)
|
|
||||||
(fn [{:keys [navigation-stack view-id modal] :as db} _]
|
|
||||||
(cond
|
(cond
|
||||||
modal (assoc db :modal nil
|
modal (assoc db :modal nil
|
||||||
:was-modal? true)
|
:was-modal? true)
|
||||||
@ -106,7 +103,13 @@
|
|||||||
(-> db
|
(-> db
|
||||||
(assoc :view-id previous-view-id)
|
(assoc :view-id previous-view-id)
|
||||||
(assoc :navigation-stack navigation-stack'))
|
(assoc :navigation-stack navigation-stack'))
|
||||||
(assoc db :view-id first-in-stack))))))
|
(assoc db :view-id first-in-stack)))))
|
||||||
|
|
||||||
|
(handlers/register-handler-db
|
||||||
|
:navigate-back
|
||||||
|
(re-frame/enrich -preload-data!)
|
||||||
|
(fn [db _]
|
||||||
|
(navigate-back db)))
|
||||||
|
|
||||||
(handlers/register-handler-fx
|
(handlers/register-handler-fx
|
||||||
:navigate-to-clean
|
:navigate-to-clean
|
||||||
|
@ -11,7 +11,8 @@
|
|||||||
[taoensso.timbre :as log]
|
[taoensso.timbre :as log]
|
||||||
status-im.ui.screens.wallet.request.events
|
status-im.ui.screens.wallet.request.events
|
||||||
[status-im.utils.money :as money]
|
[status-im.utils.money :as money]
|
||||||
[status-im.constants :as constants]))
|
[status-im.constants :as constants]
|
||||||
|
[status-im.ui.screens.navigation :as navigation]))
|
||||||
|
|
||||||
(defn get-balance [{:keys [web3 account-id on-success on-error]}]
|
(defn get-balance [{:keys [web3 account-id on-success on-error]}]
|
||||||
(if (and web3 account-id)
|
(if (and web3 account-id)
|
||||||
@ -258,3 +259,10 @@
|
|||||||
:wallet/show-error
|
:wallet/show-error
|
||||||
(fn []
|
(fn []
|
||||||
{:show-error (i18n/label :t/wallet-error)}))
|
{:show-error (i18n/label :t/wallet-error)}))
|
||||||
|
|
||||||
|
(handlers/register-handler-fx
|
||||||
|
:wallet-setup-navigate-back
|
||||||
|
(fn [{:keys [db]}]
|
||||||
|
{:db (-> db
|
||||||
|
(assoc-in [:wallet :send-transaction] {})
|
||||||
|
(navigation/navigate-back))}))
|
@ -10,7 +10,8 @@
|
|||||||
[status-im.ui.screens.wallet.onboarding.setup.styles :as styles]
|
[status-im.ui.screens.wallet.onboarding.setup.styles :as styles]
|
||||||
[status-im.ui.components.bottom-buttons.view :as bottom-buttons]
|
[status-im.ui.components.bottom-buttons.view :as bottom-buttons]
|
||||||
[status-im.ui.components.button.view :as button]
|
[status-im.ui.components.button.view :as button]
|
||||||
[status-im.utils.utils :as utils]))
|
[status-im.utils.utils :as utils]
|
||||||
|
[status-im.ui.components.toolbar.actions :as actions]))
|
||||||
|
|
||||||
(defn signing-word [word]
|
(defn signing-word [word]
|
||||||
[react/view styles/signing-word
|
[react/view styles/signing-word
|
||||||
@ -23,14 +24,16 @@
|
|||||||
(utils/show-question
|
(utils/show-question
|
||||||
(i18n/label :t/wallet-set-up-confirm-title)
|
(i18n/label :t/wallet-set-up-confirm-title)
|
||||||
(i18n/label :t/wallet-set-up-confirm-description)
|
(i18n/label :t/wallet-set-up-confirm-description)
|
||||||
#(do (re-frame/dispatch [:wallet-set-up-passed])
|
#(re-frame/dispatch [:wallet-set-up-passed])))
|
||||||
(re-frame/dispatch [:navigate-back]))))
|
|
||||||
|
|
||||||
(views/defview screen []
|
(views/defview screen []
|
||||||
(views/letsubs [{:keys [signing-phrase]} [:get-current-account]]
|
(views/letsubs [{:keys [signing-phrase]} [:get-current-account]]
|
||||||
(let [signing-words (string/split signing-phrase #" ")]
|
(let [signing-words (string/split signing-phrase #" ")]
|
||||||
[comp/simple-screen {:avoid-keyboard? true}
|
[comp/simple-screen {:avoid-keyboard? true}
|
||||||
[comp/toolbar (i18n/label :t/wallet-set-up-title)]
|
[comp/toolbar
|
||||||
|
{}
|
||||||
|
(actions/back-white #(re-frame/dispatch [:wallet-setup-navigate-back]))
|
||||||
|
(i18n/label :t/wallet-set-up-title)]
|
||||||
[react/view components.styles/flex
|
[react/view components.styles/flex
|
||||||
[react/view {:style styles/setup-image-container}
|
[react/view {:style styles/setup-image-container}
|
||||||
[react/image {:source (:wallet-setup resources/ui)
|
[react/image {:source (:wallet-setup resources/ui)
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
RERUN_ERRORS = [
|
RERUN_ERRORS = [
|
||||||
|
"can't receive further commands",
|
||||||
'Original error: Error: ESOCKETTIMEDOUT',
|
'Original error: Error: ESOCKETTIMEDOUT',
|
||||||
"The server didn't respond in time.",
|
"The server didn't respond in time.",
|
||||||
'An unknown server-side error occurred while processing the command.',
|
'An unknown server-side error occurred while processing the command.',
|
||||||
|
@ -27,6 +27,10 @@ class TestChatManagementMultiple(MultipleDeviceTestCase):
|
|||||||
|
|
||||||
device_1_home_view = device_1_sign_in_view.get_home_view()
|
device_1_home_view = device_1_sign_in_view.get_home_view()
|
||||||
device_2_home_view = device_2_sign_in_view.get_home_view()
|
device_2_home_view = device_2_sign_in_view.get_home_view()
|
||||||
|
for home in device_1_home_view, device_2_home_view:
|
||||||
|
wallet = home.wallet_button.click()
|
||||||
|
wallet.set_up_wallet()
|
||||||
|
wallet.home_button.click()
|
||||||
|
|
||||||
# Device 1: Start new 1-1 chat
|
# Device 1: Start new 1-1 chat
|
||||||
device_1_home_view.add_contact(self.senders['h_user']['public_key'])
|
device_1_home_view.add_contact(self.senders['h_user']['public_key'])
|
||||||
|
@ -51,6 +51,11 @@ class TestTransaction(SingleDeviceTestCase):
|
|||||||
chat_view.commands_button.click()
|
chat_view.commands_button.click()
|
||||||
chat_view.send_command.click()
|
chat_view.send_command.click()
|
||||||
chat_view.send_as_keyevent(transaction_amount)
|
chat_view.send_as_keyevent(transaction_amount)
|
||||||
|
wallet_view = chat_view.get_wallet_view()
|
||||||
|
chat_view.send_message_button.click_until_presence_of_element(wallet_view.sign_in_phrase)
|
||||||
|
wallet_view.done_button.click()
|
||||||
|
wallet_view.yes_button.click()
|
||||||
|
|
||||||
send_transaction_view = chat_view.get_send_transaction_view()
|
send_transaction_view = chat_view.get_send_transaction_view()
|
||||||
chat_view.send_message_button.click_until_presence_of_element(send_transaction_view.sign_transaction_button)
|
chat_view.send_message_button.click_until_presence_of_element(send_transaction_view.sign_transaction_button)
|
||||||
send_transaction_view.sign_transaction_button.click_until_presence_of_element(
|
send_transaction_view.sign_transaction_button.click_until_presence_of_element(
|
||||||
@ -276,11 +281,10 @@ class TestTransactions(MultipleDeviceTestCase):
|
|||||||
device_1_chat.send_as_keyevent(amount)
|
device_1_chat.send_as_keyevent(amount)
|
||||||
device_1_chat.send_message_button.click()
|
device_1_chat.send_message_button.click()
|
||||||
request_button = device_2_chat.element_by_text_part('Requesting %s ETH' % amount, 'button')
|
request_button = device_2_chat.element_by_text_part('Requesting %s ETH' % amount, 'button')
|
||||||
device_2_chat.send_eth_to_request(request_button, sender['password'])
|
device_2_chat.send_eth_to_request(request_button, sender['password'], wallet_set_up=True)
|
||||||
self.network_api.find_transaction_by_unique_amount(recipient['address'], amount)
|
self.network_api.find_transaction_by_unique_amount(recipient['address'], amount)
|
||||||
device_2_chat.back_button.click()
|
device_2_chat.back_button.click()
|
||||||
device_2_wallet = device_2_home.wallet_button.click()
|
device_2_wallet = device_2_home.wallet_button.click()
|
||||||
device_2_wallet.set_up_wallet()
|
|
||||||
transactions_view = device_2_wallet.transactions_button.click()
|
transactions_view = device_2_wallet.transactions_button.click()
|
||||||
transactions_view.transactions_table.find_transaction(amount=amount)
|
transactions_view.transactions_table.find_transaction(amount=amount)
|
||||||
|
|
||||||
@ -317,5 +321,5 @@ class TestTransactions(MultipleDeviceTestCase):
|
|||||||
one_to_one_chat_device_2.wait_for_visibility_of_element(120)
|
one_to_one_chat_device_2.wait_for_visibility_of_element(120)
|
||||||
one_to_one_chat_device_2.click()
|
one_to_one_chat_device_2.click()
|
||||||
request_button = device_2_chat.element_by_text_part('Requesting %s ETH' % amount, 'button')
|
request_button = device_2_chat.element_by_text_part('Requesting %s ETH' % amount, 'button')
|
||||||
device_2_chat.send_eth_to_request(request_button, sender['password'])
|
device_2_chat.send_eth_to_request(request_button, sender['password'], wallet_set_up=True)
|
||||||
self.network_api.find_transaction_by_unique_amount(recipient['address'], amount)
|
self.network_api.find_transaction_by_unique_amount(recipient['address'], amount)
|
||||||
|
@ -278,6 +278,10 @@ class BaseView(object):
|
|||||||
from views.profile_view import ProfileView
|
from views.profile_view import ProfileView
|
||||||
return ProfileView(self.driver)
|
return ProfileView(self.driver)
|
||||||
|
|
||||||
|
def get_wallet_view(self):
|
||||||
|
from views.wallet_view import WalletView
|
||||||
|
return WalletView(self.driver)
|
||||||
|
|
||||||
def get_unique_amount(self):
|
def get_unique_amount(self):
|
||||||
return '0.0%s' % datetime.now().strftime('%-m%-d%-H%-M%-S').strip('0')
|
return '0.0%s' % datetime.now().strftime('%-m%-d%-H%-M%-S').strip('0')
|
||||||
|
|
||||||
|
@ -259,10 +259,16 @@ class ChatView(BaseView):
|
|||||||
errors.append("Message '%s' was received but username is '%s' instead of %s" %
|
errors.append("Message '%s' was received but username is '%s' instead of %s" %
|
||||||
(message, element.text, username))
|
(message, element.text, username))
|
||||||
|
|
||||||
def send_eth_to_request(self, request, sender_password):
|
def send_eth_to_request(self, request, sender_password, wallet_set_up=False):
|
||||||
gas_popup = self.element_by_text_part('Specify amount')
|
gas_popup = self.element_by_text_part('Specify amount')
|
||||||
request.click_until_presence_of_element(gas_popup)
|
request.click_until_presence_of_element(gas_popup)
|
||||||
send_transaction = self.get_send_transaction_view()
|
send_transaction = self.get_send_transaction_view()
|
||||||
|
if wallet_set_up:
|
||||||
|
wallet_view = self.get_wallet_view()
|
||||||
|
self.send_message_button.click_until_presence_of_element(wallet_view.sign_in_phrase)
|
||||||
|
wallet_view.done_button.click()
|
||||||
|
wallet_view.yes_button.click()
|
||||||
|
else:
|
||||||
self.send_message_button.click_until_presence_of_element(send_transaction.sign_transaction_button)
|
self.send_message_button.click_until_presence_of_element(send_transaction.sign_transaction_button)
|
||||||
send_transaction.sign_transaction(sender_password)
|
send_transaction.sign_transaction(sender_password)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user