Skip to content

Commit

Permalink
addressing changes
Browse files Browse the repository at this point in the history
  • Loading branch information
siddarthkay committed Apr 27, 2023
1 parent 5c45bcd commit ddbe0e0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
12 changes: 6 additions & 6 deletions src/status_im2/contexts/quo_preview/share/qr_code.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
{:key :quart
:value "Quart"}
{:key :highest
:value "Highest"}]}
])
:value "Highest"}]}])

(defn cool-preview
[]
Expand All @@ -46,12 +45,14 @@
:flex-direction :row
:justify-content :center}}
[rn/view
[rn/text {:style {:padding 20 :flex-shrink 1}} "Media server url -> " @media-server-uri]
[quo/qr-code
{:source {:uri @media-server-uri}
:height 250
:width 250}]
]]]])))

[rn/view
[rn/text {:style {:padding 20 :flex-shrink 1}} "Media server url -> "
@media-server-uri]]]]]])))

(defn preview-qr-code
[]
Expand All @@ -63,5 +64,4 @@
{:flex 1
:keyboard-should-persist-taps :always
:header [cool-preview]
:key-fn str}]
])
:key-fn str}]])
23 changes: 11 additions & 12 deletions src/utils/image_server.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@
:light 1
:dark 2))

(defn correction-level->index
[level]
(case (keyword level)
:low 1
:medium 2
:quart 3
:highest 4
4))

(defn get-identicons-uri
[port public-key theme]
(str image-server-uri-prefix
Expand Down Expand Up @@ -66,7 +75,7 @@
(let [profile-qr-url (str status-profile-base-url public-key)
base-64-qr-url (js/btoa profile-qr-url)
profile-image-type "large"
error-correction-level 4
error-correction-level (correction-level->index :highest)
superimpose-profile? true
media-server-url (str image-server-uri-prefix
port
Expand All @@ -85,20 +94,10 @@
profile-image-type)]
media-server-url))

;for an input string label of error correction level
;this fn must return the appropriate corresponding index #
(defn get-error-correction-index-for-level
[level]
(case level
:low 1
:medium 2
:quart 3
:highest 4))

(defn get-qr-image-uri-for-any-url
[{:keys [url port qr-size error-level]}]
(let [qr-url-base64 (js/btoa url)
error-correction-level (get-error-correction-index-for-level error-level)
error-correction-level (correction-level->index error-level)
superimpose-profile? false
media-server-url (str image-server-uri-prefix
port
Expand Down

0 comments on commit ddbe0e0

Please sign in to comment.