-
Notifications
You must be signed in to change notification settings - Fork 982
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ad546f9
commit 3a9a028
Showing
4 changed files
with
75 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
(ns status-im.contexts.profile.contact.share.style) | ||
|
||
(def header-heading | ||
{:padding-top 2 | ||
:padding-bottom 1}) | ||
|
||
(def qr-code-container | ||
{:margin-horizontal 20 | ||
:margin-top 8}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
(ns status-im.contexts.profile.contact.share.view | ||
(:require [legacy.status-im.ui.components.list-selection :as list-selection] | ||
[quo.core :as quo] | ||
[react-native.core :as rn] | ||
[react-native.safe-area :as safe-area] | ||
[status-im.common.qr-codes.view :as qr-codes] | ||
[status-im.contexts.profile.contact.share.style :as style] | ||
[status-im.contexts.profile.utils :as profile.utils] | ||
[utils.address :as address] | ||
[utils.i18n :as i18n] | ||
[utils.re-frame :as rf])) | ||
|
||
(defn view | ||
[] | ||
(let [{:keys [universal-profile-url customization-color] | ||
:as profile} (rf/sub [:contacts/current-contact]) | ||
abbreviated-url (rn/use-memo (fn [] | ||
(address/get-abbreviated-profile-url universal-profile-url)) | ||
[universal-profile-url]) | ||
profile-picture (rn/use-memo #(profile.utils/photo profile) []) | ||
display-name (rn/use-memo #(profile.utils/displayed-name profile) []) | ||
on-back-press (rn/use-callback #(rf/dispatch [:navigate-back])) | ||
on-share-press (rn/use-callback #(list-selection/open-share {:message universal-profile-url})) | ||
on-copy-press (rn/use-callback (fn [] | ||
(rf/dispatch [:share/copy-text-and-show-toast | ||
{:text-to-copy universal-profile-url | ||
:post-copy-message | ||
(i18n/label | ||
:t/link-to-profile-copied)}])) | ||
[universal-profile-url])] | ||
[quo/overlay {:type :shell} | ||
[rn/view | ||
{:style {:padding-top (safe-area/get-top)} | ||
:key :share-community} | ||
[quo/page-nav | ||
{:icon-name :i/close | ||
:on-press on-back-press | ||
:background :blur | ||
:accessibility-label :top-bar}] | ||
[quo/page-top | ||
{:container-style style/header-heading | ||
:title (i18n/label :t/share-profile)}] | ||
[rn/view {:style style/qr-code-container} | ||
[qr-codes/share-qr-code | ||
{:type :profile | ||
:qr-data universal-profile-url | ||
:qr-data-label-shown abbreviated-url | ||
:on-share-press on-share-press | ||
:on-text-press on-copy-press | ||
:on-text-long-press on-copy-press | ||
:profile-picture profile-picture | ||
:full-name display-name | ||
:customization-color (or customization-color :blue)}]]]])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters