Skip to content

Commit

Permalink
Merge branch 'develop' into reg-event-fx-update
Browse files Browse the repository at this point in the history
  • Loading branch information
alwx committed Apr 19, 2024
2 parents c54f291 + 8353c65 commit cce91ab
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,9 @@
online? (rf/sub [:visibility-status-updates/online? chat-id])
contact (when-not group-chat
(rf/sub [:contacts/contact-by-address chat-id]))
photo-path (rf/sub [:chats/photo-path chat-id])
photo-path (if group-chat
(rf/sub [:chats/group-chat-image chat-id])
(rf/sub [:chats/photo-path chat-id]))
top-margin (+ (safe-area/get-top)
messages.constants/top-bar-height
messages.constants/header-container-top-margin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
(str "# " chat-name)
:else (str emoji chat-name))
online? (when-not group-chat (rf/sub [:visibility-status-updates/online? chat-id]))
photo-path (when-not group-chat (rf/sub [:chats/photo-path chat-id]))
photo-path (if group-chat
(rf/sub [:chats/group-chat-image chat-id])
(rf/sub [:chats/photo-path chat-id]))
header-opacity (worklets/navigation-header-opacity
distance-from-list-top
all-loaded?
Expand Down
7 changes: 7 additions & 0 deletions src/status_im/subs/chats.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -367,3 +367,10 @@
:camera-roll/total-photos-count-ios
(fn [{:keys [camera-roll/ios-images-count]}]
ios-images-count))

(re-frame/reg-sub
:chats/group-chat-image
(fn [[_ chat-id]]
(re-frame/subscribe [:chats/chat chat-id]))
:->
:image)
15 changes: 15 additions & 0 deletions src/status_im/subs/chats_test.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,18 @@
(is (= :army (:color result)))
(is (= "test" (:chat-name result)))
(is (= "🍑" (:emoji result)))))))

(h/deftest-sub :chats/group-chat-image
[sub-name]
(testing "returns picture for group"
(let [image-data {:uri "data:image/png1234"}
chats {chat-id (assoc community-chat
:color :army
:emoji "🍑"
:chat-name "test"
:image image-data)}]
(swap! rf-db/app-db assoc
:chats
chats)
(let [result (rf/sub [sub-name chat-id])]
(= image-data result)))))

0 comments on commit cce91ab

Please sign in to comment.