Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
37b98c0cd9 | ||
|
|
48568c6031 |
@@ -1,10 +0,0 @@
|
||||
(ns legacy.status-im.subs.ens
|
||||
(:require
|
||||
[re-frame.core :as re-frame]))
|
||||
|
||||
(re-frame/reg-sub
|
||||
:ens/current-names
|
||||
:<- [:ens/names]
|
||||
:<- [:chain-id]
|
||||
(fn [[all-names chain-id]]
|
||||
(get all-names chain-id)))
|
||||
@@ -1,7 +1,6 @@
|
||||
(ns legacy.status-im.subs.root
|
||||
(:require
|
||||
legacy.status-im.subs.browser
|
||||
legacy.status-im.subs.ens
|
||||
legacy.status-im.subs.mailservers
|
||||
[re-frame.core :as re-frame]))
|
||||
|
||||
|
||||
@@ -10,8 +10,7 @@
|
||||
[quo.theme]
|
||||
[re-frame.core :as re-frame.core]
|
||||
[react-native.core :as rn]
|
||||
[status-im.contexts.profile.utils :as profile.utils]
|
||||
[utils.ens.core :as utils.ens]))
|
||||
[status-im.contexts.profile.utils :as profile.utils]))
|
||||
|
||||
;;TODO REWORK THIS NAMESPACE
|
||||
|
||||
@@ -62,9 +61,7 @@
|
||||
:indicator-border 0
|
||||
:indicator-color "#000000"
|
||||
:color (get text-style :color)
|
||||
:length 2
|
||||
:ring? (not (utils.ens/is-valid-eth-name? full-name))
|
||||
:ring-width 2})}
|
||||
:length 2})}
|
||||
{:size size}]
|
||||
[photos/photo photo-path {:size size}])
|
||||
(when-not community?
|
||||
@@ -101,5 +98,3 @@
|
||||
:chat-icon (styles/custom-size-icon size)
|
||||
:default-chat-icon (styles/default-chat-icon-profile colors/default-chat-color size)
|
||||
:default-chat-icon-text (styles/default-chat-icon-text size)}])
|
||||
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
[:static? {:optional true} [:maybe boolean?]]
|
||||
[:status-indicator? {:optional true} [:maybe boolean?]]
|
||||
[:online? {:optional true} [:maybe boolean?]]
|
||||
[:ring? {:optional true} [:maybe boolean?]]
|
||||
[:profile-picture
|
||||
{:optional true}
|
||||
[:maybe :schema.quo/profile-picture-source]]]]]
|
||||
|
||||
@@ -7,50 +7,42 @@
|
||||
:status-indicator 12
|
||||
:status-indicator-border 4
|
||||
:status-indicator-center-to-edge 12
|
||||
:font-size :heading-1
|
||||
:ring-width 4}
|
||||
:font-size :heading-1}
|
||||
:size-64 {:dimensions 64
|
||||
:status-indicator 8
|
||||
:status-indicator-border 2
|
||||
:status-indicator-center-to-edge 6
|
||||
:font-size :heading-1
|
||||
:ring-width 2}
|
||||
:font-size :heading-1}
|
||||
:medium {:dimensions 48
|
||||
:status-indicator 8
|
||||
:status-indicator-border 2
|
||||
:status-indicator-center-to-edge 6
|
||||
:font-size :heading-2
|
||||
:ring-width 2}
|
||||
:font-size :heading-2}
|
||||
:small {:dimensions 32
|
||||
:status-indicator 8
|
||||
:status-indicator-border 2
|
||||
:status-indicator-center-to-edge 4
|
||||
:font-size :paragraph-2
|
||||
:ring-width 2}
|
||||
:font-size :paragraph-2}
|
||||
28 {:dimensions 28
|
||||
:status-indicator 0
|
||||
:status-indicator-border 0
|
||||
:status-indicator-center-to-edge 0
|
||||
:font-size :paragraph-2
|
||||
:ring-width 0}
|
||||
:font-size :paragraph-2}
|
||||
:xs {:dimensions 24
|
||||
:status-indicator 0
|
||||
:status-indicator-border 0
|
||||
:status-indicator-center-to-edge 0
|
||||
:font-size :paragraph-2
|
||||
:ring-width 2}
|
||||
:font-size :paragraph-2}
|
||||
:xxs {:dimensions 20
|
||||
:status-indicator 0
|
||||
:status-indicator-border 0
|
||||
:status-indicator-center-to-edge 0
|
||||
:font-size :label
|
||||
:ring-width 2}
|
||||
:font-size :label}
|
||||
:xxxs {:dimensions 16
|
||||
:status-indicator 0
|
||||
:status-indicator-border 0
|
||||
:status-indicator-center-to-edge 0
|
||||
:font-size :label
|
||||
:ring-width 2}})
|
||||
:font-size :label}})
|
||||
|
||||
(defn initials-avatar
|
||||
[size customization-color theme]
|
||||
|
||||
@@ -27,17 +27,11 @@
|
||||
(utils.string/get-initials full-name amount-initials)]]))
|
||||
|
||||
(defn user-avatar-internal
|
||||
"Render user avatar with `profile-picture`
|
||||
|
||||
WARNING:
|
||||
When calling the `profile-picture-fn` and passing the `:ring?` key, be aware that the `profile-picture-fn`
|
||||
may have an `:override-ring?` value. If it does then the `:ring?` value will not be used.
|
||||
For reference, refer to the `utils.image-server` namespace for these `profile-picture-fn` are generated."
|
||||
[{:keys [full-name size profile-picture static? status-indicator? online? ring?]
|
||||
"Render user avatar with `profile-picture`."
|
||||
[{:keys [full-name size profile-picture static? status-indicator? online?]
|
||||
:or {size :big
|
||||
status-indicator? true
|
||||
online? true
|
||||
ring? true}
|
||||
online? true}
|
||||
:as props}]
|
||||
(let [theme (quo.theme/use-theme)
|
||||
picture-config (:config profile-picture)
|
||||
@@ -80,9 +74,7 @@
|
||||
:indicator-color indicator-color
|
||||
:theme theme
|
||||
:color (:color style/initials-avatar-text)
|
||||
:size (:width outer-styles)
|
||||
:ring? ring?
|
||||
:ring-width (:ring-width sizes)})}
|
||||
:size (:width outer-styles)})}
|
||||
(:uri profile-picture)
|
||||
profile-picture
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
(case type
|
||||
:user [user-avatar/user-avatar
|
||||
(assoc item
|
||||
:ring? false
|
||||
:status-indicator? false
|
||||
:size user-avatar-size)]
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
{:size :xxxs
|
||||
:full-name display-name
|
||||
:profile-picture photo-path
|
||||
:ring? false
|
||||
:status-indicator? false}]])
|
||||
|
||||
(defn split-text
|
||||
|
||||
@@ -81,7 +81,6 @@
|
||||
:accessibility-label :open-profile}
|
||||
[user-avatar/user-avatar
|
||||
(merge {:status-indicator? true
|
||||
:ring? true
|
||||
:customization-color customization-color
|
||||
:size :small}
|
||||
avatar-props)]])
|
||||
@@ -136,7 +135,7 @@
|
||||
:qr-code-on-press callback
|
||||
:notification-count number
|
||||
:max-unread-notifications used to specify max number for counter
|
||||
:right-section-content
|
||||
:right-section-content
|
||||
"
|
||||
[{:keys [avatar-on-press avatar-props customization-color container-style] :as props}]
|
||||
[rn/view {:style (merge style/top-nav-container container-style)}
|
||||
|
||||
@@ -23,8 +23,7 @@
|
||||
(assoc props
|
||||
:size :size-64
|
||||
:status-indicator? false
|
||||
:online? false
|
||||
:ring? false)]
|
||||
:online? false)]
|
||||
|
||||
:wallet-account
|
||||
[account-avatar/view (assoc props :size :size-64 :type :default)]
|
||||
|
||||
@@ -114,7 +114,6 @@
|
||||
:profile-picture profile-picture
|
||||
:size (if (= size 24) :xxs 28)
|
||||
:status-indicator? false
|
||||
:ring? false
|
||||
:customization-color customization-color}]]
|
||||
|
||||
:multiuser
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
(case type
|
||||
:default-keypair [user-avatar/user-avatar
|
||||
{:size :xxs
|
||||
:ring? false
|
||||
:customization-color customization-color
|
||||
:profile-picture profile-picture}]
|
||||
:recovery-phrase [icons/icon
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
(if (= avatar-type :default-keypair)
|
||||
[user-avatar/user-avatar
|
||||
{:full-name full-name
|
||||
:ring? true
|
||||
:size :small
|
||||
:status-indicator? false
|
||||
:customization-color customization-color
|
||||
|
||||
+4
-9
@@ -15,9 +15,7 @@
|
||||
[:indicator-center-to-edge {:optional true} [:maybe :int]]
|
||||
[:theme :schema.common/theme]
|
||||
[:color :string]
|
||||
[:size :int]
|
||||
[:ring? :boolean]
|
||||
[:ring-width :int]])
|
||||
[:size :int]])
|
||||
|
||||
(def ^:private ?account-image-uri-options
|
||||
[:map
|
||||
@@ -25,8 +23,7 @@
|
||||
[:ratio :double]
|
||||
[:key-uid :string]
|
||||
[:image-name :string]
|
||||
[:theme :schema.common/theme]
|
||||
[:override-ring? [:maybe :boolean]]])
|
||||
[:theme :schema.common/theme]])
|
||||
|
||||
(def ^:private ?initials-image-uri-options
|
||||
[:map
|
||||
@@ -37,8 +34,7 @@
|
||||
[:theme :schema.common/theme]
|
||||
[:customization-color ?customization-color]
|
||||
[:key-uid {:optional true} [:maybe :string]]
|
||||
[:public-key {:optional true} [:maybe :string]]
|
||||
[:override-ring? {:optional true} [:maybe :boolean]]])
|
||||
[:public-key {:optional true} [:maybe :string]]])
|
||||
|
||||
(def ^:private ?contact-image-uri-options
|
||||
[:map
|
||||
@@ -47,8 +43,7 @@
|
||||
[:ratio :double]
|
||||
[:image-name :string]
|
||||
[:public-key :string]
|
||||
[:theme :schema.common/theme]
|
||||
[:override-ring? [:maybe :boolean]]])
|
||||
[:theme :schema.common/theme]])
|
||||
|
||||
(def ^:private ?image-uri-config
|
||||
[:multi {:dispatch :type}
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
{:full-name display-name
|
||||
:profile-picture photo-path
|
||||
:size :xxs
|
||||
:ring? false
|
||||
:status-indicator? false}]))
|
||||
|
||||
(defn extra-action-view
|
||||
|
||||
@@ -15,6 +15,5 @@
|
||||
:online? online?
|
||||
:profile-picture profile-picture
|
||||
:status-indicator? true
|
||||
:ring? true
|
||||
:customization-color customization-color
|
||||
:size :big}]]))
|
||||
|
||||
@@ -177,18 +177,16 @@
|
||||
preview-text]))
|
||||
|
||||
(defn avatar-view
|
||||
[{:keys [contact chat-id full-name color muted? image]}]
|
||||
[{:keys [contact chat-id full-name color image]}]
|
||||
[rn/view {:style {:justify-content :center}}
|
||||
(if contact ; `contact` is passed when it's not a group chat
|
||||
(let [online? (rf/sub [:visibility-status-updates/online? chat-id])
|
||||
photo-path (rf/sub [:chats/photo-path chat-id])]
|
||||
[quo/user-avatar
|
||||
(cond-> {:full-name full-name
|
||||
:size :small
|
||||
:online? online?
|
||||
:profile-picture photo-path}
|
||||
muted?
|
||||
(assoc :ring? false))])
|
||||
{:full-name full-name
|
||||
:size :small
|
||||
:online? online?
|
||||
:profile-picture photo-path}])
|
||||
[quo/group-avatar
|
||||
{:customization-color color
|
||||
:picture (when image {:uri image})
|
||||
@@ -258,7 +256,6 @@
|
||||
:chat-id chat-id
|
||||
:full-name primary-name
|
||||
:color color
|
||||
:muted? muted
|
||||
:image image}]
|
||||
[rn/view {:style {:flex-shrink 1}}
|
||||
[rn/view {:style style/chat-data-container}
|
||||
|
||||
@@ -87,8 +87,7 @@
|
||||
primary-name)
|
||||
:profile-picture (or user-avatar photo-path)
|
||||
:status-indicator? false
|
||||
:size :xxxs
|
||||
:ring? false}]
|
||||
:size :xxxs}]
|
||||
[quo/text
|
||||
{:weight :semi-bold
|
||||
:size (if pin? :label :paragraph-2)
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
(defn avatar
|
||||
[{:keys [public-key size hide-ring?]}]
|
||||
[{:keys [public-key size]}]
|
||||
(let [[primary-name _] (rf/sub [:contacts/contact-two-names-by-identity public-key])
|
||||
photo-path (rf/sub [:chats/photo-path public-key])
|
||||
online? (rf/sub [:visibility-status-updates/online? public-key])]
|
||||
@@ -15,7 +15,6 @@
|
||||
:on-press #(rf/dispatch [:chat.ui/show-profile public-key])}
|
||||
[quo/user-avatar
|
||||
{:full-name primary-name
|
||||
:ring? (not hide-ring?)
|
||||
:profile-picture photo-path
|
||||
:online? online?
|
||||
:size size}]]]))
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
{:full-name display-name
|
||||
:profile-picture profile-picture
|
||||
:status-indicator? false
|
||||
:ring? false
|
||||
:size :xxxs}]]
|
||||
[quo/text
|
||||
{:weight :semi-bold
|
||||
|
||||
@@ -44,14 +44,13 @@
|
||||
|
||||
(defn avatar-container
|
||||
[{:keys [content last-in-group? pinned-by quoted-message from bridge-message]}
|
||||
hide-reactions? in-reaction-or-action-menu? show-user-info? in-pinned-view?]
|
||||
hide-reactions? in-reaction-or-action-menu? show-user-info?]
|
||||
(cond
|
||||
(:user-avatar bridge-message)
|
||||
[fast-image/fast-image
|
||||
{:source {:uri (:user-avatar bridge-message)}
|
||||
:fallback-content [quo/user-avatar
|
||||
{:full-name (bridge-message-user-name (:user-name bridge-message))
|
||||
:ring? false
|
||||
:online? false
|
||||
:status-indicator? false
|
||||
:size :small}]
|
||||
@@ -69,8 +68,7 @@
|
||||
in-reaction-or-action-menu?)
|
||||
[avatar/avatar
|
||||
{:public-key from
|
||||
:size :small
|
||||
:hide-ring? (or in-pinned-view? in-reaction-or-action-menu?)}]
|
||||
:size :small}]
|
||||
|
||||
:else
|
||||
[rn/view {:padding-top 4 :width 32}]))
|
||||
@@ -135,14 +133,12 @@
|
||||
{:full-name primary-name
|
||||
:profile-picture photo-path
|
||||
:status-indicator? false
|
||||
:size :xxxs
|
||||
:ring? false}]
|
||||
:size :xxxs}]
|
||||
[quo/text
|
||||
{:weight :semi-bold
|
||||
:style {:margin-left 4}}
|
||||
primary-name]]))
|
||||
|
||||
|
||||
(defn resolve-group-system-message
|
||||
[{:keys [children]}]
|
||||
(reduce (fn [acc {:keys [type literal]}]
|
||||
@@ -285,8 +281,7 @@
|
||||
[rn/view
|
||||
{:style {:padding-horizontal 4
|
||||
:flex-direction :row}}
|
||||
[avatar-container message-data hide-reactions? in-reaction-or-action-menu? show-user-info?
|
||||
(:in-pinned-view? context)]
|
||||
[avatar-container message-data hide-reactions? in-reaction-or-action-menu? show-user-info?]
|
||||
(into
|
||||
(if hide-reactions?
|
||||
[gesture/scroll-view]
|
||||
|
||||
@@ -20,9 +20,6 @@
|
||||
:type :boolean}
|
||||
{:key :status-indicator?
|
||||
:type :boolean}
|
||||
{:label "Identicon Ring (applies only when there's no profile picture)"
|
||||
:key :ring?
|
||||
:type :boolean}
|
||||
{:key :full-name
|
||||
:type :text}
|
||||
{:key :profile-picture
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
:profile-picture profile-picture
|
||||
:customization-color customization-color
|
||||
:status-indicator? false
|
||||
:ring? true
|
||||
:size :big}]
|
||||
[quo/button
|
||||
{:on-press (fn []
|
||||
|
||||
@@ -523,8 +523,7 @@
|
||||
(let [user-avatar {:full-name name
|
||||
:status-indicator? true
|
||||
:online? nil
|
||||
:size :small
|
||||
:ring? true}]
|
||||
:size :small}]
|
||||
(cond
|
||||
(and (not= author my-public-key)
|
||||
(= type types/contact-request)
|
||||
|
||||
@@ -9,20 +9,19 @@
|
||||
|
||||
(defn replace-contact-image-uri
|
||||
[{:keys [contact port public-key font-file theme]}]
|
||||
(let [{:keys [images ens-name customization-color]} contact
|
||||
(let [{:keys [images customization-color]} contact
|
||||
images
|
||||
(reduce (fn [acc image]
|
||||
(let [image-name (:type image)
|
||||
clock (:clock image)
|
||||
options {:port port
|
||||
:ratio pixel-ratio/ratio
|
||||
:public-key public-key
|
||||
:image-name image-name
|
||||
options {:port port
|
||||
:ratio pixel-ratio/ratio
|
||||
:public-key public-key
|
||||
:image-name image-name
|
||||
; We pass the clock so that we reload the
|
||||
; image if the image is updated
|
||||
:clock clock
|
||||
:theme theme
|
||||
:override-ring? (when ens-name false)}]
|
||||
:clock clock
|
||||
:theme theme}]
|
||||
(assoc-in acc
|
||||
[(keyword image-name) :config]
|
||||
{:type :contact
|
||||
@@ -37,7 +36,6 @@
|
||||
:options {:port port
|
||||
:ratio pixel-ratio/ratio
|
||||
:public-key public-key
|
||||
:override-ring? (when ens-name false)
|
||||
:uppercase-ratio (:uppercase-ratio
|
||||
constants/initials-avatar-font-conf)
|
||||
:customization-color customization-color
|
||||
|
||||
@@ -63,21 +63,19 @@
|
||||
:<- [:initials-avatar-font-file]
|
||||
:<- [:theme]
|
||||
(fn [[profiles port font-file theme] [_ target-key-uid]]
|
||||
(let [{:keys [images ens-name? customization-color] :as profile} (get profiles target-key-uid)
|
||||
image-name (-> images first :type)
|
||||
image-clock (-> images first :clock)
|
||||
override-ring? (when ens-name? false)]
|
||||
(let [{:keys [images customization-color] :as profile} (get profiles target-key-uid)
|
||||
image-name (-> images first :type)
|
||||
image-clock (-> images first :clock)]
|
||||
(when (and profile port)
|
||||
{:config
|
||||
(if image-name
|
||||
{:type :account
|
||||
:options {:port port
|
||||
:ratio pixel-ratio/ratio
|
||||
:image-name image-name
|
||||
:key-uid target-key-uid
|
||||
:theme theme
|
||||
:clock image-clock
|
||||
:override-ring? override-ring?}}
|
||||
:options {:port port
|
||||
:ratio pixel-ratio/ratio
|
||||
:image-name image-name
|
||||
:key-uid target-key-uid
|
||||
:theme theme
|
||||
:clock image-clock}}
|
||||
{:type :initials
|
||||
:options {:port port
|
||||
:ratio pixel-ratio/ratio
|
||||
@@ -85,7 +83,6 @@
|
||||
:theme theme
|
||||
:uppercase-ratio (:uppercase-ratio constants/initials-avatar-font-conf)
|
||||
:customization-color customization-color
|
||||
:override-ring? override-ring?
|
||||
:font-file font-file}})}))))
|
||||
|
||||
;; DEPRECATED
|
||||
@@ -233,11 +230,9 @@
|
||||
(boolean preview-privacy?)))
|
||||
|
||||
(defn- replace-multiaccount-image-uri
|
||||
[profile ens-names port font-file avatar-opts theme]
|
||||
(let [{:keys [key-uid ens-name? images
|
||||
[profile port font-file avatar-opts theme]
|
||||
(let [{:keys [key-uid images
|
||||
customization-color]} profile
|
||||
ens-name? (or ens-name? (seq ens-names))
|
||||
avatar-opts (assoc avatar-opts :override-ring? (when ens-name? false))
|
||||
images-with-uri (mapv (fn [{key-uid :keyUid
|
||||
image-name :type
|
||||
image-clock :clock
|
||||
@@ -273,17 +268,16 @@
|
||||
(re-frame/reg-sub
|
||||
:profile/profile-with-image
|
||||
:<- [:profile/profile]
|
||||
:<- [:ens/current-names]
|
||||
:<- [:mediaserver/port]
|
||||
:<- [:initials-avatar-font-file]
|
||||
:<- [:theme]
|
||||
(fn [[profile ens-names port font-file theme] [_ avatar-opts]]
|
||||
(fn [[profile port font-file theme] [_ avatar-opts]]
|
||||
;; Right after logout, this subscription is recomputed, but the sub
|
||||
;; `:profile/profile` output will always be nil. We skip any further
|
||||
;; processing because it's wasteful and because it will trigger a schema
|
||||
;; error.
|
||||
(when profile
|
||||
(replace-multiaccount-image-uri profile ens-names port font-file avatar-opts theme))))
|
||||
(replace-multiaccount-image-uri profile port font-file avatar-opts theme))))
|
||||
|
||||
(re-frame/reg-sub
|
||||
:profile/image
|
||||
@@ -309,4 +303,3 @@
|
||||
:<- [:profile/profile]
|
||||
(fn [profile]
|
||||
(not (boolean (seq (:mnemonic profile))))))
|
||||
|
||||
|
||||
+10
-26
@@ -67,11 +67,10 @@
|
||||
placeholder-avatar: pass image file path as `image-name`
|
||||
|
||||
`indicator-size` is outer indicator radius
|
||||
`indicator-size` - `indicator-border` is inner indicator radius
|
||||
`ring?` shows or hides ring for account with ens name"
|
||||
`indicator-size` - `indicator-border` is inner indicator radius"
|
||||
[{:keys [port public-key image-name key-uid size theme indicator-size
|
||||
indicator-border indicator-center-to-edge indicator-color ring?
|
||||
ring-width ratio clock]}]
|
||||
indicator-border indicator-center-to-edge indicator-color
|
||||
ratio clock]}]
|
||||
(str
|
||||
image-server-uri-prefix
|
||||
port
|
||||
@@ -96,10 +95,7 @@
|
||||
(* indicator-border ratio)
|
||||
"&indicatorCenterToEdge="
|
||||
(* indicator-center-to-edge ratio)
|
||||
"&addRing="
|
||||
(if ring? 1 0)
|
||||
"&ringWidth="
|
||||
(* ring-width ratio)))
|
||||
"&addRing=0"))
|
||||
|
||||
(defn get-initials-avatar-uri
|
||||
"fn to get the avatar uri when account/contact/placeholder has no custom pic set
|
||||
@@ -110,12 +106,11 @@
|
||||
check `get-account-image-uri` for color formats
|
||||
check `get-font-file-ready` for `font-file`
|
||||
|
||||
`ring?` shows or hides ring for account with ens name
|
||||
`uppercase-ratio` is the uppercase-height/line-height for `font-file`"
|
||||
[{:keys [port public-key key-uid theme ring? length size customization-color
|
||||
[{:keys [port public-key key-uid theme length size customization-color
|
||||
color font-size font-file uppercase-ratio indicator-size
|
||||
indicator-border indicator-center-to-edge indicator-color full-name
|
||||
ring-width ratio clock]}]
|
||||
ratio clock]}]
|
||||
(str
|
||||
image-server-uri-prefix
|
||||
port
|
||||
@@ -152,20 +147,16 @@
|
||||
(* indicator-border ratio)
|
||||
"&indicatorCenterToEdge="
|
||||
(* indicator-center-to-edge ratio)
|
||||
"&addRing="
|
||||
(if ring? 1 0)
|
||||
"&ringWidth="
|
||||
(* ring-width ratio)))
|
||||
"&addRing=0"))
|
||||
|
||||
(defn get-contact-image-uri
|
||||
"check `get-account-image-uri` for color formats
|
||||
check `get-font-file-ready` for `font-file`
|
||||
|
||||
`public-key` is required to render the ring
|
||||
`ring?` shows or hides ring for account with ens name
|
||||
`uppercase-ratio` is the uppercase-height/line-height for `font-file`"
|
||||
[{:keys [port public-key image-name clock theme indicator-size indicator-border
|
||||
indicator-center-to-edge indicator-color size ring? ring-width ratio]}]
|
||||
indicator-center-to-edge indicator-color size ratio]}]
|
||||
(str
|
||||
image-server-uri-prefix
|
||||
port
|
||||
@@ -188,10 +179,7 @@
|
||||
(* indicator-border ratio)
|
||||
"&indicatorCenterToEdge="
|
||||
(* indicator-center-to-edge ratio)
|
||||
"&addRing="
|
||||
(if ring? 1 0)
|
||||
"&ringWidth="
|
||||
(* ring-width ratio)))
|
||||
"&addRing=0"))
|
||||
|
||||
(defn get-qr-image-uri-for-any-url
|
||||
[{:keys [url port qr-size error-level]}]
|
||||
@@ -219,11 +207,7 @@
|
||||
:contact get-contact-image-uri
|
||||
:initials get-initials-avatar-uri
|
||||
str)
|
||||
(-> (merge options profile-picture-options)
|
||||
(assoc :ring?
|
||||
(if (nil? (:override-ring? options))
|
||||
(:ring? profile-picture-options)
|
||||
(:override-ring? options))))))
|
||||
(merge options profile-picture-options)))
|
||||
|
||||
(schema/=> get-image-uri
|
||||
[:=>
|
||||
|
||||
@@ -18,10 +18,8 @@
|
||||
:theme :dark
|
||||
:indicator-size 2
|
||||
:indicator-color "rgba(9,16,28,0.08)"
|
||||
:indicator-center-to-edge 6
|
||||
:ring? true
|
||||
:ring-width 2})
|
||||
"https://localhost:port/accountImages?publicKey=public-key&keyUid=key-uid&imageName=image-name&size=0&theme=:dark&clock=timestamp&indicatorColor=rgba(9%2C16%2C28%2C0.08)&indicatorSize=4&indicatorBorder=0&indicatorCenterToEdge=12&addRing=1&ringWidth=4"))))
|
||||
:indicator-center-to-edge 6})
|
||||
"https://localhost:port/accountImages?publicKey=public-key&keyUid=key-uid&imageName=image-name&size=0&theme=:dark&clock=timestamp&indicatorColor=rgba(9%2C16%2C28%2C0.08)&indicatorSize=4&indicatorBorder=0&indicatorCenterToEdge=12&addRing=0"))))
|
||||
|
||||
(t/deftest get-account-initials-uri-test
|
||||
(with-redefs
|
||||
@@ -39,7 +37,6 @@
|
||||
:length "length"
|
||||
:size 48
|
||||
:theme :light
|
||||
:ring? "ring?"
|
||||
:customization-color :blue
|
||||
:color "#0E162000"
|
||||
:font-size 12
|
||||
@@ -47,6 +44,5 @@
|
||||
:uppercase-ratio 0.6
|
||||
:indicator-size 2
|
||||
:indicator-center-to-edge 6
|
||||
:indicator-color "#0E1620"
|
||||
:ring-width 4})
|
||||
"https://localhost:port/accountInitials?publicKey=public-key&keyUid=key-uid&length=length&size=96&bgColor=%3Ablue%3Alight&color=%230E162000&fontSize=24&fontFile=%2Ffont%2FInter%20Medium.otf&uppercaseRatio=0.6&theme=:light&clock=timestamp&name=full-name&indicatorColor=%230E1620&indicatorSize=4&indicatorBorder=0&indicatorCenterToEdge=12&addRing=1&ringWidth=8"))))
|
||||
:indicator-color "#0E1620"})
|
||||
"https://localhost:port/accountInitials?publicKey=public-key&keyUid=key-uid&length=length&size=96&bgColor=%3Ablue%3Alight&color=%230E162000&fontSize=24&fontFile=%2Ffont%2FInter%20Medium.otf&uppercaseRatio=0.6&theme=:light&clock=timestamp&name=full-name&indicatorColor=%230E1620&indicatorSize=4&indicatorBorder=0&indicatorCenterToEdge=12&addRing=0"))))
|
||||
|
||||
Reference in New Issue
Block a user