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

View File

@ -72,7 +72,7 @@
:custom-content toolbar-title
:action {:image {:source {:uri :icon_add}
: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
[contact-whisper-id-input whisper-identity]
[contact-name-input name]

View File

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

View File

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