Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement navigation to profiles and chats from contact requests inside Activity Center #19902

Merged
merged 1 commit into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,17 @@
(defn user-avatar-tag
[user-id]
(let [profile (rf/sub [:contacts/contact-by-identity user-id])]
[quo/context-tag
{:blur? true
:size 24
:full-name (profile.utils/displayed-name profile)
:profile-picture (profile.utils/photo profile)}]))
[rn/view
{:on-start-should-set-responder
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you pls elaboeate on how on-start-should-set-responder works here? thanks

Copy link
Member Author

@Parveshdhull Parveshdhull May 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi @flexsurfer, Thank you very much for reviewing PR.

We have the whole activity log as pressable for accepted requests, but when context-tag is pressed we only want that to call an on-press event and avoid propagation to parent pressable.

I picked this solution from the stackoverflow answer, apparently adding onStartShouldSetResponder and returning true is enough for our situation to make it work.

(fn [_event]
(rf/dispatch [:navigate-back])
(rf/dispatch [:chat.ui/show-profile user-id])
true)}
[quo/context-tag
{:blur? true
:size 24
:full-name (profile.utils/displayed-name profile)
:profile-picture (profile.utils/photo profile)}]]))

(defn- render-swipe-action
[{:keys [active-swipeable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(ns status-im.contexts.shell.activity-center.notification.contact-requests.view
(:require
[quo.core :as quo]
[react-native.gesture :as gesture]
[react-native.core :as rn]
[status-im.constants :as constants]
[status-im.contexts.shell.activity-center.notification.common.style :as common-style]
[status-im.contexts.shell.activity-center.notification.common.view :as common]
Expand Down Expand Up @@ -162,10 +162,8 @@
[outgoing-contact-request-view props app-theme]

(= contact-request-state constants/contact-request-message-state-accepted)
[gesture/touchable-without-feedback
{:on-press (fn []
(rf/dispatch [:hide-popover])
(rf/dispatch [:chat.ui/start-chat author]))}
[rn/pressable
{:on-press #(rf/dispatch [:chat.ui/start-chat author])}
[incoming-contact-request-view props app-theme]]

:else
Expand Down