From 1df96ae3e00896c9466e5ec07af90847a78935a6 Mon Sep 17 00:00:00 2001 From: Alexander Date: Tue, 19 Dec 2023 10:36:49 +0100 Subject: [PATCH] Invite friends (#17570) (#18124) * Invite friends (#17570) * Small update * Update * Fix --- src/status_im2/contexts/chat/home/view.cljs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/status_im2/contexts/chat/home/view.cljs b/src/status_im2/contexts/chat/home/view.cljs index 13da5f53a6..bfa62e4f77 100644 --- a/src/status_im2/contexts/chat/home/view.cljs +++ b/src/status_im2/contexts/chat/home/view.cljs @@ -5,6 +5,7 @@ [re-frame.core :as re-frame] [react-native.core :as rn] [react-native.reanimated :as reanimated] + [react-native.share :as share] [status-im2.common.contact-list-item.view :as contact-list-item] [status-im2.common.contact-list.view :as contact-list] [status-im2.common.home.actions.view :as actions] @@ -110,14 +111,16 @@ {:scroll-input (oops/oget % "nativeEvent.contentOffset.y") :shared-value scroll-shared-value})}]))) -(def ^:private banner-data +(defn- banner-data + [profile-link] {:title-props {:label (i18n/label :t/messages) :handler #(rf/dispatch [:show-bottom-sheet {:content chat.actions.view/new-chat}]) :accessibility-label :new-chat-button} :card-props - {:banner (resources/get-image :invite-friends) + {:on-press #(share/open {:url profile-link}) + :banner (resources/get-image :invite-friends) :title (i18n/label :t/invite-friends-to-status) :description (i18n/label :t/share-invite-link)}}) @@ -126,10 +129,11 @@ (let [scroll-ref (atom nil) set-scroll-ref #(reset! scroll-ref %)] (fn [] - (let [customization-color (rf/sub [:profile/customization-color]) - pending-contact-requests (rf/sub [:activity-center/pending-contact-requests]) - selected-tab (or (rf/sub [:messages-home/selected-tab]) :tab/recent) - scroll-shared-value (reanimated/use-shared-value 0)] + (let [{:keys [universal-profile-url]} (rf/sub [:profile/profile]) + customization-color (rf/sub [:profile/customization-color]) + pending-contact-requests (rf/sub [:activity-center/pending-contact-requests]) + selected-tab (or (rf/sub [:messages-home/selected-tab]) :tab/recent) + scroll-shared-value (reanimated/use-shared-value 0)] [:<> (if (= selected-tab :tab/contacts) [contacts @@ -143,7 +147,7 @@ :scroll-shared-value scroll-shared-value :theme theme}]) [:f> common.banner/animated-banner - {:content banner-data + {:content (banner-data universal-profile-url) :customization-color customization-color :scroll-ref scroll-ref :tabs [{:id :tab/recent