commit
f800f2c6bd
|
@ -18,7 +18,8 @@
|
||||||
"react-native-linear-gradient",
|
"react-native-linear-gradient",
|
||||||
"react-native-android-sms-listener",
|
"react-native-android-sms-listener",
|
||||||
"react-native-camera",
|
"react-native-camera",
|
||||||
"react-native-qrcode"
|
"react-native-qrcode",
|
||||||
|
"identicon.js"
|
||||||
],
|
],
|
||||||
"imageDirs": [
|
"imageDirs": [
|
||||||
"images"
|
"images"
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"awesome-phonenumber": "^1.0.13",
|
"awesome-phonenumber": "^1.0.13",
|
||||||
|
"identicon.js": "github:status-im/identicon.js",
|
||||||
"react": "^0.14.5",
|
"react": "^0.14.5",
|
||||||
"react-native": "^0.24.1",
|
"react-native": "^0.24.1",
|
||||||
"react-native-action-button": "^1.1.4",
|
"react-native-action-button": "^1.1.4",
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
image
|
image
|
||||||
linear-gradient
|
linear-gradient
|
||||||
touchable-highlight]]
|
touchable-highlight]]
|
||||||
|
[status-im.utils.identicon :refer [identicon]]
|
||||||
[status-im.components.toolbar :refer [toolbar]]
|
[status-im.components.toolbar :refer [toolbar]]
|
||||||
[status-im.components.drawer.view :refer [drawer-view open-drawer]]
|
[status-im.components.drawer.view :refer [drawer-view open-drawer]]
|
||||||
[status-im.components.styles :refer [color-purple
|
[status-im.components.styles :refer [color-purple
|
||||||
|
@ -71,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 new-contact])}}]
|
: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]
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
(ns status-im.models.contacts
|
(ns status-im.models.contacts
|
||||||
(:require [status-im.persistence.realm :as r]
|
(:require [status-im.persistence.realm :as r]
|
||||||
|
[status-im.utils.identicon :refer [identicon]]
|
||||||
[status-im.persistence.realm-queries :refer [include-query
|
[status-im.persistence.realm-queries :refer [include-query
|
||||||
exclude-query]]))
|
exclude-query]]))
|
||||||
|
|
||||||
|
@ -8,9 +9,9 @@
|
||||||
(r/sorted :name :asc)
|
(r/sorted :name :asc)
|
||||||
r/collection->map))
|
r/collection->map))
|
||||||
|
|
||||||
(defn create-contact [{:keys [name photo-path] :as contact}]
|
(defn create-contact [{:keys [name photo-path whisper-identity] :as contact}]
|
||||||
(->> {:name (or name "")
|
(->> {:name (or name "")
|
||||||
:photo-path (or photo-path "")}
|
:photo-path (or photo-path (identicon whisper-identity))}
|
||||||
(merge contact)
|
(merge contact)
|
||||||
(r/create :contacts)))
|
(r/create :contacts)))
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
(ns status-im.utils.identicon
|
||||||
|
(: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] (identicon hash default-size))
|
||||||
|
([hash options]
|
||||||
|
(str "data:image/png;base64," (.toString (new identicon-js hash options)))))
|
||||||
|
|
Loading…
Reference in New Issue