Skip to content

Commit

Permalink
feat: support new avatar in old contact list
Browse files Browse the repository at this point in the history
  • Loading branch information
yqrashawn committed Jun 12, 2023
1 parent 1e11373 commit 4cd0a68
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 8 deletions.
23 changes: 20 additions & 3 deletions src/status_im/ui/components/chat_icon/screen.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
(:require [clojure.string :as string]
[quo.design-system.colors :as colors]
[quo.react-native :as rn]
[quo2.components.avatars.user-avatar.style :as user-avatar.style]
[quo2.core :as quo]
[re-frame.core :as re-frame.core]
[status-im.multiaccounts.core :as multiaccounts]
Expand Down Expand Up @@ -47,19 +48,35 @@
[rn/text {:style (:default-chat-icon-text styles)} emoji]]))

(defn profile-photo-plus-dot-view
[{:keys [public-key photo-container photo-path community?]}]
[{:keys [public-key customization-color photo-container photo-path community?]}]
(let [photo-container (if (nil? photo-container)
styles/container-chat-list
photo-container)
size (:width photo-container)
dot-styles (visibility-status-utils/icon-visibility-status-dot
public-key
size)
dot-accessibility-label (:accessibility-label dot-styles)]
dot-accessibility-label (:accessibility-label dot-styles)
text-style (styles/default-chat-icon-text size)]
[rn/view
{:style photo-container
:accessibility-label :profile-photo}
[photos/photo photo-path {:size size}]
(if (:fn photo-path)
;; temp support new media server avatar for old component
[photos/photo
{:uri ((:fn photo-path)
{:size size
:full-name name
:font-size (get text-style :font-size)
:background-color (user-avatar.style/customization-color customization-color)
:indicator-size 0
:indicator-border 0
:indicator-color "#000000"
:color (get text-style :color)
:length 2
:ring? true})}
{:size size}]
[photos/photo photo-path {:size size}])
(when-not community?
[rn/view
{:style dot-styles
Expand Down
11 changes: 6 additions & 5 deletions src/status_im/ui/screens/contacts_list/views.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,24 @@
(:require [quo.core :as quo]
[quo.design-system.colors :as colors]
[re-frame.core :as re-frame]
[utils.i18n :as i18n]
[status-im.multiaccounts.core :as multiaccounts]
[status-im.ui.components.chat-icon.screen :as chat-icon.screen]
[status-im.ui.components.invite.views :as invite]
[status-im.ui.components.list.views :as list.views]
[status-im.ui.components.react :as react])
[status-im.ui.components.react :as react]
[utils.i18n :as i18n])
(:require-macros [status-im.utils.views :refer [defview letsubs]]))

(defn contacts-list-item
[{:keys [public-key] :as contact}]
(let [{:keys [primary-name secondary-name]} contact]
(let [{:keys [primary-name secondary-name customization-color]} contact]
[quo/list-item
{:title primary-name
:subtitle secondary-name
:icon [chat-icon.screen/profile-photo-plus-dot-view
{:public-key public-key
:photo-path (multiaccounts/displayed-photo contact)}]
{:public-key public-key
:customization-color (or customization-color :primary)
:photo-path (multiaccounts/displayed-photo contact)}]
:chevron true
:on-press #(re-frame/dispatch [:chat.ui/show-profile public-key])}]))

Expand Down

0 comments on commit 4cd0a68

Please sign in to comment.