(fix) prevent spamming of copy toast notifications (#15938)
This commit is contained in:
parent
d3b4f60848
commit
78621207e1
|
@ -6,7 +6,8 @@
|
||||||
[status-im2.common.home.style :as style]
|
[status-im2.common.home.style :as style]
|
||||||
[status-im2.common.plus-button.view :as plus-button]
|
[status-im2.common.plus-button.view :as plus-button]
|
||||||
[status-im2.constants :as constants]
|
[status-im2.constants :as constants]
|
||||||
[utils.re-frame :as rf]))
|
[utils.re-frame :as rf]
|
||||||
|
[utils.debounce :refer [dispatch-and-chill]]))
|
||||||
|
|
||||||
(defn title-column
|
(defn title-column
|
||||||
[{:keys [label handler accessibility-label customization-color]}]
|
[{:keys [label handler accessibility-label customization-color]}]
|
||||||
|
@ -101,7 +102,7 @@
|
||||||
[quo/button
|
[quo/button
|
||||||
(merge button-common-props
|
(merge button-common-props
|
||||||
{:accessibility-label :show-qr-button
|
{:accessibility-label :show-qr-button
|
||||||
:on-press #(rf/dispatch [:open-modal :share-shell])})
|
:on-press #(dispatch-and-chill [:open-modal :share-shell] 1000)})
|
||||||
:i/qr-code]
|
:i/qr-code]
|
||||||
[rn/view
|
[rn/view
|
||||||
[unread-indicator]
|
[unread-indicator]
|
||||||
|
|
|
@ -5,11 +5,12 @@
|
||||||
|
|
||||||
(rf/defn copy-text-and-show-toast
|
(rf/defn copy-text-and-show-toast
|
||||||
{:events [:share/copy-text-and-show-toast]}
|
{:events [:share/copy-text-and-show-toast]}
|
||||||
[cofx text-to-copy post-copy-message]
|
[{:keys [db] :as cofx} {:keys [text-to-copy post-copy-message]}]
|
||||||
(rf/merge cofx
|
(rf/merge cofx
|
||||||
{:copy-to-clipboard text-to-copy}
|
{:copy-to-clipboard text-to-copy}
|
||||||
(toasts/upsert
|
(toasts/upsert
|
||||||
{:icon :correct
|
{:icon :correct
|
||||||
|
:id :successful-copy-toast-message
|
||||||
:icon-color colors/success-50
|
:icon-color colors/success-50
|
||||||
:override-theme :dark
|
:override-theme :dark
|
||||||
:text post-copy-message})))
|
:text post-copy-message})))
|
||||||
|
|
|
@ -74,10 +74,12 @@
|
||||||
{:active-opacity 1
|
{:active-opacity 1
|
||||||
:underlay-color colors/neutral-80-opa-1-blur
|
:underlay-color colors/neutral-80-opa-1-blur
|
||||||
:background-color :transparent
|
:background-color :transparent
|
||||||
:on-press #(rf/dispatch [:share/copy-text-and-show-toast profile-url
|
:on-press #(rf/dispatch [:share/copy-text-and-show-toast
|
||||||
(i18n/label :t/link-to-profile-copied)])
|
{:text-to-copy profile-url
|
||||||
:on-long-press #(rf/dispatch [:share/copy-text-and-show-toast profile-url
|
:post-copy-message (i18n/label :t/link-to-profile-copied)}])
|
||||||
(i18n/label :t/link-to-profile-copied)])}
|
:on-long-press #(rf/dispatch [:share/copy-text-and-show-toast
|
||||||
|
{:text-to-copy profile-url
|
||||||
|
:post-copy-message (i18n/label :t/link-to-profile-copied)}])}
|
||||||
[quo/text
|
[quo/text
|
||||||
{:style style/profile-address-content
|
{:style style/profile-address-content
|
||||||
:size :paragraph-1
|
:size :paragraph-1
|
||||||
|
@ -107,10 +109,12 @@
|
||||||
{:active-opacity 1
|
{:active-opacity 1
|
||||||
:underlay-color colors/neutral-80-opa-1-blur
|
:underlay-color colors/neutral-80-opa-1-blur
|
||||||
:background-color :transparent
|
:background-color :transparent
|
||||||
:on-press #(rf/dispatch [:share/copy-text-and-show-toast emoji-hash
|
:on-press #(rf/dispatch [:share/copy-text-and-show-toast
|
||||||
(i18n/label :t/emoji-hash-copied)])
|
{:text-to-copy emoji-hash
|
||||||
:on-long-press #(rf/dispatch [:share/copy-text-and-show-toast emoji-hash
|
:post-copy-message (i18n/label :t/emoji-hash-copied)}])
|
||||||
(i18n/label :t/emoji-hash-copied)])}
|
:on-long-press #(rf/dispatch [:share/copy-text-and-show-toast
|
||||||
|
{:text-to-copy emoji-hash
|
||||||
|
:post-copy-message (i18n/label :t/emoji-hash-copied)}])}
|
||||||
[rn/text {:style style/emoji-hash-content} emoji-hash]]]]
|
[rn/text {:style style/emoji-hash-content} emoji-hash]]]]
|
||||||
[rn/view {:style style/emoji-share-button-container}
|
[rn/view {:style style/emoji-share-button-container}
|
||||||
[quo/button
|
[quo/button
|
||||||
|
@ -120,10 +124,12 @@
|
||||||
:accessibility-label :link-to-profile
|
:accessibility-label :link-to-profile
|
||||||
:override-theme :dark
|
:override-theme :dark
|
||||||
:style {:margin-right 12}
|
:style {:margin-right 12}
|
||||||
:on-press #(rf/dispatch [:share/copy-text-and-show-toast emoji-hash
|
:on-press #(rf/dispatch [:share/copy-text-and-show-toast
|
||||||
(i18n/label :t/emoji-hash-copied)])
|
{:text-to-copy emoji-hash
|
||||||
:on-long-press #(rf/dispatch [:share/copy-text-and-show-toast emoji-hash
|
:post-copy-message (i18n/label :t/emoji-hash-copied)}])
|
||||||
(i18n/label :t/emoji-hash-copied)])}
|
:on-long-press #(rf/dispatch [:share/copy-text-and-show-toast
|
||||||
|
{:text-to-copy emoji-hash
|
||||||
|
:post-copy-message (i18n/label :t/emoji-hash-copied)}])}
|
||||||
:i/copy]]]]))
|
:i/copy]]]]))
|
||||||
|
|
||||||
(defn wallet-tab
|
(defn wallet-tab
|
||||||
|
|
Loading…
Reference in New Issue