From 0f0cd22cb2c0e5c8b995e0ee693dd7d89fff32ae Mon Sep 17 00:00:00 2001 From: Adrian Tiberius Date: Tue, 21 Jun 2016 16:05:46 +0300 Subject: [PATCH] cleanup Former-commit-id: 5a409ed6bf803c75c128ab74ad78fdcb84113bab --- src/status_im/contacts/views/new_contact.cljs | 2 +- src/status_im/models/contacts.cljs | 2 +- src/status_im/utils/identicon.cljs | 8 ++++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/status_im/contacts/views/new_contact.cljs b/src/status_im/contacts/views/new_contact.cljs index 8a6132f19d..4af9d3c5d4 100644 --- a/src/status_im/contacts/views/new_contact.cljs +++ b/src/status_im/contacts/views/new_contact.cljs @@ -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] diff --git a/src/status_im/models/contacts.cljs b/src/status_im/models/contacts.cljs index 03194bc37c..6c3ea62a7a 100644 --- a/src/status_im/models/contacts.cljs +++ b/src/status_im/models/contacts.cljs @@ -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))) diff --git a/src/status_im/utils/identicon.cljs b/src/status_im/utils/identicon.cljs index de585e4b04..2d8dac64e1 100644 --- a/src/status_im/utils/identicon.cljs +++ b/src/status_im/utils/identicon.cljs @@ -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)))))