Skip to content

Commit

Permalink
refactor: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
yqrashawn committed Jun 7, 2023
1 parent 0a6bc82 commit 5a4016c
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 59 deletions.
4 changes: 2 additions & 2 deletions src/quo2/components/avatars/user_avatar/style.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
(defn outer
[size]
(let [dimensions (get-in sizes [size :dimensions])]
{:width dimensions
:height dimensions}))
{:width dimensions
:height dimensions}))

(defn initials-avatar
[size customization-color]
Expand Down
13 changes: 7 additions & 6 deletions src/quo2/components/avatars/user_avatar/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@
[fast-image/fast-image
{:accessibility-label :profile-picture
:style outer-styles
:source {:uri (initials-picture-fn {:length amount-initials
:full-name full-name
:font-size (:font-size (text/text-style {:size font-size}))
:background-color (:background-color avatar-style)
:color (:color style/initials-avatar-text)
:size (:width outer-styles)})}}]
:source {:uri (initials-picture-fn
{:length amount-initials
:full-name full-name
:font-size (:font-size (text/text-style {:size font-size}))
:background-color (:background-color avatar-style)
:color (:color style/initials-avatar-text)
:size (:width outer-styles)})}}]
[rn/view
{:accessibility-label :initials-avatar
:style avatar-style}
Expand Down
3 changes: 2 additions & 1 deletion src/status_im/utils/fs.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
[]
(.-CachesDirectoryPath ^js react-native-fs))

(defn get-abs-path [rel-path cb]
(defn get-abs-path
[rel-path cb]
(let [path (str react-native-fs/MainBundlePath "/" rel-path)]
(if platform/android?
(.then (react-native-fs/realpath path) cb)
Expand Down
4 changes: 2 additions & 2 deletions src/status_im2/contexts/chat/home/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@
profile-picture (first images)
profile-color (:color (rf/sub [:onboarding-2/profile]))
customization-color (if profile-color
profile-color
(rf/sub [:profile/customization-color key-uid]))
profile-color
(rf/sub [:profile/customization-color key-uid]))
top (safe-area/get-top)]
[:<>
(if (= selected-tab :tab/contacts)
Expand Down
4 changes: 2 additions & 2 deletions src/status_im2/contexts/shell/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@
profile-picture (first images)
profile-color (:color (rf/sub [:onboarding-2/profile]))
customization-color (if profile-color
profile-color
(rf/sub [:profile/customization-color key-uid]))]
profile-color
(rf/sub [:profile/customization-color key-uid]))]
[rn/view
{:style {:flex 1}}
[shell customization-color profile-picture]
Expand Down
2 changes: 1 addition & 1 deletion src/status_im2/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
[cofx]
(rf/merge cofx
{:setup/init-theme nil
:setup/get-abs-root-path #(re-frame/dispatch [:setup/init-abs-root-path %])
:setup/get-abs-root-path #(re-frame/dispatch [:setup/init-abs-root-path %])
:get-supported-biometric-auth nil
:network/listen-to-network-info nil
:keycard/register-card-events nil
Expand Down
2 changes: 1 addition & 1 deletion src/status_im2/subs/general.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -296,4 +296,4 @@
:initials-avatar-font-file
:<- [:abs-root-path]
(fn [abs-root-path]
(str abs-root-path constants/initials-avatar-font-file-name)))
(str abs-root-path constants/initials-avatar-font-file-name)))
12 changes: 7 additions & 5 deletions src/status_im2/subs/multiaccount.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -222,11 +222,13 @@
(conj acc (assoc current :uri uri))))
[]
images)
images (if (seq images) images [{:fn (image-server/get-initials-uri-fn {:port port
:key-uid key-uid
:theme (theme/get-theme)
:ring? true
:font-file font-file})}])]
images (if (seq images)
images
[{:fn (image-server/get-initials-uri-fn {:port port
:key-uid key-uid
:theme (theme/get-theme)
:ring? true
:font-file font-file})}])]
(assoc multiaccount :images images)))

(re-frame/reg-sub
Expand Down
80 changes: 41 additions & 39 deletions src/utils/image_server.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -29,54 +29,18 @@

(defn get-account-image-uri
[{:keys [port public-key image-name key-uid theme status? online? ring?]}]
(str image-server-uri-prefix
port
account-images-action
"?publicKey="
public-key
"&keyUid="
key-uid
"&imageName="
image-name
"&theme="
(current-theme-index theme)
"&clock="
(timestamp)
"&status="
(if status? 1 0)
"&online="
(if online? 1 0)
"&addRing="
(if ring? 1 0)))

(defn get-account-initials-uri
[{:keys [port public-key key-uid theme ring? length size background-color color font-size font-file uppercase-ratio status? online? full-name]}]
(str image-server-uri-prefix
port
account-initials-action
account-images-action
"?publicKey="
public-key
"&keyUid="
key-uid
"&length="
length
"&size="
size
"&bgColor="
(js/encodeURIComponent background-color)
"&color="
(js/encodeURIComponent color)
"&fontSize="
font-size
"&fontFile="
(js/encodeURIComponent font-file)
"&uppercaseRatio="
uppercase-ratio
"&imageName="
image-name
"&theme="
(current-theme-index theme)
"&clock="
"&name="
(js/encodeURIComponent full-name)
(timestamp)
"&status="
(if status? 1 0)
Expand All @@ -85,6 +49,44 @@
"&addRing="
(if ring? 1 0)))

(defn get-account-initials-uri
[{:keys [port public-key key-uid theme ring? length size background-color color font-size font-file
uppercase-ratio status? online? full-name]}]
(str
image-server-uri-prefix
port
account-initials-action
"?publicKey="
public-key
"&keyUid="
key-uid
"&length="
length
"&size="
size
"&bgColor="
(js/encodeURIComponent background-color)
"&color="
(js/encodeURIComponent color)
"&fontSize="
font-size
"&fontFile="
(js/encodeURIComponent font-file)
"&uppercaseRatio="
uppercase-ratio
"&theme="
(current-theme-index theme)
"&clock="
"&name="
(js/encodeURIComponent full-name)
(timestamp)
"&status="
(if status? 1 0)
"&online="
(if online? 1 0)
"&addRing="
(if ring? 1 0)))

(defn get-initials-uri-fn
[{:keys [port key-uid theme ring? font-file]}]
(fn [{:keys [full-name length size background-color font-size color]}]
Expand Down

0 comments on commit 5a4016c

Please sign in to comment.