This commit is contained in:
Adrian Tiberius 2016-06-21 16:05:46 +03:00
parent eab8dd5ca2
commit 5a409ed6bf
3 changed files with 8 additions and 4 deletions

View File

@ -72,7 +72,7 @@
:custom-content toolbar-title :custom-content toolbar-title
:action {:image {:source {:uri :icon_add} :action {:image {:source {:uri :icon_add}
:style icon-search} :style icon-search}
:handler #(dispatch [:add-new-contact (merge new-contact {:photo-path (identicon whisper-identity 40)})])}}] :handler #(dispatch [:add-new-contact (merge {:photo-path (identicon whisper-identity)} new-contact)])}}]
[view st/form-container [view st/form-container
[contact-whisper-id-input whisper-identity] [contact-whisper-id-input whisper-identity]
[contact-name-input name] [contact-name-input name]

View File

@ -11,7 +11,7 @@
(defn create-contact [{:keys [name photo-path whisper-identity] :as contact}] (defn create-contact [{:keys [name photo-path whisper-identity] :as contact}]
(->> {:name (or name "") (->> {:name (or name "")
:photo-path (or photo-path (identicon whisper-identity 40))} :photo-path (or photo-path (identicon whisper-identity))}
(merge contact) (merge contact)
(r/create :contacts))) (r/create :contacts)))

View File

@ -2,8 +2,12 @@
(:require [clojure.string :as s] (:require [clojure.string :as s]
[status-im.utils.utils :as u])) [status-im.utils.utils :as u]))
(def default-size 40)
(def identicon-js (u/require "identicon.js")) (def identicon-js (u/require "identicon.js"))
(defn identicon [hash options] (defn identicon
(str "data:image/png;base64," (.toString (new identicon-js hash options)))) ([hash] (identicon hash default-size))
([hash options]
(str "data:image/png;base64," (.toString (new identicon-js hash options)))))