Skip to content

Commit

Permalink
Merge branch 'develop' into jc/recent-transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
J-Son89 committed May 8, 2024
2 parents 9712190 + 497c95f commit d13af5b
Show file tree
Hide file tree
Showing 17 changed files with 120 additions and 83 deletions.
9 changes: 8 additions & 1 deletion src/quo/components/buttons/wallet_ctas/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
:color (colors/theme-colors colors/neutral-50 colors/neutral-40 theme)}} text]])

(defn view
[{:keys [buy-action send-action receive-action bridge-action container-style]}]
[{:keys [buy-action send-action receive-action bridge-action swap-action container-style]}]
(let [theme (quo.theme/use-theme)]
[rn/view {:style container-style}
[rn/view {:style style/inner-container}
Expand All @@ -46,6 +46,13 @@
:on-press receive-action
:theme theme
:accessibility-label :receive}]
(when swap-action
[action-button
{:icon :i/swap
:text (i18n/label :t/swap)
:on-press swap-action
:theme theme
:accessibility-label :swap}])
[action-button
{:icon :i/bridge
:text (i18n/label :t/bridge)
Expand Down
11 changes: 6 additions & 5 deletions src/quo/components/community/channel_actions/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
[rn/view {:style (assoc container-style :flex-direction :row)}
(map-indexed
(fn [index action]
^{:key index}
[:<>
[channel-action/view action]
(when (not= action (last actions))
[rn/view {:width 16}])])
(when action
^{:key index}
[:<>
[channel-action/view action]
(when (not= action (last actions))
[rn/view {:style {:width 16}}])]))
actions)])
17 changes: 6 additions & 11 deletions src/status_im/common/home/actions/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -365,23 +365,21 @@
:sub-label nil
:chevron? false}))

;; TODO(OmarBasem): to be implemented.
(defn add-members-entry
[]
[chat-id]
(entry {:icon :i/add-user
:label (i18n/label :t/add-members)
:on-press #(js/alert "TODO: to be implemented")
:on-press #(rf/dispatch [:open-modal :group-add-manage-members chat-id])
:danger? false
:accessibility-label :add-members
:sub-label nil
:chevron? false}))

;; TODO(OmarBasem): to be implemented.
(defn manage-members-entry
[]
[chat-id]
(entry {:icon :i/add-user
:label (i18n/label :t/manage-members)
:on-press #(js/alert "TODO: to be implemented")
:on-press #(rf/dispatch [:open-modal :group-add-manage-members chat-id])
:danger? false
:accessibility-label :manage-members
:sub-label nil
Expand Down Expand Up @@ -435,11 +433,8 @@
admin? (get admins current-pub-key)]
[(group-details-entry chat-id)
(when inside-chat?
(if admin?
(when config/show-not-implemented-features?
(manage-members-entry))
(when config/show-not-implemented-features?
(add-members-entry))))
(when admin?
(manage-members-entry chat-id)))
(when (and admin? inside-chat?)
(when config/show-not-implemented-features?
(edit-group-entry)))
Expand Down
40 changes: 21 additions & 19 deletions src/status_im/contexts/chat/group_details/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[quo.foundations.colors :as colors]
[quo.theme]
[react-native.core :as rn]
[react-native.gesture :as gesture]
[react-native.safe-area :as safe-area]
[reagent.core :as reagent]
[status-im.common.contact-list-item.view :as contact-list-item]
Expand Down Expand Up @@ -43,12 +44,11 @@

(defn add-manage-members
[]
(let [selected-participants (rf/sub [:group-chat/selected-participants])
deselected-members (rf/sub [:group-chat/deselected-members])
chat-id (rf/sub [:get-screen-params :group-details])
{:keys [admins] :as group} (rf/sub [:chats/chat-by-id chat-id])
theme (quo.theme/use-theme)
admin? (get admins (rf/sub [:multiaccount/public-key]))]
(let [selected-participants (rf/sub [:group-chat/selected-participants])
deselected-members (rf/sub [:group-chat/deselected-members])
chat-id (rf/sub [:get-screen-params :group-add-manage-members])
group (rf/sub [:chats/chat-by-id chat-id])
theme (quo.theme/use-theme)]
[rn/view {:flex 1 :margin-top 20}
[rn/touchable-opacity
{:on-press #(rf/dispatch [:navigate-back])
Expand All @@ -59,8 +59,8 @@
{:size :heading-1
:weight :semi-bold
:style {:margin-left 20}}
(i18n/label (if admin? :t/manage-members :t/add-members))]
[rn/section-list
(i18n/label :t/manage-members)]
[gesture/section-list
{:key-fn :title
:sticky-section-headers-enabled false
:sections (rf/sub [:contacts/grouped-by-first-letter])
Expand Down Expand Up @@ -139,7 +139,8 @@
:customization-color color}}]
[quo/channel-actions
{:container-style style/actions-view
:actions [{:accessibility-label :pinned-messages
:actions [{:big? (not admin?)
:accessibility-label :pinned-messages
:label (i18n/label :t/pinned-messages)
:customization-color color
:icon :i/pin
Expand All @@ -155,16 +156,17 @@
:on-press #(rf/dispatch [:chat.ui/mute chat-id (not muted)
(when-not muted
constants/mute-till-unmuted)])}
{:accessibility-label :manage-members
:customization-color color
:icon :i/add-user
:label (i18n/label (if admin? :t/manage-members :t/add-members))
:counter-value (count contacts)
:on-press (fn []
(rf/dispatch [:group/clear-added-participants])
(rf/dispatch [:group/clear-removed-members])
(rf/dispatch [:open-modal :group-add-manage-members
chat-id]))}]}]
(when admin?
{:accessibility-label :manage-members
:customization-color color
:icon :i/add-user
:label (i18n/label :t/manage-members)
:counter-value (count contacts)
:on-press (fn []
(rf/dispatch [:group/clear-added-participants])
(rf/dispatch [:group/clear-removed-members])
(rf/dispatch [:open-modal :group-add-manage-members
chat-id]))})]}]
[rn/section-list
{:key-fn :title
:sticky-section-headers-enabled false
Expand Down
3 changes: 2 additions & 1 deletion src/status_im/contexts/preview/quo/buttons/wallet_ctas.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@
:buy-action #(js/alert "Buy button pressed")
:send-action #(js/alert "Send button pressed")
:receive-action #(js/alert "Receive button pressed")
:bridge-action #(js/alert "Bridge button pressed")}]])
:bridge-action #(js/alert "Bridge button pressed")
:swap-action #(js/alert "Swap button pressed")}]])
15 changes: 10 additions & 5 deletions src/status_im/contexts/wallet/account/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,30 @@
{:type :wallet-networks
:on-press #(rf/dispatch [:wallet/close-account-page])}]
[quo/account-overview
{:container-style style/account-overview
:current-value formatted-balance
{:current-value formatted-balance
:account-name name
:account (if watch-only? :watched-address :default)
:customization-color color}]
(when (ff/enabled? ::ff/wallet.graph) [quo/wallet-graph {:time-frame :empty}])
[quo/wallet-graph {:time-frame :empty}]
(when (not watch-only?)
[quo/wallet-ctas
{:container-style style/cta-buttons
:send-action (fn []
(rf/dispatch [:wallet/clean-send-data])
(rf/dispatch [:wallet/wizard-navigate-forward
{:start-flow? true
:flow-id :wallet-flow}]))
:flow-id :wallet-send-flow}]))
:receive-action #(rf/dispatch [:open-modal :screen/wallet.share-address
{:status :receive}])
:buy-action #(rf/dispatch [:show-bottom-sheet
{:content buy-token/view}])
:bridge-action #(rf/dispatch [:wallet/start-bridge])}])
:bridge-action (fn []
(rf/dispatch [:wallet/clean-send-data])
(rf/dispatch [:wallet/wizard-navigate-forward
{:start-flow? true
:flow-id :wallet-bridge-flow}]))
:swap-action (when (ff/enabled? ::ff/wallet.swap)
#(rf/dispatch [:wallet/start-swap]))}])
[quo/tabs
{:style style/tabs
:size 32
Expand Down
11 changes: 11 additions & 0 deletions src/status_im/contexts/wallet/bridge/flow_config.cljs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
(ns status-im.contexts.wallet.bridge.flow-config)

(def steps
[{:screen-id :screen/wallet.bridge-select-asset
:skip-step? (fn [db] (some? (get-in db [:wallet :ui :send :token])))}
{:screen-id :screen/wallet.bridge-to
:skip-step? (fn [db] (some? (get-in db [:wallet :ui :send :bridge-to-chain-id])))}
{:screen-id :screen/wallet.bridge-input-amount
:skip-step? (fn [db] (some? (get-in db [:wallet :ui :send :amount])))}
{:screen-id :screen/wallet.transaction-confirmation}
{:screen-id :screen/wallet.transaction-progress}])
8 changes: 5 additions & 3 deletions src/status_im/contexts/wallet/common/token_value/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@
:on-press #(rf/dispatch [:open-modal :screen/wallet.share-address {:status :receive}])})

(defn- action-bridge
[]
[token-data]
{:icon :i/bridge
:accessibility-label :bridge
:label (i18n/label :t/bridge)
:on-press #(js/alert "to be implemented")})
:on-press (fn []
(rf/dispatch [:hide-bottom-sheet])
(rf/dispatch [:wallet/bridge-select-token {:token token-data}]))})

(defn- action-manage-tokens
[watch-only?]
Expand Down Expand Up @@ -66,7 +68,7 @@
(not watch-only?) (concat [(action-buy)
(action-send token-data)
(action-receive)
(action-bridge)]))]]))
(action-bridge token-data)]))]]))

(defn view
[item _ _ {:keys [watch-only?]}]
Expand Down
22 changes: 0 additions & 22 deletions src/status_im/contexts/wallet/common/wizard.cljs

This file was deleted.

6 changes: 4 additions & 2 deletions src/status_im/contexts/wallet/common/wizard/events.cljs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
(ns status-im.contexts.wallet.common.wizard.events
(:require [status-im.contexts.wallet.send.flow-config :as wallet-flow]
(:require [status-im.contexts.wallet.bridge.flow-config :as wallet-bridge-flow]
[status-im.contexts.wallet.send.flow-config :as wallet-send-flow]
[utils.re-frame :as rf]))

(defn- wizard-find-next-screen
[db flow-id current-screen]
(let [flow-config (case flow-id
:wallet-flow wallet-flow/steps
:wallet-send-flow wallet-send-flow/steps
:wallet-bridge-flow wallet-bridge-flow/steps
nil)]
(first (filter (fn [{:keys [skip-step? screen-id]}]
(and (not= screen-id current-screen)
Expand Down
14 changes: 11 additions & 3 deletions src/status_im/contexts/wallet/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,13 @@
(let [to-address (get-in db [:wallet :current-viewing-account-address])]
{:db (-> db
(assoc-in [:wallet :ui :send :token] token)
(assoc-in [:wallet :ui :send :to-address] to-address))
:fx [[:dispatch [:navigate-to-within-stack [:screen/wallet.bridge-to stack-id]]]]})))
(assoc-in [:wallet :ui :send :to-address] to-address)
(assoc-in [:wallet :ui :send :tx-type] :bridge))
:fx [[:dispatch
[:wallet/wizard-navigate-forward
{:current-screen stack-id
:start-flow? true
:flow-id :wallet-bridge-flow}]]]})))

(rf/reg-event-fx :wallet/start-bridge
(fn [{:keys [db]}]
Expand All @@ -259,7 +264,10 @@
(rf/reg-event-fx :wallet/select-bridge-network
(fn [{:keys [db]} [{:keys [network-chain-id stack-id]}]]
{:db (assoc-in db [:wallet :ui :send :bridge-to-chain-id] network-chain-id)
:fx [[:dispatch [:navigate-to-within-stack [:screen/wallet.bridge-input-amount stack-id]]]]}))
:fx [[:dispatch
[:wallet/wizard-navigate-forward
{:current-screen stack-id
:flow-id :wallet-bridge-flow}]]]}))

(rf/reg-event-fx
:wallet/get-ethereum-chains
Expand Down
10 changes: 5 additions & 5 deletions src/status_im/contexts/wallet/send/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
[:wallet/wizard-navigate-forward
{:current-screen stack-id
:start-flow? start-flow?
:flow-id :wallet-flow}]]]})))
:flow-id :wallet-send-flow}]]]})))

(rf/reg-event-fx
:wallet/update-receiver-networks
Expand Down Expand Up @@ -174,7 +174,7 @@
[:wallet/wizard-navigate-forward
{:current-screen stack-id
:start-flow? start-flow?
:flow-id :wallet-flow}]]]}))
:flow-id :wallet-send-flow}]]]}))

(rf/reg-event-fx
:wallet/edit-token-to-send
Expand Down Expand Up @@ -236,7 +236,7 @@
[:wallet/wizard-navigate-forward
{:current-screen stack-id
:start-flow? start-flow?
:flow-id :wallet-flow}]]]}))
:flow-id :wallet-send-flow}]]]}))

(rf/reg-event-fx :wallet/disable-from-networks
(fn [{:keys [db]} [chain-ids]]
Expand Down Expand Up @@ -339,7 +339,7 @@
:fx [[:dispatch
[:wallet/wizard-navigate-forward
{:current-screen :screen/wallet.transaction-confirmation
:flow-id :wallet-flow}]]]})))
:flow-id :wallet-send-flow}]]]})))

(rf/reg-event-fx :wallet/close-transaction-progress-page
(fn [_]
Expand Down Expand Up @@ -509,4 +509,4 @@
[:wallet/wizard-navigate-forward
{:current-screen stack-id
:start-flow? start-flow?
:flow-id :wallet-flow}]]]}))
:flow-id :wallet-send-flow}]]]}))
10 changes: 10 additions & 0 deletions src/status_im/contexts/wallet/swap/events.cljs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
(ns status-im.contexts.wallet.swap.events
(:require [re-frame.core :as rf]))

(rf/reg-event-fx :wallet/start-swap
(fn [{:keys [_db]}]
{:fx [[:dispatch
[:toasts/upsert
{:id :swap-error
:type :negative
:text "Swap is under construction"}]]]}))
1 change: 1 addition & 0 deletions src/status_im/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
status-im.contexts.wallet.events
status-im.contexts.wallet.send.events
status-im.contexts.wallet.signals
status-im.contexts.wallet.swap.events
[status-im.db :as db]
status-im.navigation.effects
status-im.navigation.events
Expand Down
1 change: 1 addition & 0 deletions src/status_im/feature_flags.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
::wallet.graph (enabled-in-env? :FLAG_GRAPH_ENABLED)
::wallet.import-private-key (enabled-in-env? :FLAG_IMPORT_PRIVATE_KEY_ENABLED)
::wallet.long-press-watch-only-asset (enabled-in-env? :FLAG_LONG_PRESS_WATCH_ONLY_ASSET_ENABLED)
::wallet.swap (enabled-in-env? :FLAG_SWAP_ENABLED)
::wallet.wallet-connect (enabled-in-env? :FLAG_WALLET_CONNECT_ENABLED)}))

(defn feature-flags [] @feature-flags-config)
Expand Down
3 changes: 2 additions & 1 deletion src/status_im/navigation/screens.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,8 @@
:component wallet-bridge-select-asset/view}

{:name :screen/wallet.bridge-to
:options {:insets {:top? true}}
:options {:insets {:top? true}
:modalPresentationStyle :overCurrentContext}
:component wallet-bridge-to/view}

{:name :screen/wallet.bridge-input-amount
Expand Down

0 comments on commit d13af5b

Please sign in to comment.