Revert "After dismissing error, no redirect to home and new qr can be"
This reverts commit 386c678caf
.
This commit is contained in:
parent
43ac92b9b0
commit
f6fce850b2
|
@ -277,7 +277,7 @@
|
||||||
(if (some? validation-result)
|
(if (some? validation-result)
|
||||||
{:utils/show-popup {:title (i18n/label :t/unable-to-read-this-code)
|
{:utils/show-popup {:title (i18n/label :t/unable-to-read-this-code)
|
||||||
:content validation-result
|
:content validation-result
|
||||||
:on-dismiss #(re-frame/dispatch [:qr-scanner.ui/qr-code-error-dismissed])}}
|
:on-dismiss #(re-frame/dispatch [:navigate-to-clean :home])}}
|
||||||
(fx/merge cofx
|
(fx/merge cofx
|
||||||
fx
|
fx
|
||||||
(if config/partitioned-topic-enabled?
|
(if config/partitioned-topic-enabled?
|
||||||
|
|
|
@ -682,11 +682,6 @@
|
||||||
(fn [cofx [_ identifier handler & [opts]]]
|
(fn [cofx [_ identifier handler & [opts]]]
|
||||||
(qr-scanner/scan-qr-code cofx identifier (merge {:handler handler} opts))))
|
(qr-scanner/scan-qr-code cofx identifier (merge {:handler handler} opts))))
|
||||||
|
|
||||||
(handlers/register-handler-fx
|
|
||||||
:qr-scanner.ui/qr-code-error-dismissed
|
|
||||||
(fn [cofx [_ _]]
|
|
||||||
(qr-scanner/scan-qr-code-after-error-dismiss cofx)))
|
|
||||||
|
|
||||||
(handlers/register-handler-fx
|
(handlers/register-handler-fx
|
||||||
:qr-scanner.callback/scan-qr-code-success
|
:qr-scanner.callback/scan-qr-code-success
|
||||||
(fn [cofx [_ context data]]
|
(fn [cofx [_ context data]]
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
(ns status-im.qr-scanner.core
|
(ns status-im.qr-scanner.core
|
||||||
(:require [re-frame.core :as re-frame]
|
(:require [re-frame.core :as re-frame]
|
||||||
[status-im.i18n :as i18n]
|
[status-im.i18n :as i18n]
|
||||||
[status-im.ui.screens.navigation :as navigation]
|
|
||||||
[status-im.utils.utils :as utils]
|
[status-im.utils.utils :as utils]
|
||||||
[status-im.utils.fx :as fx]))
|
[status-im.utils.fx :as fx]))
|
||||||
|
|
||||||
|
@ -19,16 +18,10 @@
|
||||||
50))
|
50))
|
||||||
#(re-frame/dispatch [deny-handler qr-codes]))}})
|
#(re-frame/dispatch [deny-handler qr-codes]))}})
|
||||||
|
|
||||||
(fx/defn scan-qr-code-after-error-dismiss
|
|
||||||
[{:keys [db]}]
|
|
||||||
(let [view-id (:view-id db)]
|
|
||||||
{:db (assoc-in db [:navigation/screen-params view-id :barcode-read?] false)}))
|
|
||||||
|
|
||||||
(fx/defn set-qr-code
|
(fx/defn set-qr-code
|
||||||
[{:keys [db]} context data]
|
[{:keys [db]} context data]
|
||||||
(merge {:db (-> db
|
(merge {:db (-> db
|
||||||
(update :qr-codes dissoc context)
|
(update :qr-codes dissoc context)
|
||||||
(update-in [:navigation/screen-params :qr-scanner] assoc :barcode-read? true)
|
|
||||||
(dissoc :current-qr-context))}
|
(dissoc :current-qr-context))}
|
||||||
(when-let [qr-codes (:qr-codes db)]
|
(when-let [qr-codes (:qr-codes db)]
|
||||||
{:dispatch [(:handler qr-codes) context data (dissoc qr-codes :handler)]})))
|
{:dispatch [(:handler qr-codes) context data (dissoc qr-codes :handler)]})))
|
||||||
|
|
|
@ -6,11 +6,17 @@
|
||||||
[status-im.utils.universal-links.core :as universal-links]
|
[status-im.utils.universal-links.core :as universal-links]
|
||||||
[status-im.utils.fx :as fx]))
|
[status-im.utils.fx :as fx]))
|
||||||
|
|
||||||
(fx/defn handle-qr-code
|
(fx/defn process-qr-code
|
||||||
[cofx data]
|
[cofx data]
|
||||||
(if (spec/valid? :global/public-key data)
|
(if (spec/valid? :global/public-key data)
|
||||||
(universal-links/handle-view-profile cofx data)
|
(universal-links/handle-view-profile cofx data)
|
||||||
(or (universal-links/handle-url cofx data)
|
(or (universal-links/handle-url cofx data)
|
||||||
{:utils/show-popup {:title (i18n/label :t/unable-to-read-this-code)
|
{:utils/show-popup {:title (i18n/label :t/unable-to-read-this-code)
|
||||||
:content (i18n/label :t/use-valid-qr-code {:data data})
|
:content (i18n/label :t/use-valid-qr-code {:data data})
|
||||||
:on-dismiss #(re-frame/dispatch [:qr-scanner.ui/qr-code-error-dismissed])}})))
|
:on-dismiss #(re-frame/dispatch [:navigate-to-clean :home])}})))
|
||||||
|
|
||||||
|
(fx/defn handle-qr-code
|
||||||
|
[cofx data]
|
||||||
|
(fx/merge cofx
|
||||||
|
(navigation/navigate-to-clean :home {})
|
||||||
|
(process-qr-code data)))
|
||||||
|
|
|
@ -184,11 +184,7 @@
|
||||||
:screens/on-will-focus
|
:screens/on-will-focus
|
||||||
(fn [{:keys [db] :as cofx} [_ view-id]]
|
(fn [{:keys [db] :as cofx} [_ view-id]]
|
||||||
(fx/merge cofx
|
(fx/merge cofx
|
||||||
(if (= view-id :qr-scanner)
|
{:db (assoc db :view-id view-id)}
|
||||||
{:db (-> db
|
|
||||||
(assoc :view-id view-id)
|
|
||||||
(assoc-in [:navigation/screen-params view-id :barcode-read?] false))}
|
|
||||||
{:db (assoc db :view-id view-id)})
|
|
||||||
#(case view-id
|
#(case view-id
|
||||||
:keycard-settings (hardwallet/settings-screen-did-load %)
|
:keycard-settings (hardwallet/settings-screen-did-load %)
|
||||||
:reset-card (hardwallet/reset-card-screen-did-load %)
|
:reset-card (hardwallet/reset-card-screen-did-load %)
|
||||||
|
|
|
@ -24,26 +24,26 @@
|
||||||
(re-frame/dispatch [:qr-scanner.callback/scan-qr-code-success identifier (camera/get-qr-code-data data)]))
|
(re-frame/dispatch [:qr-scanner.callback/scan-qr-code-success identifier (camera/get-qr-code-data data)]))
|
||||||
|
|
||||||
(defview qr-scanner []
|
(defview qr-scanner []
|
||||||
(letsubs [{identifier :current-qr-context
|
(letsubs [{identifier :current-qr-context} [:get-screen-params]
|
||||||
barcode-read-sub? :barcode-read?} [:get-screen-params]
|
camera-initialized? (reagent/atom false)
|
||||||
camera-initialized? (reagent/atom false)]
|
barcode-read? (reagent/atom false)]
|
||||||
(let [barcode-read? barcode-read-sub?]
|
[react/view styles/barcode-scanner-container
|
||||||
[react/view styles/barcode-scanner-container
|
[qr-scanner-toolbar (or (:toolbar-title identifier) (i18n/label :t/scan-qr)) identifier]
|
||||||
[qr-scanner-toolbar (or (:toolbar-title identifier) (i18n/label :t/scan-qr)) identifier]
|
[camera/camera {:onBarCodeRead #(if (:multiple? identifier)
|
||||||
[camera/camera {:onBarCodeRead #(if (:multiple? identifier)
|
(on-barcode-read identifier %)
|
||||||
(on-barcode-read identifier %)
|
(when-not @barcode-read?
|
||||||
(when-not barcode-read?
|
(do (reset! barcode-read? true)
|
||||||
(on-barcode-read identifier %)))
|
(on-barcode-read identifier %))))
|
||||||
:ref #(reset! camera-initialized? true)
|
:ref #(reset! camera-initialized? true)
|
||||||
:captureAudio false
|
:captureAudio false
|
||||||
:style styles/barcode-scanner}]
|
:style styles/barcode-scanner}]
|
||||||
[react/view styles/rectangle-container
|
[react/view styles/rectangle-container
|
||||||
[react/view styles/rectangle
|
[react/view styles/rectangle
|
||||||
[react/image {:source {:uri :corner_left_top}
|
[react/image {:source {:uri :corner_left_top}
|
||||||
:style styles/corner-left-top}]
|
:style styles/corner-left-top}]
|
||||||
[react/image {:source {:uri :corner_right_top}
|
[react/image {:source {:uri :corner_right_top}
|
||||||
:style styles/corner-right-top}]
|
:style styles/corner-right-top}]
|
||||||
[react/image {:source {:uri :corner_right_bottom}
|
[react/image {:source {:uri :corner_right_bottom}
|
||||||
:style styles/corner-right-bottom}]
|
:style styles/corner-right-bottom}]
|
||||||
[react/image {:source {:uri :corner_left_bottom}
|
[react/image {:source {:uri :corner_left_bottom}
|
||||||
:style styles/corner-left-bottom}]]]])))
|
:style styles/corner-left-bottom}]]]]))
|
||||||
|
|
Loading…
Reference in New Issue