File tree 6 files changed +37
-13
lines changed
messenger/messages/contact_requests/bottom_drawer
6 files changed +37
-13
lines changed Original file line number Diff line number Diff line change 5
5
[react-native.core :as rn]
6
6
[reagent.core :as reagent]
7
7
[status-im.common.confirmation-drawer.style :as style]
8
+ [status-im.constants :as constants]
8
9
[utils.i18n :as i18n]
9
10
[utils.re-frame :as rf]))
10
11
35
36
close-button-text]}]
36
37
(let [extra-action-selected? (reagent/atom false )]
37
38
(fn []
38
- (let [{:keys [group-chat chat-id public-key color
39
+ (let [{:keys [group-chat chat-id public-key color chat-type
39
40
profile-picture name]} context
40
41
id (or chat-id public-key)
41
42
theme (quo.theme/use-theme )
42
- [primary-name _] (when-not group-chat
43
+ [primary-name _] (when-not (or group-chat
44
+ (= chat-type constants/public-chat-type))
43
45
(rf/sub [:contacts/contact-two-names-by-identity id]))
44
46
display-name (cond
45
47
(= primary-name " Unknown" )
Original file line number Diff line number Diff line change 398
398
:chevron? false }))
399
399
400
400
(defn destructive-actions
401
- [{:keys [group-chat] :as item} inside-chat?]
401
+ [{:keys [group-chat chat-type ] :as item} inside-chat?]
402
402
[(when (not group-chat)
403
- (close-chat-entry item inside-chat? (not group-chat)))
404
- (clear-history-entry item group-chat)
403
+ (close-chat-entry item inside-chat? (not= chat-type constants/public-chat-type)))
404
+ (when-not (= chat-type constants/public-chat-type)
405
+ (clear-history-entry item group-chat))
405
406
(when group-chat
406
407
(leave-group-entry item nil ))])
407
408
438
439
(notification-actions item inside-chat? true )
439
440
(destructive-actions item inside-chat?)]])
440
441
442
+ (defn public-chat-actions
443
+ [item inside-chat?]
444
+ [quo/action-drawer
445
+ [(destructive-actions item inside-chat?)]])
446
+
441
447
(defn private-group-chat-actions
442
448
[item inside-chat?]
443
449
[quo/action-drawer
473
479
[one-to-one-actions chat inside-chat?]
474
480
constants/private-group-chat-type
475
481
[private-group-chat-actions chat inside-chat?]
482
+ constants/public-chat-type
483
+ [public-chat-actions chat inside-chat?]
476
484
constants/community-chat-type
477
485
[communities-chat-actions/actions chat inside-chat? hide-show-members?]
478
486
nil ))
Original file line number Diff line number Diff line change 33
33
(multi-user-chat? (get-chat cofx chat-id))))
34
34
35
35
(defn public-chat?
36
- ([chat]
37
- (:public? chat))
36
+ ([{ :keys [ chat-type]} ]
37
+ (= chat-type constants/public-chat-type ))
38
38
([cofx chat-id]
39
39
(public-chat? (get-chat cofx chat-id))))
40
40
52
52
(defn group-chat?
53
53
([chat]
54
54
(and (multi-user-chat? chat)
55
- (not (public-chat ? chat))))
55
+ (not (: public? chat))))
56
56
([cofx chat-id]
57
57
(group-chat? (get-chat cofx chat-id))))
58
58
Original file line number Diff line number Diff line change 237
237
238
238
(defn chat-item
239
239
[{:keys [chat-id group-chat color name last-message timestamp muted image
240
- unviewed-messages-count]
240
+ chat-type unviewed-messages-count]
241
241
:as item}]
242
242
(let [[primary-name secondary-name]
243
- (if group-chat
243
+ (cond
244
+ group-chat
244
245
[name " " ]
246
+
247
+ (= chat-type constants/public-chat-type)
248
+ [(str " #" name) " " ]
249
+
250
+ :else
245
251
(rf/sub [:contacts/contact-two-names-by-identity chat-id]))
246
252
{:keys [ens-verified added?] :as contact} (when-not group-chat
247
253
(rf/sub [:contacts/contact-by-address chat-id]))
Original file line number Diff line number Diff line change 12
12
(defn view
13
13
[{:keys [contact-id]}]
14
14
(let [customization-color (rf/sub [:profile/customization-color ])
15
- [primary-name _] (rf/sub [:contacts/contact-two-names-by-identity contact-id])
16
15
{:keys [contact-request-state
17
- community-id]} (rf/sub [:chats/current-chat-chat-view ])
16
+ community-id
17
+ chat-name]} (rf/sub [:chats/current-chat-chat-view ])
18
18
chat-type (rf/sub [:chats/chat-type ])
19
+ [primary-name _] (if (= chat-type :public-chat )
20
+ [(str " #" chat-name) " " ]
21
+ (rf/sub [:contacts/contact-two-names-by-identity contact-id]))
19
22
community-chat? (= chat-type :community-chat )
20
23
joined (when community-chat?
21
24
(rf/sub [:communities/community-joined community-id]))
Original file line number Diff line number Diff line change 125
125
:<- [:contacts/blocked-set ]
126
126
:<- [:contacts/contacts-raw ]
127
127
:<- [:chat/inputs ]
128
- (fn [[{:keys [group-chat chat-id] :as current-chat} my-public-key community blocked-users-set contacts
128
+ (fn [[{:keys [group-chat chat-id chat-name name] :as current-chat} my-public-key community
129
+ blocked-users-set contacts
129
130
inputs]]
130
131
(when current-chat
131
132
(cond-> current-chat
140
141
(assoc :able-to-send-message? true
141
142
:member? true )
142
143
144
+ (not chat-name)
145
+ (assoc :chat-name name)
146
+
143
147
(not group-chat)
144
148
(assoc
145
149
:contact-request-state (get-in contacts [chat-id :contact-request-state ])
164
168
(condp apply [current-chat]
165
169
chat.events/community-chat? :community-chat
166
170
chat.events/group-chat? :group-chat
171
+ chat.events/public-chat? :public-chat
167
172
:chat )))
168
173
169
174
(re-frame/reg-sub
You can’t perform that action at this time.
0 commit comments