qr-scanner screen title, code cleaning, style fixes

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

View File

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

View File

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