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

Group details screen (3) #14494

Merged
merged 28 commits into from
Dec 23, 2022
Merged

Group details screen (3) #14494

merged 28 commits into from
Dec 23, 2022

Conversation

OmarBasem
Copy link
Contributor

Fixes #14475

This PR implements adding members and removing members from a group.

Designs: https://www.figma.com/file/7KIYbhoqNGAIFonE0w9TDz/Messages-for-Mobile?node-id=2105%3A522742&t=HU04xJbqoDL81ZPZ-0

@OmarBasem OmarBasem self-assigned this Dec 6, 2022
@OmarBasem OmarBasem changed the title Group details screen 3 Group details screen (3) Dec 6, 2022
@status-im-auto
Copy link
Member

status-im-auto commented Dec 6, 2022

Jenkins Builds

Click to see older builds (76)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 6391960 #1 2022-12-06 05:39:14 ~2 min tests 📄log
✔️ 6391960 #1 2022-12-06 05:45:45 ~8 min android 🤖apk 📲
✔️ 6391960 #1 2022-12-06 05:45:57 ~8 min android-e2e 🤖apk 📲
✔️ 6391960 #1 2022-12-06 05:51:48 ~14 min ios 📱ipa 📲
✔️ 94ed5a4 #2 2022-12-08 06:00:21 ~2 min tests 📄log
✔️ 94ed5a4 #2 2022-12-08 06:05:29 ~7 min android 🤖apk 📲
✔️ 94ed5a4 #2 2022-12-08 06:05:43 ~7 min android-e2e 🤖apk 📲
✔️ 94ed5a4 #2 2022-12-08 06:12:40 ~14 min ios 📱ipa 📲
78518d2 #3 2022-12-09 08:41:14 ~14 sec ios 📄log
78518d2 #3 2022-12-09 08:41:23 ~23 sec android-e2e 📄log
78518d2 #3 2022-12-09 08:41:25 ~25 sec tests 📄log
78518d2 #3 2022-12-09 08:41:27 ~27 sec android 📄log
✔️ b93699a #5 2022-12-09 08:45:50 ~2 min tests 📄log
✔️ b93699a #5 2022-12-09 08:51:09 ~7 min android-e2e 🤖apk 📲
✔️ b93699a #5 2022-12-09 08:51:50 ~8 min android 🤖apk 📲
✔️ b93699a #5 2022-12-09 08:55:57 ~12 min ios 📱ipa 📲
✔️ 4edef06 #6 2022-12-09 14:42:30 ~3 min tests 📄log
✔️ 4edef06 #6 2022-12-09 14:48:37 ~9 min android-e2e 🤖apk 📲
✔️ 4edef06 #6 2022-12-09 14:48:39 ~9 min android 🤖apk 📲
✔️ 4edef06 #6 2022-12-09 15:05:02 ~26 min ios 📱ipa 📲
014b4dc #7 2022-12-12 12:13:14 ~3 min tests 📄log
✔️ 014b4dc #7 2022-12-12 12:19:31 ~9 min android 🤖apk 📲
✔️ 014b4dc #7 2022-12-12 12:20:38 ~10 min android-e2e 🤖apk 📲
✔️ 014b4dc #7 2022-12-12 12:26:11 ~16 min ios 📱ipa 📲
✔️ dcd1998 #8 2022-12-13 03:40:07 ~1 min tests 📄log
✔️ dcd1998 #8 2022-12-13 03:46:34 ~7 min android 🤖apk 📲
✔️ dcd1998 #8 2022-12-13 03:48:37 ~9 min android-e2e 🤖apk 📲
✔️ dcd1998 #8 2022-12-13 03:53:41 ~14 min ios 📱ipa 📲
✔️ 2dee75b #9 2022-12-13 12:16:15 ~1 min tests 📄log
✔️ 2dee75b #9 2022-12-13 12:22:27 ~7 min android-e2e 🤖apk 📲
✔️ 2dee75b #9 2022-12-13 12:26:04 ~11 min android 🤖apk 📲
✔️ 2dee75b #9 2022-12-13 12:30:15 ~15 min ios 📱ipa 📲
✔️ a7e883d #10 2022-12-14 04:12:12 ~1 min tests 📄log
✔️ a7e883d #10 2022-12-14 04:18:21 ~7 min android 🤖apk 📲
✔️ a7e883d #10 2022-12-14 04:20:36 ~9 min android-e2e 🤖apk 📲
✔️ a7e883d #10 2022-12-14 04:25:51 ~14 min ios 📱ipa 📲
9d1e5f3 #11 2022-12-16 04:39:38 ~19 sec android 📄log
9d1e5f3 #11 2022-12-16 04:39:38 ~19 sec android-e2e 📄log
9d1e5f3 #11 2022-12-16 04:39:44 ~24 sec ios 📄log
9d1e5f3 #11 2022-12-16 04:39:45 ~25 sec tests 📄log
✔️ ced23fe #12 2022-12-16 04:51:13 ~1 min tests 📄log
✔️ ced23fe #12 2022-12-16 04:56:47 ~7 min android 🤖apk 📲
✔️ ced23fe #12 2022-12-16 04:58:44 ~9 min android-e2e 🤖apk 📲
✔️ ced23fe #12 2022-12-16 05:06:03 ~16 min ios 📱ipa 📲
✔️ babab2f #13 2022-12-16 12:33:19 ~1 min tests 📄log
✔️ babab2f #13 2022-12-16 12:38:57 ~7 min android 🤖apk 📲
✔️ babab2f #13 2022-12-16 12:39:14 ~7 min android-e2e 🤖apk 📲
✔️ babab2f #13 2022-12-16 12:52:37 ~21 min ios 📱ipa 📲
✔️ e0a0e1d #14 2022-12-19 10:52:05 ~2 min tests 📄log
✔️ e0a0e1d #14 2022-12-19 10:57:21 ~7 min android-e2e 🤖apk 📲
✔️ e0a0e1d #14 2022-12-19 10:57:51 ~8 min android 🤖apk 📲
✔️ e0a0e1d #14 2022-12-19 11:04:49 ~15 min ios 📱ipa 📲
✔️ 4ccd15b #17 2022-12-20 07:30:42 ~2 min tests 📄log
✔️ 4ccd15b #17 2022-12-20 07:36:00 ~7 min android-e2e 🤖apk 📲
✔️ 4ccd15b #17 2022-12-20 07:36:23 ~7 min android 🤖apk 📲
✔️ 4ccd15b #17 2022-12-20 07:44:09 ~15 min ios 📱ipa 📲
✔️ 68cd4c4 #18 2022-12-20 08:09:24 ~3 min tests 📄log
✔️ 68cd4c4 #18 2022-12-20 08:13:25 ~7 min android 🤖apk 📲
✔️ 68cd4c4 #18 2022-12-20 08:13:47 ~8 min android-e2e 🤖apk 📲
✔️ 68cd4c4 #18 2022-12-20 08:25:16 ~19 min ios 📱ipa 📲
✔️ af16124 #19 2022-12-20 10:46:46 ~4 min tests 📄log
✔️ af16124 #19 2022-12-20 10:50:13 ~7 min android-e2e 🤖apk 📲
✔️ af16124 #19 2022-12-20 10:51:48 ~9 min android 🤖apk 📲
✔️ af16124 #19 2022-12-20 10:57:53 ~15 min ios 📱ipa 📲
✔️ cd7bdbd #20 2022-12-21 03:52:15 ~1 min tests 📄log
✔️ cd7bdbd #20 2022-12-21 03:57:56 ~7 min android-e2e 🤖apk 📲
✔️ cd7bdbd #20 2022-12-21 03:59:43 ~9 min android 🤖apk 📲
✔️ cd7bdbd #20 2022-12-21 04:06:15 ~15 min ios 📱ipa 📲
✔️ 1338c62 #21 2022-12-22 05:07:25 ~1 min tests 📄log
✔️ 1338c62 #21 2022-12-22 05:13:13 ~7 min android-e2e 🤖apk 📲
✔️ 1338c62 #21 2022-12-22 05:14:17 ~8 min android 🤖apk 📲
✔️ 1338c62 #21 2022-12-22 05:21:32 ~16 min ios 📱ipa 📲
d0f4ad6 #22 2022-12-22 10:33:24 ~39 sec android 📄log
d0f4ad6 #22 2022-12-22 10:33:25 ~40 sec android-e2e 📄log
d0f4ad6 #22 2022-12-22 10:34:01 ~1 min tests 📄log
d0f4ad6 #22 2022-12-22 10:34:20 ~1 min ios 📄log
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ a32251b #23 2022-12-22 10:44:05 ~2 min tests 📄log
✔️ a32251b #23 2022-12-22 10:48:58 ~7 min android-e2e 🤖apk 📲
✔️ a32251b #23 2022-12-22 10:49:11 ~8 min android 🤖apk 📲
✔️ a32251b #23 2022-12-22 10:56:55 ~15 min ios 📱ipa 📲
✔️ bda770b #24 2022-12-23 03:11:34 ~2 min tests 📄log
✔️ bda770b #24 2022-12-23 03:17:03 ~7 min android 🤖apk 📲
✔️ bda770b #24 2022-12-23 03:17:12 ~7 min android-e2e 🤖apk 📲
✔️ bda770b #24 2022-12-23 03:31:27 ~21 min ios 📱ipa 📲

@@ -21,6 +21,6 @@
:align-items :center
:justify-content :center
:border-radius (/ container-size 2)
:background-color (colors/custom-color-by-theme color 50 60)}
:background-color (colors/custom-hex-color color 50 60)}
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 please elaborate?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

custom-color-by-theme is not working

Copy link
Member

Choose a reason for hiding this comment

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

Please, also check quo2 preview while modifying quo2 components. This change is breaking the component

Copy link
Contributor Author

@OmarBasem OmarBasem Dec 8, 2022

Choose a reason for hiding this comment

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

@Parveshdhull that's because quo2 preview is using color names, while actually the group color comes as a hex value

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we need to give the preview component a list of hex values?

Copy link
Member

Choose a reason for hiding this comment

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

yeah i think the problem here is that we store this value in db i guess, and it's just regular hex value, so it seems like we can't use custom-color-by-theme or if its not dynamic, like we have a set of colors, we could bind them, idk what's better , but for now the simplest solution is to change preview component with hex values and use colors/theme-alpha instead of creating new custom-hex-color function wdyt ?

Copy link
Member

@Parveshdhull Parveshdhull Dec 8, 2022

Choose a reason for hiding this comment

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

We are going to get rid of old colors and designs, So I would recommend we can check if provided color is a keyword or not. And if not fallback to :primary
(Not sure, but we probably not going to support group theme customization for MVP? cc: @pedro-et).

Also using stored value will not be helpful, because those colors might not work with the current app background colors per theme, and changing the group avatar to cover this case of hard-coded color instead of dynamic, might create an unwanted chain reaction (changes in other places)

Copy link
Contributor Author

@OmarBasem OmarBasem Dec 9, 2022

Choose a reason for hiding this comment

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

I do not think this is about group theme customization. The default group display photo is the group color. And I think it is always a hex value.

For now, I will provide some hex values for the Quo2 preview.


(defn remove-members [chat-id]
(doseq [member-key @removed]
(rf/dispatch [:group-chats.ui/remove-member-pressed chat-id member-key true])))
Copy link
Member

@flexsurfer flexsurfer Dec 6, 2022

Choose a reason for hiding this comment

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

better to have a new event for the list, and move removed atom to app-db

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Currently, there is no status-go endpoint to remove a list of users. Opened an issue in status-go and will update it once we have that endpoint.

Copy link
Member

Choose a reason for hiding this comment

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

i mean re-frame app-db

:search? true}]
[rn/view {:style style/bottom-container}
[quo2/button {:style {:flex 1}
:on-press #(rf/dispatch [:bottom-sheet/hide])
:disabled (zero? (count @added))}
:on-press #(do
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is a good example where fn is preferable to using the function literal #(). I scanned all the lines inside the function to see if it was using any parameter from the anonymous function. If you use (fn [] ...), it immediately tells devs there's no argument to worry about.

Another reason to avoid this is that we're trying to follow the Clojure Style Guide (not because it's the one correct way, but because it helps everyone stay on the same page). See the section https://guide.clojure.style/#no-multiple-forms-fn-literals

Copy link
Contributor Author

@OmarBasem OmarBasem Dec 8, 2022

Choose a reason for hiding this comment

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

Thanks for the explanation!

90 "E6"
"FF"))

(defn custom-hex-color [color light-opacity dark-opacity]
Copy link
Contributor

Choose a reason for hiding this comment

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

Why can't we just use the custom-color-by-theme function? It seems to support different opacity levels based on the theme, which seems to be what you need, or not?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

custom-color-by-theme is not working, not sure why

Copy link
Member

Choose a reason for hiding this comment

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

lets find out why it doesn't work, cc @Parveshdhull

Copy link
Member

Choose a reason for hiding this comment

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

Hi @OmarBasem,
As I can see custom-color-by-theme is not working for you for group avatars, https://github.com/status-im/status-mobile/pull/14494/files#r1041791605

  1. 50, 60 are color variants, not opacity
    image
  2. You need to provide color as :purple instead of hex value, then we will be able to find its appropriate variant, like :purple-50, :purple-60

Copy link
Contributor Author

@OmarBasem OmarBasem Dec 8, 2022

Choose a reason for hiding this comment

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

Hi @Parveshdhull, How can I do that? The value comes as hex value

Copy link
Contributor

@ilmotta ilmotta Dec 13, 2022

Choose a reason for hiding this comment

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

@OmarBasem, are we going to be able to get rid of this new function or do you really need it? This is the only thing holding me from approving the PR, but if you think there's no way around this, I'm fine. If nothing else works, it would be nice to have a TODO(OmarBasem) saying something like "custom-hex-color could be removed if XYZ is done".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ilmotta I have added a todo: "custom-color-by-theme supports only string colors, so maybe we can get rid of it."

Copy link
Member

Choose a reason for hiding this comment

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

please use theme-alpha instead of creating new functions

@qoqobolo
Copy link
Contributor

qoqobolo commented Dec 7, 2022

Hey @OmarBasem , thank you for continuing to work on this feature!
Quick reminder: please add the request-manual-qa label once the PR is ready to be tested (if needed ofc).
Thanks!

@OmarBasem
Copy link
Contributor Author

Hey @OmarBasem , thank you for continuing to work on this feature! Quick reminder: please add the request-manual-qa label once the PR is ready to be tested (if needed ofc). Thanks!

Sure @qoqobolo, thank you!

(map #(first (groups %)) (distinct (map f coll)))))

(re-frame/reg-sub
:contacts/add-members-sections
Copy link
Contributor

Choose a reason for hiding this comment

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

@OmarBasem, could you add some tests to this subscription? This is considered a layer-3 sub, we should test them, especially a non-trivial like this one. I've recently merged a PR showing how to do it, it's almost as simple as testing any other pure function.

Test examples for layer-3 subs:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure @ilmotta, thank you!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ilmotta I am currently unable to make the test pass successfully. I do not want to spend more time on this right now, so I have opened an issue for it (#14531) and will get back to it later (if you don't mind).

Copy link
Contributor

Choose a reason for hiding this comment

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

It's challenging I know, not the simplest of the tests to start, given its stateful nature. Thanks for trying, perhaps let's pair program on that new issue next week.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @ilmotta, we can try again with it sometime next week.

@OmarBasem OmarBasem merged commit e21b8d4 into develop Dec 23, 2022
@OmarBasem OmarBasem deleted the group-details-screen-3 branch December 23, 2022 03:18
@flexsurfer
Copy link
Member

@OmarBasem it seems like you reverted a few files in this PR

flexsurfer added a commit that referenced this pull request Dec 23, 2022
@flexsurfer
Copy link
Member

@OmarBasem I've reverted the commit, could you please open a new PR and fix reverted files , thanks

@OmarBasem
Copy link
Contributor Author

@flexsurfer sure!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Group Details Screen (3)
10 participants