[Fix] QR scanner scanning QR when user moved to next screen (#16012)

Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
This commit is contained in:
Mohamed Javid 2023-05-30 23:58:57 +08:00 committed by GitHub
parent 9a4f8f97b9
commit 863dac6e6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 14 deletions

View File

@ -31,7 +31,9 @@
(defn try-again-button (defn try-again-button
[profile-color] [profile-color]
[quo/button [quo/button
{:on-press #(rf/dispatch [:navigate-back]) {:on-press (fn []
(rf/dispatch [:syncing/clear-states])
(rf/dispatch [:navigate-back]))
:accessibility-label :try-again-later-button :accessibility-label :try-again-later-button
:override-background-color (colors/custom-color profile-color 60) :override-background-color (colors/custom-color profile-color 60)
:style style/try-again-button} :style style/try-again-button}

View File

@ -24,6 +24,11 @@
[{:keys [db]} role] [{:keys [db]} role]
{:db (assoc-in db [:syncing :role] role)}) {:db (assoc-in db [:syncing :role] role)})
(rf/defn local-pairing-clear-states
{:events [:syncing/clear-states]}
[{:keys [db]} role]
{:db (dissoc db :syncing)})
(defn- get-default-node-config (defn- get-default-node-config
[installation-id] [installation-id]
(let [db {:networks/current-network config/default-network (let [db {:networks/current-network config/default-network

View File

@ -203,8 +203,12 @@
(fn [] (fn []
(let [camera-ref (atom nil) (let [camera-ref (atom nil)
read-qr-once? (atom false) read-qr-once? (atom false)
;; The below check is to prevent scanning of any QR code
;; when the user is in syncing progress screen
user-in-syncing-progress-screen? (= (rf/sub [:view-id]) :syncing-progress)
on-read-code (fn [data] on-read-code (fn [data]
(when-not @read-qr-once? (when (and (not @read-qr-once?)
(not user-in-syncing-progress-screen?))
(reset! read-qr-once? true) (reset! read-qr-once? true)
(js/setTimeout (fn [] (js/setTimeout (fn []
(reset! read-qr-once? false)) (reset! read-qr-once? false))