Patch "Show QR Code" functionality (#19893)

This commit is contained in:
flexsurfer 2024-05-06 11:58:13 +02:00 committed by GitHub
parent 8a24185ad6
commit a9b4d86b00
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 14 additions and 13 deletions

View File

@ -277,23 +277,29 @@
:sub-label nil :sub-label nil
:chevron? false})) :chevron? false}))
;; TODO(OmarBasem): Requires design input.
(defn show-qr-entry (defn show-qr-entry
[] [public-key]
(entry {:icon :i/qr-code (entry {:icon :i/qr-code
:label (i18n/label :t/show-qr) :label (i18n/label :t/show-qr)
:on-press #(js/alert "TODO: to be implemented, requires design input") :on-press (fn []
(rf/dispatch [:universal-links/generate-profile-url
{:public-key public-key
:on-success #(rf/dispatch [:open-modal
:share-contact])}]))
:danger? false :danger? false
:accessibility-label :show-qr-code :accessibility-label :show-qr-code
:sub-label nil :sub-label nil
:chevron? false})) :chevron? false}))
;; TODO(OmarBasem): to be implemented.
(defn share-profile-entry (defn share-profile-entry
[] [public-key]
(entry {:icon :i/share (entry {:icon :i/share
:label (i18n/label :t/share-profile) :label (i18n/label :t/share-profile)
:on-press #(js/alert "TODO: to be implemented") :on-press (fn []
(rf/dispatch [:universal-links/generate-profile-url
{:public-key public-key
:on-success #(rf/dispatch [:open-share
{:options {:message %}}])}]))
:danger? false :danger? false
:accessibility-label :share-profile :accessibility-label :share-profile
:sub-label nil :sub-label nil
@ -419,9 +425,6 @@
(notifications-entry false)) (notifications-entry false))
(when (and config/fetch-messages-enabled? inside-chat?) (when (and config/fetch-messages-enabled? inside-chat?)
(chat-actions/fetch-messages chat-id)) (chat-actions/fetch-messages chat-id))
(when public?
(when config/show-not-implemented-features?
(show-qr-entry)))
(when public? (when public?
(when config/show-not-implemented-features? (when config/show-not-implemented-features?
(share-group-entry)))]) (share-group-entry)))])
@ -467,10 +470,8 @@
[[(view-profile-entry public-key) [[(view-profile-entry public-key)
(when-not (= current-pub-key public-key) (when-not (= current-pub-key public-key)
(edit-nickname-entry public-key)) (edit-nickname-entry public-key))
(when config/show-not-implemented-features? (show-qr-entry public-key)
(show-qr-entry)) (share-profile-entry public-key)]
(when config/show-not-implemented-features?
(share-profile-entry))]
[(when-not (= current-pub-key public-key) [(when-not (= current-pub-key public-key)
(when config/show-not-implemented-features? (when config/show-not-implemented-features?
(mark-untrustworthy-entry))) (mark-untrustworthy-entry)))