Ask user to update their profile before sending a message or contact request

This commit is contained in:
Ulises M 2024-12-20 17:11:47 -06:00
parent cb2e4e9ab1
commit a3668bb489
No known key found for this signature in database
GPG Key ID: 5A15782EB758534E
2 changed files with 35 additions and 34 deletions

View File

@ -115,13 +115,17 @@
{:scroll-input (oops/oget % "nativeEvent.contentOffset.y") {:scroll-input (oops/oget % "nativeEvent.contentOffset.y")
:shared-value scroll-shared-value})}]))) :shared-value scroll-shared-value})}])))
(defn- on-new-message-press
[]
(let [main-event [:show-bottom-sheet {:content chat.actions.view/new-chat}]]
(rf/dispatch [:profile/check-profile-update-prompt main-event])))
(defn- banner-data (defn- banner-data
[profile-link] [profile-link]
{:title-props {:title-props
{:beta? true {:beta? true
:label (i18n/label :t/messages) :label (i18n/label :t/messages)
:handler #(rf/dispatch :handler on-new-message-press
[:show-bottom-sheet {:content chat.actions.view/new-chat}])
:accessibility-label :new-chat-button} :accessibility-label :new-chat-button}
:card-props :card-props
{:on-press #(rf/dispatch [:open-share {:options {:url profile-link}}]) {:on-press #(rf/dispatch [:open-share {:options {:url profile-link}}])

View File

@ -14,15 +14,14 @@
[utils.i18n :as i18n] [utils.i18n :as i18n]
[utils.re-frame :as rf])) [utils.re-frame :as rf]))
(defn on-contact-request (defn on-send-contact-request
[] []
(rf/dispatch [:show-bottom-sheet (let [main-event [:show-bottom-sheet {:content contact-request/view}]]
{:content (fn [] [contact-request/view])}])) (rf/dispatch [:profile/check-profile-update-prompt main-event])))
(defn on-contact-review (defn on-contact-review
[] []
(rf/dispatch [:show-bottom-sheet (rf/dispatch [:show-bottom-sheet {:content contact-review/view}]))
{:content (fn [] [contact-review/view])}]))
(defn view (defn view
[{:keys [scroll-y]}] [{:keys [scroll-y]}]
@ -34,27 +33,27 @@
profile-picture (profile.utils/photo contact) profile-picture (profile.utils/photo contact)
online? (rf/sub [:visibility-status-updates/online? public-key]) online? (rf/sub [:visibility-status-updates/online? public-key])
theme (quo.theme/use-theme) theme (quo.theme/use-theme)
contact-status (rn/use-memo (fn [] contact-status (rn/use-memo
(cond (fn []
(= contact-request-state (cond
constants/contact-request-state-mutual) :contact (= contact-request-state
blocked? :blocked constants/contact-request-state-mutual) :contact
:else nil)) blocked? :blocked
[blocked? contact-request-state]) :else nil))
on-start-chat (rn/use-callback #(rf/dispatch [:chat.ui/start-chat [blocked? contact-request-state])
public-key on-start-chat (rn/use-callback
ens-name]) #(rf/dispatch [:chat.ui/start-chat public-key ens-name])
[ens-name public-key]) [ens-name public-key])
on-unblock-press (rn/use-callback (fn [] on-unblock-press (rn/use-callback
(rf/dispatch [:contact/unblock-contact (fn []
public-key]) (rf/dispatch [:contact/unblock-contact
(rf/dispatch [:toasts/upsert public-key])
{:id :user-unblocked (rf/dispatch [:toasts/upsert
:type :positive {:id :user-unblocked
:text (i18n/label :t/user-unblocked :type :positive
{:username :text (i18n/label :t/user-unblocked
full-name})}])) {:username full-name})}]))
[public-key full-name])] [public-key full-name])]
[rn/view {:style style/header-container} [rn/view {:style style/header-container}
[rn/view {:style style/header-top-wrapper} [rn/view {:style style/header-top-wrapper}
[rn/view {:style style/avatar-wrapper} [rn/view {:style style/avatar-wrapper}
@ -93,14 +92,12 @@
(cond (cond
(and (not blocked?) (and (not blocked?)
(or (or (not contact-request-state)
(not contact-request-state) (= contact-request-state constants/contact-request-state-none)
(= contact-request-state constants/contact-request-state-none) (= contact-request-state constants/contact-request-state-dismissed)))
(= contact-request-state constants/contact-request-state-dismissed)))
[quo/button [quo/button
{:container-style style/button-wrapper {:container-style style/button-wrapper
:on-press on-contact-request :on-press on-send-contact-request
:customization-color customization-color :customization-color customization-color
:icon-left :i/add-user} :icon-left :i/add-user}
(i18n/label :t/send-contact-request)] (i18n/label :t/send-contact-request)]