Change accessibility label as per online status (#12846)

This commit is contained in:
Parvesh Monu 2021-11-25 18:07:47 +05:30 committed by GitHub
parent ae26024890
commit b4b39e5088
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 14 deletions

View File

@ -46,21 +46,22 @@
(defn profile-photo-plus-dot-view (defn profile-photo-plus-dot-view
[{:keys [public-key photo-container photo-path community?]}] [{:keys [public-key photo-container photo-path community?]}]
(let [photo-path (if (nil? photo-path) (let [photo-path (if (nil? photo-path)
@(re-frame.core/subscribe [:chats/photo-path public-key]) @(re-frame.core/subscribe [:chats/photo-path public-key])
photo-path) photo-path)
photo-container (if (nil? photo-container) photo-container (if (nil? photo-container)
styles/container-chat-list photo-container) styles/container-chat-list photo-container)
size (:width photo-container) size (:width photo-container)
identicon? (when photo-path (profile.db/base64-png? photo-path)) identicon? (when photo-path (profile.db/base64-png? photo-path))
dot-styles (visibility-status-utils/icon-visibility-status-dot dot-styles (visibility-status-utils/icon-visibility-status-dot
public-key size identicon?)] public-key size identicon?)
dot-accessibility-label (:accessibility-label dot-styles)]
[react/view {:style photo-container [react/view {:style photo-container
:accessibility-label :profile-photo} :accessibility-label :profile-photo}
[photos/photo photo-path {:size size}] [photos/photo photo-path {:size size}]
(when-not community? (when-not community?
[react/view {:style dot-styles [react/view {:style dot-styles
:accessibility-label :profile-photo-dot}])])) :accessibility-label dot-accessibility-label}])]))
(defn emoji-chat-icon-view (defn emoji-chat-icon-view
[chat-id group-chat name emoji styles] [chat-id group-chat name emoji styles]

View File

@ -82,11 +82,15 @@
visibility-status-update (visibility-status-update public-key my-icon?) visibility-status-update (visibility-status-update public-key my-icon?)
size (/ container-size 4) size (/ container-size 4)
margin (if identicon? (/ size 6) (/ size 7)) margin (if identicon? (/ size 6) (/ size 7))
dot-color (dot-color visibility-status-update my-icon?)] dot-color (dot-color visibility-status-update my-icon?)
accessibility-label (if (= dot-color colors/color-online)
:online-profile-photo-dot
:offline-profile-photo-dot)]
(merge (styles/visibility-status-dot dot-color size) (merge (styles/visibility-status-dot dot-color size)
{:bottom margin {:bottom margin
:right margin :right margin
:position :absolute}))) :position :absolute
:accessibility-label accessibility-label})))
(defn visibility-status-order [public-key] (defn visibility-status-order [public-key]
(let [my-icon? (my-icon? public-key) (let [my-icon? (my-icon? public-key)