Skip to content

Commit

Permalink
Merge branch 'develop' into milad/19775-fix-scanned-address
Browse files Browse the repository at this point in the history
  • Loading branch information
mmilad75 committed May 6, 2024
2 parents ff3626a + b907881 commit 28bd164
Show file tree
Hide file tree
Showing 22 changed files with 151 additions and 150 deletions.
12 changes: 4 additions & 8 deletions src/quo/components/buttons/wallet_ctas/style.cljs
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
(ns quo.components.buttons.wallet-ctas.style)

(def container
{:padding-top 24
:padding-bottom 12
:padding-horizontal 20
:flex-direction :row
:justify-content :center
:flex 1
:max-height 106})
(def inner-container
{:flex-direction :row
:justify-content :center
:flex 1})

(def button-container
{:padding-vertical 8
Expand Down
53 changes: 27 additions & 26 deletions src/quo/components/buttons/wallet_ctas/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -24,30 +24,31 @@
:color (colors/theme-colors colors/neutral-50 colors/neutral-40 theme)}} text]])

(defn view
[{:keys [buy-action send-action receive-action bridge-action]}]
[{:keys [buy-action send-action receive-action bridge-action container-style]}]
(let [theme (quo.theme/use-theme)]
[rn/view {:style style/container}
[action-button
{:icon :i/add
:text (i18n/label :t/buy)
:on-press buy-action
:theme theme
:accessibility-label :buy}]
[action-button
{:icon :i/send
:text (i18n/label :t/send)
:on-press send-action
:theme theme
:accessibility-label :send}]
[action-button
{:icon :i/receive
:text (i18n/label :t/receive)
:on-press receive-action
:theme theme
:accessibility-label :receive}]
[action-button
{:icon :i/bridge
:text (i18n/label :t/bridge)
:on-press bridge-action
:theme theme
:accessibility-label :bridge}]]))
[rn/view {:style container-style}
[rn/view {:style style/inner-container}
[action-button
{:icon :i/add
:text (i18n/label :t/buy)
:on-press buy-action
:theme theme
:accessibility-label :buy}]
[action-button
{:icon :i/send
:text (i18n/label :t/send)
:on-press send-action
:theme theme
:accessibility-label :send}]
[action-button
{:icon :i/receive
:text (i18n/label :t/receive)
:on-press receive-action
:theme theme
:accessibility-label :receive}]
[action-button
{:icon :i/bridge
:text (i18n/label :t/bridge)
:on-press bridge-action
:theme theme
:accessibility-label :bridge}]]]))
2 changes: 1 addition & 1 deletion src/quo/components/wallet/account_origin/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
[icons/icon
:i/keycard-card
{:color secondary-color}])]]
(when (= :derivation-path type)
(when (and on-press (= :derivation-path type))
[rn/pressable
{:accessibility-label :derivation-path-button
:on-press on-press
Expand Down
9 changes: 3 additions & 6 deletions src/quo/components/wallet/account_overview/style.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@
[quo.foundations.colors :as colors]))

(def account-overview-wrapper
{:padding-top 24
:padding-horizontal 20
:padding-bottom 20
:height 130
:align-items :center
:justify-content :center})
{:height 110
:align-items :center
:justify-content :center})

(defn account-name
[color]
Expand Down
4 changes: 2 additions & 2 deletions src/quo/components/wallet/account_overview/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,12 @@

(defn- view-internal
[{:keys [state account time-frame time-frame-string time-frame-to-string account-name current-value
percentage-change currency-change metrics customization-color]
percentage-change currency-change metrics customization-color container-style]
:or {customization-color :blue}}]
(let [theme (quo.theme/use-theme)
time-frame-string (time-string time-frame time-frame-string)
up? (= metrics :positive)]
[rn/view {:style style/account-overview-wrapper}
[rn/view {:style (merge container-style style/account-overview-wrapper)}
(if (= :loading state)
[loading-state (colors/theme-colors colors/neutral-5 colors/neutral-90 theme)]
[rn/view
Expand Down
1 change: 1 addition & 0 deletions src/status_im/common/bottom_sheet/style.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
(defn sheet
[{:keys [max-height]}]
{:position :absolute
:overflow :hidden
:bottom 0
:left 0
:right 0
Expand Down
27 changes: 14 additions & 13 deletions src/status_im/common/home/actions/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -277,23 +277,29 @@
:sub-label nil
:chevron? false}))

;; TODO(OmarBasem): Requires design input.
(defn show-qr-entry
[]
[public-key]
(entry {:icon :i/qr-code
:label (i18n/label :t/show-qr)
:on-press #(js/alert "TODO: to be implemented, requires design input")
:on-press (fn []
(rf/dispatch [:universal-links/generate-profile-url
{:public-key public-key
:on-success #(rf/dispatch [:open-modal
:share-contact])}]))
:danger? false
:accessibility-label :show-qr-code
:sub-label nil
:chevron? false}))

;; TODO(OmarBasem): to be implemented.
(defn share-profile-entry
[]
[public-key]
(entry {:icon :i/share
:label (i18n/label :t/share-profile)
:on-press #(js/alert "TODO: to be implemented")
:on-press (fn []
(rf/dispatch [:universal-links/generate-profile-url
{:public-key public-key
:on-success #(rf/dispatch [:open-share
{:options {:message %}}])}]))
:danger? false
:accessibility-label :share-profile
:sub-label nil
Expand Down Expand Up @@ -419,9 +425,6 @@
(notifications-entry false))
(when (and config/fetch-messages-enabled? inside-chat?)
(chat-actions/fetch-messages chat-id))
(when public?
(when config/show-not-implemented-features?
(show-qr-entry)))
(when public?
(when config/show-not-implemented-features?
(share-group-entry)))])
Expand Down Expand Up @@ -467,10 +470,8 @@
[[(view-profile-entry public-key)
(when-not (= current-pub-key public-key)
(edit-nickname-entry public-key))
(when config/show-not-implemented-features?
(show-qr-entry))
(when config/show-not-implemented-features?
(share-profile-entry))]
(show-qr-entry public-key)
(share-profile-entry public-key)]
[(when-not (= current-pub-key public-key)
(when config/show-not-implemented-features?
(mark-untrustworthy-entry)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
[reagent.core :as reagent]
[status-im.common.alert.effects :as alert.effects]
[status-im.common.device-permissions :as device-permissions]
[status-im.config :as config]
[status-im.constants :as constants]
[status-im.contexts.chat.messenger.composer.actions.style :as style]
[status-im.contexts.chat.messenger.composer.constants :as comp-constants]
Expand Down Expand Up @@ -235,10 +236,12 @@
:display (if @(:recording? state) :none :flex)}}
[camera-button edit]
[image-button props animations edit]
[reaction-button]
[format-button]]
(when config/show-not-implemented-features?
[reaction-button])
(when config/show-not-implemented-features?
[format-button])]
[:f> send-button props state animations window-height images edit send-btn-opacity]
(when (and (not edit) (not images))
(when (and (not edit) (not images) config/show-not-implemented-features?)
;; TODO(alwx): needs to be replaced with an `audio-button` later. See
;; https://github.com/status-im/status-mobile/issues/16084 for more details.
[:f> disabled-audio-button audio-btn-opacity])]))
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,9 @@
constants/content-type-text
[content.text/text-content message-data context]

constants/content-type-contact-request
[content.text/text-content message-data context]

constants/content-type-emoji
[emoji-message/view
{:content content
Expand Down
13 changes: 6 additions & 7 deletions src/status_im/contexts/chat/messenger/messages/list/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -307,15 +307,14 @@
[chat.group/group-chat-footer chat-id invitation-admin]])

(defn render-fn
[{:keys [type value content-type] :as message-data} _ _
[{:keys [type value] :as message-data} _ _
{:keys [context keyboard-shown?]}]
(when (not= content-type constants/content-type-contact-request)
(cond
(= type :datemark)
[quo/divider-date value]
(cond
(= type :datemark)
[quo/divider-date value]

:else
[message/message message-data context keyboard-shown?])))
:else
[message/message message-data context keyboard-shown?]))

(defn on-content-size-change
[{:keys [content-height distance-atom distance-from-list-top]}]
Expand Down
12 changes: 8 additions & 4 deletions src/status_im/contexts/preview/quo/buttons/wallet_ctas.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
[]
[preview/preview-container {}
[quo/wallet-ctas
{: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")}]])
{:container-style {:padding-top 24
:padding-bottom 12
:padding-horizontal 20
:flex-direction :row}
: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")}]])
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@
:time-frame-string "16 May"
:time-frame-to-string "25 May"
:account :default
:customization-color :blue})]
:customization-color :blue
:container-style {:padding-top 24
:padding-horizontal 20
:padding-bottom 20}})]
(fn []
[preview/preview-container
{:state state
Expand Down
10 changes: 10 additions & 0 deletions src/status_im/contexts/wallet/account/style.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,13 @@
(def tabs
{:padding-left 20
:padding-vertical 12})

(def cta-buttons
{:padding-horizontal 20
:padding-bottom 13
:flex-direction :row})

(def account-overview
{:padding-top 60
:margin-bottom 12
:padding-horizontal 20})
3 changes: 1 addition & 2 deletions src/status_im/contexts/wallet/account/tabs/about/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,4 @@
:profile-picture (profile.utils/photo profile)
:customization-color customization-color
:derivation-path path
:keypair-name keypair-name
:on-press #(js/alert "To be implemented")}])]))
:keypair-name keypair-name}])]))
25 changes: 14 additions & 11 deletions src/status_im/contexts/wallet/account/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,25 @@
{:type :wallet-networks
:on-press #(rf/dispatch [:wallet/close-account-page])}]
[quo/account-overview
{:current-value formatted-balance
{:container-style style/account-overview
:current-value formatted-balance
:account-name name
:account (if watch-only? :watched-address :default)
:customization-color color}]
[quo/wallet-graph {:time-frame :empty}]
(when (ff/enabled? ::ff/wallet.graph) [quo/wallet-graph {:time-frame :empty}])
(when (not watch-only?)
[quo/wallet-ctas
{:send-action (fn []
(rf/dispatch [:wallet/clean-send-data])
(rf/dispatch [:wallet/wizard-navigate-forward
{:start-flow? true
:flow-id :wallet-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])}])
{: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}]))
: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])}])
[quo/tabs
{:style style/tabs
:size 32
Expand Down
51 changes: 7 additions & 44 deletions src/status_im/contexts/wallet/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
(:require
[camel-snake-kebab.extras :as cske]
[clojure.string :as string]
[react-native.background-timer :as background-timer]
[react-native.platform :as platform]
[status-im.constants :as constants]
[status-im.contexts.wallet.common.utils.networks :as network-utils]
Expand Down Expand Up @@ -329,55 +328,19 @@
(assoc-in [:wallet :ui :search-address :local-suggestions] suggestion)
(assoc-in [:wallet :ui :search-address :valid-ens-or-address?] (boolean result)))})))

(rf/reg-event-fx :wallet/fetch-address-suggestions
(fn [{:keys [db]} [_address]]
{:db (-> db
(assoc-in [:wallet :ui :search-address :local-suggestions] nil)
(assoc-in [:wallet :ui :search-address :valid-ens-or-address?] false))}))

(rf/reg-event-fx :wallet/ens-validation-success
(fn [{:keys [db]} [_ens]]
{:db (-> db
(assoc-in [:wallet :ui :search-address :local-suggestions] nil)
(assoc-in [:wallet :ui :search-address :valid-ens-or-address?] true))}))

(rf/reg-event-fx :wallet/address-validation-success
(fn [{:keys [db]} [_]]
(fn [{:keys [db]}]
{:db (assoc-in db [:wallet :ui :search-address :valid-ens-or-address?] true)}))

(rf/reg-event-fx :wallet/validate-address
(fn [{:keys [db]} [address]]
(let [current-timeout (get-in db [:wallet :ui :search-address :search-timeout])
timeout (background-timer/set-timeout
#(rf/dispatch [:wallet/address-validation-success address])
2000)]
(background-timer/clear-timeout current-timeout)
{:db (-> db
(assoc-in [:wallet :ui :search-address :search-timeout] timeout)
(assoc-in [:wallet :ui :search-address :valid-ens-or-address?] false))})))

(rf/reg-event-fx :wallet/validate-ens
(fn [{:keys [db]} [ens]]
(let [current-timeout (get-in db [:wallet :ui :search-address :search-timeout])
timeout (background-timer/set-timeout
#(rf/dispatch [:wallet/ens-validation-success ens])
2000)]
(background-timer/clear-timeout current-timeout)
{:db (-> db
(assoc-in [:wallet :ui :search-address :search-timeout] timeout)
(assoc-in [:wallet :ui :search-address :valid-ens-or-address?] false))})))

(rf/reg-event-fx :wallet/clean-local-suggestions
(rf/reg-event-fx :wallet/address-validation-failed
(fn [{:keys [db]}]
(let [current-timeout (get-in db [:wallet :ui :search-address :search-timeout])]
(background-timer/clear-timeout current-timeout)
{:db (-> db
(assoc-in [:wallet :ui :search-address :local-suggestions] [])
(assoc-in [:wallet :ui :search-address :valid-ens-or-address?] false))})))
{:db (assoc-in db [:wallet :ui :search-address :valid-ens-or-address?] false)}))

(rf/reg-event-fx :wallet/clean-ens-or-address-validation
(rf/reg-event-fx :wallet/clean-local-suggestions
(fn [{:keys [db]}]
{:db (assoc-in db [:wallet :ui :search-address :valid-ens-or-address?] false)}))
{:db (-> db
(assoc-in [:wallet :ui :search-address :local-suggestions] [])
(assoc-in [:wallet :ui :search-address :valid-ens-or-address?] false))}))

(rf/reg-event-fx
:wallet/navigate-to-chain-explorer-from-bottom-sheet
Expand Down

0 comments on commit 28bd164

Please sign in to comment.