From 6b4b9d99f4170539b43f7e4349ff2d3d9c0e5833 Mon Sep 17 00:00:00 2001 From: Jamie Caprani Date: Wed, 9 Aug 2023 14:45:48 +0200 Subject: [PATCH] chore: add basic flow for wallet development to begin --- .../navigation/bottom_nav_tab/view.cljs | 3 +- .../jump_to/components/bottom_tabs/view.cljs | 4 ++ .../jump_to/components/home_stack/view.cljs | 6 +- .../contexts/shell/jump_to/state.cljs | 3 + .../contexts/wallet/account/view.cljs | 15 +++++ .../contexts/wallet/collectible/view.cljs | 16 +++++ .../contexts/wallet/create_account/view.cljs | 16 +++++ src/status_im2/contexts/wallet/home/view.cljs | 38 ++++++++++++ .../contexts/wallet/saved_address/view.cljs | 15 +++++ .../contexts/wallet/saved_addresses/view.cljs | 18 ++++++ src/status_im2/contexts/wallet/send/view.cljs | 6 ++ src/status_im2/navigation/screens.cljs | 58 +++++++++++++------ 12 files changed, 179 insertions(+), 19 deletions(-) create mode 100644 src/status_im2/contexts/wallet/account/view.cljs create mode 100644 src/status_im2/contexts/wallet/collectible/view.cljs create mode 100644 src/status_im2/contexts/wallet/create_account/view.cljs create mode 100644 src/status_im2/contexts/wallet/home/view.cljs create mode 100644 src/status_im2/contexts/wallet/saved_address/view.cljs create mode 100644 src/status_im2/contexts/wallet/saved_addresses/view.cljs create mode 100644 src/status_im2/contexts/wallet/send/view.cljs diff --git a/src/quo2/components/navigation/bottom_nav_tab/view.cljs b/src/quo2/components/navigation/bottom_nav_tab/view.cljs index 1e96eae912..a5129c802d 100644 --- a/src/quo2/components/navigation/bottom_nav_tab/view.cljs +++ b/src/quo2/components/navigation/bottom_nav_tab/view.cljs @@ -31,7 +31,7 @@ " [{:keys [icon new-notifications? notification-indicator counter-label on-press pass-through? icon-color-anim accessibility-label test-ID - customization-color] + customization-color on-long-press] :or {customization-color :blue}}] (let [icon-animated-style (reanimated/apply-animations-to-style {:tint-color icon-color-anim} @@ -47,6 +47,7 @@ :border-radius 10})] [rn/touchable-without-feedback {:test-ID test-ID + :on-long-press on-long-press ;;NOTE - this is temporary while supporting old wallet :on-press on-press :on-press-in #(toggle-background-color background-color false pass-through?) :on-press-out #(toggle-background-color background-color true pass-through?) diff --git a/src/status_im2/contexts/shell/jump_to/components/bottom_tabs/view.cljs b/src/status_im2/contexts/shell/jump_to/components/bottom_tabs/view.cljs index 90d25ecc60..2a621f0b80 100644 --- a/src/status_im2/contexts/shell/jump_to/components/bottom_tabs/view.cljs +++ b/src/status_im2/contexts/shell/jump_to/components/bottom_tabs/view.cljs @@ -31,6 +31,10 @@ (assoc :test-ID stack-id :icon icon :icon-color-anim icon-color + ;NOTE temporary use of on long press while we support old wallet + :on-long-press #(when (= stack-id :wallet-stack) + (swap! state/load-new-wallet? not) + (animation/bottom-tab-on-press stack-id true)) :on-press #(animation/bottom-tab-on-press stack-id true) :accessibility-label (str (name stack-id) "-tab") :customization-color customization-color))])) diff --git a/src/status_im2/contexts/shell/jump_to/components/home_stack/view.cljs b/src/status_im2/contexts/shell/jump_to/components/home_stack/view.cljs index 43787fded3..e20209c67b 100644 --- a/src/status_im2/contexts/shell/jump_to/components/home_stack/view.cljs +++ b/src/status_im2/contexts/shell/jump_to/components/home_stack/view.cljs @@ -1,6 +1,7 @@ (ns status-im2.contexts.shell.jump-to.components.home-stack.view (:require [react-native.reanimated :as reanimated] [status-im.ui.screens.wallet.accounts.views :as wallet.accounts] + [status-im2.contexts.wallet.home.view :as wallet-new] [status-im2.contexts.chat.home.view :as chat] [status-im2.contexts.shell.jump-to.state :as state] [status-im2.contexts.shell.jump-to.utils :as utils] @@ -29,7 +30,10 @@ (case stack-id :communities-stack [:f> communities/home] :chats-stack [:f> chat/home] - :wallet-stack [wallet.accounts/accounts-overview-old] + ;NOTE temporary while we support old wallet + :wallet-stack (if @state/load-new-wallet? + [wallet-new/view] + [wallet.accounts/accounts-overview-old]) :browser-stack [browser.stack/browser-stack] [:<>])]) diff --git a/src/status_im2/contexts/shell/jump_to/state.cljs b/src/status_im2/contexts/shell/jump_to/state.cljs index 5c9fbbb56a..28cc9102a0 100644 --- a/src/status_im2/contexts/shell/jump_to/state.cljs +++ b/src/status_im2/contexts/shell/jump_to/state.cljs @@ -16,3 +16,6 @@ (def load-chats-stack? (reagent/atom false)) (def load-wallet-stack? (reagent/atom false)) (def load-browser-stack? (reagent/atom false)) + +;NOTE temporary while we support old wallet +(def load-new-wallet? (reagent/atom false)) diff --git a/src/status_im2/contexts/wallet/account/view.cljs b/src/status_im2/contexts/wallet/account/view.cljs new file mode 100644 index 0000000000..09f9d89d99 --- /dev/null +++ b/src/status_im2/contexts/wallet/account/view.cljs @@ -0,0 +1,15 @@ +(ns status-im2.contexts.wallet.account.view + (:require [react-native.core :as rn] + [quo2.core :as quo] + [utils.re-frame :as rf])) + +(defn view + [] + [rn/view + {:style {:flex 1 + :align-items :center + :justify-content :center}} + [quo/text {} "ACCOUNTS PAGE"] + [quo/divider-label] + [quo/button {:on-press #(rf/dispatch [:navigate-back])} + "NAVIGATE BACK"]]) diff --git a/src/status_im2/contexts/wallet/collectible/view.cljs b/src/status_im2/contexts/wallet/collectible/view.cljs new file mode 100644 index 0000000000..c75e9657a7 --- /dev/null +++ b/src/status_im2/contexts/wallet/collectible/view.cljs @@ -0,0 +1,16 @@ +(ns status-im2.contexts.wallet.collectible.view + (:require [react-native.core :as rn] + [quo2.core :as quo] + [re-frame.core :as rf])) + +(defn view + [] + [rn/view + {:style {:flex 1 + :align-items :center + :justify-content :center}} + + [quo/text {} "COLLECTIBLES PAGE"] + [quo/divider-label] + [quo/button {:on-press #(rf/dispatch [:navigate-back])} + "NAVIGATE BACK"]]) diff --git a/src/status_im2/contexts/wallet/create_account/view.cljs b/src/status_im2/contexts/wallet/create_account/view.cljs new file mode 100644 index 0000000000..588deeb7fd --- /dev/null +++ b/src/status_im2/contexts/wallet/create_account/view.cljs @@ -0,0 +1,16 @@ +(ns status-im2.contexts.wallet.create-account.view + (:require [react-native.core :as rn] + [quo2.core :as quo] + [re-frame.core :as rf])) + +(defn view + [] + [rn/view + {:style {:flex 1 + :align-items :center + :justify-content :center}} + + [quo/text {} "CREATE ACCOUNT"] + [quo/divider-label] + [quo/button {:on-press #(rf/dispatch [:navigate-back])} + "NAVIGATE BACK"]]) diff --git a/src/status_im2/contexts/wallet/home/view.cljs b/src/status_im2/contexts/wallet/home/view.cljs new file mode 100644 index 0000000000..48d0b14661 --- /dev/null +++ b/src/status_im2/contexts/wallet/home/view.cljs @@ -0,0 +1,38 @@ +(ns status-im2.contexts.wallet.home.view + (:require [react-native.core :as rn] + [quo2.core :as quo] + [react-native.safe-area :as safe-area] + [utils.re-frame :as rf])) + +(defn wallet-temporary-navigation + [] + [rn/view + {:style {:flex 1 + :align-items :center + :justify-content :center}} + [quo/text {} "TEMPORARY NAVIGATION"] + [quo/button {:on-press #(rf/dispatch [:navigate-to :wallet-accounts])} + "Navigate to Account"] + [quo/button {:on-press #(rf/dispatch [:navigate-to :wallet-create-account])} + "Create Account"] + [quo/button {:on-press #(rf/dispatch [:navigate-to :wallet-saved-addresses])} + "Saved Addresses"] + [quo/button {:on-press #(rf/dispatch [:navigate-to :wallet-collectibles])} + "Collectibles"]]) + +(defn view + [] + (let [top (safe-area/get-top)] + [rn/view + {:style {:margin-top top + :flex 1 + :align-items :center + :justify-content :center}} + [quo/button + {:icon-only? true + :type :grey + :on-press (fn [] (rf/dispatch [:show-bottom-sheet {:content wallet-temporary-navigation}])) + :container-style {:position :absolute + :top 20 + :right 20}} :i/options] + [quo/text {} "New Wallet Home"]])) diff --git a/src/status_im2/contexts/wallet/saved_address/view.cljs b/src/status_im2/contexts/wallet/saved_address/view.cljs new file mode 100644 index 0000000000..d97a7b7f26 --- /dev/null +++ b/src/status_im2/contexts/wallet/saved_address/view.cljs @@ -0,0 +1,15 @@ +(ns status-im2.contexts.wallet.saved-address.view + (:require [react-native.core :as rn] + [quo2.core :as quo] + [re-frame.core :as rf])) + +(defn view + [] + [rn/view + {:style {:flex 1 + :align-items :center + :justify-content :center}} + + [quo/text {} "SAVED ADDRESS"] + [quo/button {:on-press #(rf/dispatch [:navigate-back])} + "NAVIGATE BACK"]]) diff --git a/src/status_im2/contexts/wallet/saved_addresses/view.cljs b/src/status_im2/contexts/wallet/saved_addresses/view.cljs new file mode 100644 index 0000000000..cae35847d4 --- /dev/null +++ b/src/status_im2/contexts/wallet/saved_addresses/view.cljs @@ -0,0 +1,18 @@ +(ns status-im2.contexts.wallet.saved-addresses.view + (:require [react-native.core :as rn] + [quo2.core :as quo] + [re-frame.core :as rf])) + +(defn view + [] + [rn/view + {:style {:flex 1 + :align-items :center + :justify-content :center}} + + [quo/text {} "SAVED ADDRESSES"] + [quo/button {:on-press #(rf/dispatch [:navigate-to :wallet-saved-address])} + "NAVIGATE TO SAVED ADDRESS"] + [quo/divider-label] + [quo/button {:on-press #(rf/dispatch [:navigate-back])} + "NAVIGATE BACK"]]) diff --git a/src/status_im2/contexts/wallet/send/view.cljs b/src/status_im2/contexts/wallet/send/view.cljs new file mode 100644 index 0000000000..279e55aec7 --- /dev/null +++ b/src/status_im2/contexts/wallet/send/view.cljs @@ -0,0 +1,6 @@ +(ns status-im2.contexts.wallet.send.view + (:require [react-native.core :as rn])) + +(defn view + [] + [rn/view]) diff --git a/src/status_im2/navigation/screens.cljs b/src/status_im2/navigation/screens.cljs index 20d6d7d0ab..ecc0875be3 100644 --- a/src/status_im2/navigation/screens.cljs +++ b/src/status_im2/navigation/screens.cljs @@ -1,12 +1,14 @@ (ns status-im2.navigation.screens (:require [status-im2.config :as config] - [status-im2.contexts.shell.activity-center.view :as activity-center] [status-im2.contexts.add-new-contact.views :as add-new-contact] + [status-im2.contexts.chat.group-details.view :as group-details] [status-im2.contexts.chat.lightbox.view :as lightbox] [status-im2.contexts.chat.messages.view :as chat] + [status-im2.contexts.chat.new-chat.view :as new-chat] [status-im2.contexts.chat.photo-selector.view :as photo-selector] [status-im2.contexts.chat.camera.view :as camera-screen] + [status-im2.contexts.communities.actions.request-to-join.view :as join-menu] [status-im2.contexts.communities.discover.view :as communities.discover] [status-im2.contexts.communities.overview.view :as communities.overview] [status-im2.contexts.onboarding.intro.view :as intro] @@ -20,23 +22,27 @@ [status-im2.contexts.onboarding.sign-in.view :as sign-in] [status-im2.contexts.onboarding.generating-keys.view :as generating-keys] [status-im2.contexts.onboarding.enter-seed-phrase.view :as enter-seed-phrase] - [status-im2.contexts.profile.profiles.view :as profiles] - [status-im2.contexts.quo-preview.main :as quo.preview] - [status-im2.contexts.shell.jump-to.view :as shell] - [status-im2.contexts.syncing.scan-sync-code-page.view :as scan-sync-code-page] - [status-im2.contexts.syncing.syncing-devices-list.view :as settings-syncing] - [status-im2.contexts.syncing.how-to-pair.view :as how-to-pair] - [status-im2.contexts.syncing.find-sync-code.view :as find-sync-code] - [status-im2.navigation.options :as options] - [status-im2.contexts.chat.group-details.view :as group-details] - [status-im.ui.screens.screens :as old-screens] - [status-im2.contexts.communities.actions.request-to-join.view :as join-menu] - [status-im2.contexts.syncing.setup-syncing.view :as settings-setup-syncing] - [status-im2.contexts.shell.share.view :as share] [status-im2.contexts.onboarding.syncing.results.view :as syncing-results] [status-im2.contexts.onboarding.syncing.progress.view :as syncing-devices] - [status-im2.contexts.chat.new-chat.view :as new-chat] - [status-im2.navigation.transitions :as transitions])) + [status-im2.navigation.transitions :as transitions] + [status-im2.contexts.profile.profiles.view :as profiles] + [status-im2.contexts.quo-preview.main :as quo.preview] + [status-im2.contexts.shell.activity-center.view :as activity-center] + [status-im2.contexts.shell.jump-to.view :as shell] + [status-im2.contexts.shell.share.view :as share] + [status-im2.contexts.syncing.how-to-pair.view :as how-to-pair] + [status-im2.contexts.syncing.find-sync-code.view :as find-sync-code] + [status-im2.contexts.syncing.scan-sync-code-page.view :as scan-sync-code-page] + [status-im2.contexts.syncing.setup-syncing.view :as settings-setup-syncing] + [status-im2.contexts.syncing.syncing-devices-list.view :as settings-syncing] + [status-im2.contexts.wallet.account.view :as wallet-accounts] + [status-im2.contexts.wallet.collectible.view :as wallet-collectibles] + [status-im2.contexts.wallet.create-account.view :as wallet-create-account] + [status-im2.contexts.wallet.saved-address.view :as wallet-saved-address] + [status-im2.contexts.wallet.saved-addresses.view :as wallet-saved-addresses] + [status-im2.contexts.wallet.send.view :as wallet-send] + [status-im.ui.screens.screens :as old-screens] + [status-im2.navigation.options :as options])) (defn screens [] @@ -232,7 +238,25 @@ :options {:theme :dark :layout options/onboarding-transparent-layout :animations transitions/push-animations-for-transparent-background} - :component welcome/view}] + :component welcome/view} + + {:name :wallet-accounts + :component wallet-accounts/view} + + {:name :wallet-collectibles + :component wallet-collectibles/view} + + {:name :wallet-create-account + :component wallet-create-account/view} + + {:name :wallet-saved-address + :component wallet-saved-address/view} + + {:name :wallet-saved-addresses + :component wallet-saved-addresses/view} + + {:name :wallet-send + :component wallet-send/view}] (when config/quo-preview-enabled? quo.preview/screens)