Skip to content

Commit

Permalink
add share functionality on button tap
Browse files Browse the repository at this point in the history
  • Loading branch information
siddarthkay committed Mar 31, 2023
1 parent 3d1b070 commit 9af527d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
13 changes: 12 additions & 1 deletion src/status_im2/contexts/share/events.cljs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
(ns status-im2.contexts.share.events
(:require [taoensso.timbre :as log]
[utils.re-frame :as rf]))
[utils.re-frame :as rf]
[status-im2.common.toasts.events :as toasts]
[utils.i18n :as i18n]
[quo2.foundations.colors :as colors]))

(rf/defn open-profile-share-view
{:events [:share/open]}
Expand All @@ -12,3 +15,11 @@
:blur-view? true
:blur-view-props {:blur-amount 20
:blur-type :dark}}]})

(rf/defn show-emoji-hash-copied-toast
{:events [:share/show-emoji-hash-copied-toast]}
[cofx]
(toasts/upsert cofx
{:icon :alert
:icon-color colors/danger-50
:text (i18n/label :t/pin-limit-reached)}))
17 changes: 16 additions & 1 deletion src/status_im2/contexts/share/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
[taoensso.timbre :as log]
[reagent.core :as reagent]
[quo2.foundations.colors :as colors]
[status-im2.common.toasts.events :as toasts]
;;TODO(siddarthkay) : move these components over to status-im2 ns first
[status-im.ui.components.list-selection :as list-selection]
[status-im.ui.components.qr-code-viewer.views :as qr-code-viewer]
[status-im.ui.components.copyable-text :as copyable-text]
[react-native.fast-image :as fast-image]
Expand All @@ -18,6 +20,15 @@
(def ^:const profile-tab-id 0)
(def ^:const wallet-tab-id 1)

(rf/defn show-emoji-hash-copied-toast
{:events [:share/show-emoji-hash-copied-toast]}
[cofx]
(toasts/upsert cofx
{:icon :alert
:icon-color colors/danger-50
:text (i18n/label :t/pin-limit-reached)}))


(defn header
[]
[rn/view
Expand Down Expand Up @@ -89,7 +100,10 @@
:size 32
:accessibility-label :link-to-profile
:override-theme :dark
;;:on-press ;;;; TODO(siddarthay) : figure this out and take appropriate action
:on-press (fn []
(js/setTimeout
#(list-selection/open-share {:message profile-qr-url})
250))
}
:i/share]]]]

Expand All @@ -111,6 +125,7 @@
:accessibility-label :link-to-profile
:override-theme :dark
:style {:margin-right 12}
:on-press #(rf/dispatch [:share/show-emoji-hash-copied-toast])
}
:i/copy]]

Expand Down

0 comments on commit 9af527d

Please sign in to comment.