qr-scanner screen title, code cleaning, style fixes

Former-commit-id: fbd66a840f
This commit is contained in:
Adrian Tiberius 2016-06-03 15:47:52 +03:00
parent 13d689bb4a
commit a424ba1447
2 changed files with 17 additions and 30 deletions

View File

@ -4,31 +4,21 @@
[status-im.components.react :refer [view
text
text-input
image
touchable-highlight
list-view
list-item]]
[status-im.components.action-button :refer [action-button
action-button-item]]
[status-im.components.styles :refer [toolbar-background2]]
touchable-highlight]]
[status-im.components.toolbar :refer [toolbar]]
[status-im.components.drawer.view :refer [drawer-view open-drawer]]
[status-im.components.icons.ionicons :refer [icon]]
[status-im.components.styles :refer [color-blue
color-purple
hamburger-icon
[status-im.components.styles :refer [color-purple
search-icon
create-icon
import-qr-icon
toolbar-background2
toolbar-background1
form-text-input]]
[status-im.i18n :refer [label]]
[status-im.contacts.styles :as st]
[status-im.utils.logging :as log]))
[status-im.contacts.styles :as st]))
(defn import-qr-button []
[touchable-highlight
{:on-press #(dispatch [:scan-qr-code :new-contact :set-new-contact-from-qr])}
{:on-press #(dispatch [:scan-qr-code {:toolbar-title (label :t/new-contact)} :set-new-contact-from-qr])}
[view st/import-qr-button
[view st/import-qr-button-content
[icon {:name :qr-scanner
@ -59,7 +49,7 @@
[drawer-view
[view st/contact-form-container
[toolbar {:title (label :t/new-contact)
:background-color toolbar-background2
:background-color toolbar-background1
:action {:image {:source {:uri :icon_add_gray}
:style search-icon}
:handler #(dispatch [:add-new-contact new-contact])}}]

View File

@ -2,28 +2,25 @@
(:require-macros [status-im.utils.views :refer [defview]])
(:require [re-frame.core :refer [subscribe dispatch dispatch-sync]]
[status-im.components.react :refer [view
icon
text
image
touchable-highlight]]
image]]
[status-im.components.camera :refer [camera]]
[status-im.components.styles :refer [toolbar-background2]]
[status-im.components.styles :refer [toolbar-background1
search-icon]]
[status-im.components.toolbar :refer [toolbar]]
[status-im.components.icons.ionicons :refer [icon]]
[status-im.components.styles :refer [color-blue]]
[status-im.i18n :refer [label]]
[status-im.qr-scanner.styles :as st]
[status-im.utils.types :refer [json->clj]]
[status-im.utils.logging :as log]))
[status-im.utils.types :refer [json->clj]]))
(defn qr-scanner-toolbar []
[toolbar {:title (label :t/new-contact)
:background-color toolbar-background2}])
(defn qr-scanner-toolbar [title]
[toolbar {:title title
:background-color toolbar-background1
:action {:image {:source {:uri :icon_lock_white}
:style search-icon}
:handler #()}}])
(defview qr-scanner []
[identifier [:get :current-qr-context]]
[view st/barcode-scanner-container
[qr-scanner-toolbar]
[qr-scanner-toolbar (:toolbar-title identifier)]
[camera {;:on-bar-code-read #(js/alert "ok")
:onBarCodeRead #(let [data (json->clj (.-data %))]
(dispatch [:set-qr-code identifier data]))