* add share account functionality * add share qr code address functionality * rename file * finalize code * move logic to events and effects * fix lint issues * resolve comments * change translation
This commit is contained in:
parent
19aa78cc81
commit
49e9b4212b
|
@ -3,8 +3,6 @@
|
||||||
[quo.core :as quo]
|
[quo.core :as quo]
|
||||||
[react-native.clipboard :as clipboard]
|
[react-native.clipboard :as clipboard]
|
||||||
[react-native.core :as rn]
|
[react-native.core :as rn]
|
||||||
[react-native.platform :as platform]
|
|
||||||
[react-native.share :as share]
|
|
||||||
[status-im.config :as config]
|
[status-im.config :as config]
|
||||||
[status-im.contexts.profile.utils :as profile.utils]
|
[status-im.contexts.profile.utils :as profile.utils]
|
||||||
[status-im.contexts.wallet.account.tabs.about.style :as style]
|
[status-im.contexts.wallet.account.tabs.about.style :as style]
|
||||||
|
@ -53,26 +51,16 @@
|
||||||
:text (i18n/label :t/address-copied)}]))}
|
:text (i18n/label :t/address-copied)}]))}
|
||||||
{:icon :i/qr-code
|
{:icon :i/qr-code
|
||||||
:accessibility-label :show-address-qr
|
:accessibility-label :show-address-qr
|
||||||
:label (i18n/label :t/show-address-qr)}
|
:label (i18n/label :t/show-address-qr)
|
||||||
|
:on-press #(rf/dispatch [:open-modal :wallet-share-address {:status :share}])}
|
||||||
{:icon :i/share
|
{:icon :i/share
|
||||||
:accessibility-label :share-address
|
:accessibility-label :share-address
|
||||||
:label (i18n/label :t/share-address)
|
:label (i18n/label :t/share-address)
|
||||||
:on-press (fn []
|
:on-press (fn []
|
||||||
(rf/dispatch [:hide-bottom-sheet])
|
(rf/dispatch [:hide-bottom-sheet])
|
||||||
(js/setTimeout
|
(js/setTimeout
|
||||||
#(share/open
|
#(rf/dispatch [:wallet/share-account
|
||||||
(if platform/ios?
|
{:title share-title :content multichain-address}])
|
||||||
{:activityItemSources [{:placeholderItem {:type "text"
|
|
||||||
:content
|
|
||||||
multichain-address}
|
|
||||||
:item {:default
|
|
||||||
{:type "text"
|
|
||||||
:content
|
|
||||||
multichain-address}}
|
|
||||||
:linkMetadata {:title share-title}}]}
|
|
||||||
{:title share-title
|
|
||||||
:subject share-title
|
|
||||||
:message multichain-address}))
|
|
||||||
600))}]]]))
|
600))}]]]))
|
||||||
|
|
||||||
(defn view
|
(defn view
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
(when (not watch-only?)
|
(when (not watch-only?)
|
||||||
[quo/wallet-ctas
|
[quo/wallet-ctas
|
||||||
{:send-action #(rf/dispatch [:open-modal :wallet-select-address])
|
{:send-action #(rf/dispatch [:open-modal :wallet-select-address])
|
||||||
:receive-action #(rf/dispatch [:open-modal :wallet-receive])
|
:receive-action #(rf/dispatch [:open-modal :wallet-share-address {:status :receive}])
|
||||||
:buy-action #(rf/dispatch [:show-bottom-sheet
|
:buy-action #(rf/dispatch [:show-bottom-sheet
|
||||||
{:content buy-drawer}])
|
{:content buy-drawer}])
|
||||||
:bridge-action #(rf/dispatch [:open-modal :wallet-bridge])}])
|
:bridge-action #(rf/dispatch [:open-modal :wallet-bridge])}])
|
||||||
|
|
|
@ -35,7 +35,8 @@
|
||||||
network-preference-details (rf/sub [:wallet/network-preference-details])
|
network-preference-details (rf/sub [:wallet/network-preference-details])
|
||||||
multichain-address (utils/get-multichain-address
|
multichain-address (utils/get-multichain-address
|
||||||
network-preference-details
|
network-preference-details
|
||||||
address)]
|
address)
|
||||||
|
share-title (str name " " (i18n/label :t/address))]
|
||||||
[rn/view
|
[rn/view
|
||||||
{:on-layout #(reset! options-height (oops/oget % "nativeEvent.layout.height"))
|
{:on-layout #(reset! options-height (oops/oget % "nativeEvent.layout.height"))
|
||||||
:style (when show-account-selector? style/options-container)}
|
:style (when show-account-selector? style/options-container)}
|
||||||
|
@ -77,9 +78,19 @@
|
||||||
{:type :positive
|
{:type :positive
|
||||||
:text (i18n/label :t/address-copied)}])
|
:text (i18n/label :t/address-copied)}])
|
||||||
(clipboard/set-string multichain-address))}
|
(clipboard/set-string multichain-address))}
|
||||||
|
{:icon :i/qr-code
|
||||||
|
:accessibility-label :show-address-qr
|
||||||
|
:label (i18n/label :t/show-address-qr)
|
||||||
|
:on-press #(rf/dispatch [:open-modal :wallet-share-address {:status :share}])}
|
||||||
{:icon :i/share
|
{:icon :i/share
|
||||||
:accessibility-label :share-account
|
:accessibility-label :share-account
|
||||||
:label (i18n/label :t/share-account)}
|
:label (i18n/label :t/share-address)
|
||||||
|
:on-press (fn []
|
||||||
|
(rf/dispatch [:hide-bottom-sheet])
|
||||||
|
(js/setTimeout
|
||||||
|
#(rf/dispatch [:wallet/share-account
|
||||||
|
{:title share-title :content address}])
|
||||||
|
600))}
|
||||||
{:add-divider? (not show-account-selector?)
|
{:add-divider? (not show-account-selector?)
|
||||||
:icon :i/delete
|
:icon :i/delete
|
||||||
:accessibility-label :remove-account
|
:accessibility-label :remove-account
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
(ns status-im.contexts.wallet.effects
|
||||||
|
(:require [re-frame.core :as rf]
|
||||||
|
[react-native.share :as share]))
|
||||||
|
|
||||||
|
(rf/reg-fx :effects.share/open
|
||||||
|
(fn [content]
|
||||||
|
(share/open content)))
|
|
@ -2,6 +2,7 @@
|
||||||
(:require
|
(:require
|
||||||
[clojure.string :as string]
|
[clojure.string :as string]
|
||||||
[react-native.background-timer :as background-timer]
|
[react-native.background-timer :as background-timer]
|
||||||
|
[react-native.platform :as platform]
|
||||||
[status-im.contexts.wallet.data-store :as data-store]
|
[status-im.contexts.wallet.data-store :as data-store]
|
||||||
[status-im.contexts.wallet.events.collectibles]
|
[status-im.contexts.wallet.events.collectibles]
|
||||||
[status-im.contexts.wallet.item-types :as item-types]
|
[status-im.contexts.wallet.item-types :as item-types]
|
||||||
|
@ -329,3 +330,17 @@
|
||||||
(rf/reg-event-fx :wallet/initialize
|
(rf/reg-event-fx :wallet/initialize
|
||||||
(fn []
|
(fn []
|
||||||
{:fx [[:dispatch-n [[:wallet/get-ethereum-chains] [:wallet/get-accounts]]]]}))
|
{:fx [[:dispatch-n [[:wallet/get-ethereum-chains] [:wallet/get-accounts]]]]}))
|
||||||
|
|
||||||
|
(rf/reg-event-fx :wallet/share-account
|
||||||
|
(fn [_ [{:keys [content title]}]]
|
||||||
|
{:fx [[:effects.share/open
|
||||||
|
(if platform/ios?
|
||||||
|
{:activityItemSources
|
||||||
|
[{:placeholderItem {:type "text"
|
||||||
|
:content content}
|
||||||
|
:item {:default {:type "text"
|
||||||
|
:content content}}
|
||||||
|
:linkMetadata {:title title}}]}
|
||||||
|
{:title title
|
||||||
|
:subject title
|
||||||
|
:message content})]]}))
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
(ns status-im.contexts.wallet.receive.style)
|
(ns status-im.contexts.wallet.share-address.style)
|
||||||
|
|
||||||
(def header-container
|
(def header-container
|
||||||
{:padding-horizontal 20
|
{:padding-horizontal 20
|
|
@ -1,4 +1,4 @@
|
||||||
(ns status-im.contexts.wallet.receive.view
|
(ns status-im.contexts.wallet.share-address.view
|
||||||
(:require
|
(:require
|
||||||
[quo.core :as quo]
|
[quo.core :as quo]
|
||||||
[react-native.core :as rn]
|
[react-native.core :as rn]
|
||||||
|
@ -8,7 +8,7 @@
|
||||||
[reagent.core :as reagent]
|
[reagent.core :as reagent]
|
||||||
[status-im.contexts.wallet.common.sheets.network-preferences.view :as network-preferences]
|
[status-im.contexts.wallet.common.sheets.network-preferences.view :as network-preferences]
|
||||||
[status-im.contexts.wallet.common.utils :as utils]
|
[status-im.contexts.wallet.common.utils :as utils]
|
||||||
[status-im.contexts.wallet.receive.style :as style]
|
[status-im.contexts.wallet.share-address.style :as style]
|
||||||
[utils.i18n :as i18n]
|
[utils.i18n :as i18n]
|
||||||
[utils.image-server :as image-server]
|
[utils.image-server :as image-server]
|
||||||
[utils.re-frame :as rf]))
|
[utils.re-frame :as rf]))
|
||||||
|
@ -64,7 +64,12 @@
|
||||||
{:url qr-url
|
{:url qr-url
|
||||||
:port (rf/sub [:mediaserver/port])
|
:port (rf/sub [:mediaserver/port])
|
||||||
:qr-size qr-size
|
:qr-size qr-size
|
||||||
:error-level :highest})]
|
:error-level :highest})
|
||||||
|
{:keys [status]} (rf/sub [:get-screen-params])
|
||||||
|
title (case status
|
||||||
|
:share (i18n/label :t/share-address)
|
||||||
|
:receive (i18n/label :t/receive)
|
||||||
|
nil)]
|
||||||
[quo/overlay {:type :shell}
|
[quo/overlay {:type :shell}
|
||||||
[rn/view
|
[rn/view
|
||||||
{:flex 1
|
{:flex 1
|
||||||
|
@ -78,7 +83,7 @@
|
||||||
:accessibility-label :top-bar}]
|
:accessibility-label :top-bar}]
|
||||||
[quo/text-combinations
|
[quo/text-combinations
|
||||||
{:container-style style/header-container
|
{:container-style style/header-container
|
||||||
:title (i18n/label :t/receive)}]
|
:title title}]
|
||||||
[rn/view {:style {:padding-horizontal 20}}
|
[rn/view {:style {:padding-horizontal 20}}
|
||||||
[quo/share-qr-code
|
[quo/share-qr-code
|
||||||
{:type @wallet-type
|
{:type @wallet-type
|
|
@ -23,6 +23,7 @@
|
||||||
status-im.contexts.profile.settings.events
|
status-im.contexts.profile.settings.events
|
||||||
status-im.contexts.shell.share.events
|
status-im.contexts.shell.share.events
|
||||||
status-im.contexts.syncing.events
|
status-im.contexts.syncing.events
|
||||||
|
status-im.contexts.wallet.effects
|
||||||
status-im.contexts.wallet.events
|
status-im.contexts.wallet.events
|
||||||
status-im.contexts.wallet.send.events
|
status-im.contexts.wallet.send.events
|
||||||
[status-im.db :as db]
|
[status-im.db :as db]
|
||||||
|
|
|
@ -58,7 +58,6 @@
|
||||||
[status-im.contexts.wallet.create-account.select-keypair.view :as wallet-select-keypair]
|
[status-im.contexts.wallet.create-account.select-keypair.view :as wallet-select-keypair]
|
||||||
[status-im.contexts.wallet.create-account.view :as wallet-create-account]
|
[status-im.contexts.wallet.create-account.view :as wallet-create-account]
|
||||||
[status-im.contexts.wallet.edit-account.view :as wallet-edit-account]
|
[status-im.contexts.wallet.edit-account.view :as wallet-edit-account]
|
||||||
[status-im.contexts.wallet.receive.view :as wallet-receive]
|
|
||||||
[status-im.contexts.wallet.saved-addresses.view :as wallet-saved-addresses]
|
[status-im.contexts.wallet.saved-addresses.view :as wallet-saved-addresses]
|
||||||
[status-im.contexts.wallet.scan-account.view :as scan-address]
|
[status-im.contexts.wallet.scan-account.view :as scan-address]
|
||||||
[status-im.contexts.wallet.send.input-amount.view :as wallet-send-input-amount]
|
[status-im.contexts.wallet.send.input-amount.view :as wallet-send-input-amount]
|
||||||
|
@ -66,6 +65,7 @@
|
||||||
[status-im.contexts.wallet.send.select-asset.view :as wallet-select-asset]
|
[status-im.contexts.wallet.send.select-asset.view :as wallet-select-asset]
|
||||||
[status-im.contexts.wallet.send.transaction-confirmation.view :as wallet-transaction-confirmation]
|
[status-im.contexts.wallet.send.transaction-confirmation.view :as wallet-transaction-confirmation]
|
||||||
[status-im.contexts.wallet.send.transaction-progress.view :as wallet-transaction-progress]
|
[status-im.contexts.wallet.send.transaction-progress.view :as wallet-transaction-progress]
|
||||||
|
[status-im.contexts.wallet.share-address.view :as wallet-share-address]
|
||||||
[status-im.navigation.options :as options]
|
[status-im.navigation.options :as options]
|
||||||
[status-im.navigation.transitions :as transitions]))
|
[status-im.navigation.transitions :as transitions]))
|
||||||
|
|
||||||
|
@ -330,9 +330,9 @@
|
||||||
:options {:insets {:top? true :bottom? true}}
|
:options {:insets {:top? true :bottom? true}}
|
||||||
:component wallet-backup-recovery-phrase/view}
|
:component wallet-backup-recovery-phrase/view}
|
||||||
|
|
||||||
{:name :wallet-receive
|
{:name :wallet-share-address
|
||||||
:options options/transparent-screen-options
|
:options options/transparent-screen-options
|
||||||
:component wallet-receive/view}
|
:component wallet-share-address/view}
|
||||||
|
|
||||||
{:name :wallet-saved-addresses
|
{:name :wallet-saved-addresses
|
||||||
:component wallet-saved-addresses/view}
|
:component wallet-saved-addresses/view}
|
||||||
|
|
Loading…
Reference in New Issue