This commit is contained in:
parent
406904025d
commit
835e97d672
|
@ -18,6 +18,8 @@
|
|||
constants/local-pairing-event-connection-success)
|
||||
(= action
|
||||
constants/local-pairing-action-connect))
|
||||
connection-error? (and (= type
|
||||
constants/local-pairing-event-connection-error))
|
||||
error-on-pairing? (contains? constants/local-pairing-event-errors type)
|
||||
completed-pairing? (and (= type
|
||||
constants/local-pairing-event-transfer-success)
|
||||
|
@ -30,8 +32,9 @@
|
|||
(and (some? account) (some? password)))
|
||||
multiaccount-data (when received-account?
|
||||
(merge account {:password password}))
|
||||
navigate-to-syncing-devices? (and (or connection-success? error-on-pairing?) receiver?)
|
||||
navigate-to-syncing-devices? (and (or connection-success? connection-error?) receiver?)
|
||||
user-in-syncing-devices-screen? (or (= (:view-id db) :syncing-progress)
|
||||
(= (:view-id db) :profiles)
|
||||
(= (:view-id db) :syncing-progress-intro))
|
||||
user-in-sign-in-intro-screen? (= (:view-id db) :sign-in-intro)]
|
||||
(merge {:db (cond-> db
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
[react-native.core :as rn]
|
||||
[status-im2.contexts.onboarding.common.background.view :as background]
|
||||
[status-im2.contexts.onboarding.syncing.progress.style :as style]
|
||||
[utils.debounce :as debounce]
|
||||
[utils.i18n :as i18n]
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
|
@ -25,12 +26,17 @@
|
|||
:description-accessibility-label :progress-screen-sub-title}])
|
||||
|
||||
(defn try-again-button
|
||||
[profile-color in-onboarding?]
|
||||
[profile-color in-onboarding? logged-in?]
|
||||
[quo/button
|
||||
{:on-press (fn []
|
||||
(rf/dispatch [:syncing/clear-states])
|
||||
(rf/dispatch [:navigate-back-to
|
||||
(if in-onboarding? :sign-in-intro :sign-in)]))
|
||||
(cond
|
||||
logged-in? (rf/dispatch [:navigate-back])
|
||||
in-onboarding? (rf/dispatch [:navigate-back-to :sign-in-intro])
|
||||
:else (do
|
||||
(rf/dispatch [:navigate-back])
|
||||
(debounce/dispatch-and-chill [:open-modal :sign-in]
|
||||
1000))))
|
||||
:accessibility-label :try-again-later-button
|
||||
:customization-color profile-color
|
||||
:container-style style/try-again-button}
|
||||
|
@ -39,7 +45,8 @@
|
|||
(defn view
|
||||
[in-onboarding?]
|
||||
(let [pairing-status (rf/sub [:pairing/pairing-status])
|
||||
profile-color (:color (rf/sub [:onboarding/profile]))]
|
||||
profile-color (:color (rf/sub [:onboarding/profile]))
|
||||
logged-in? (rf/sub [:multiaccount/logged-in?])]
|
||||
[rn/view {:style (style/page-container in-onboarding?)}
|
||||
(when-not in-onboarding? [background/view true])
|
||||
[quo/page-nav {:type :no-title :background :blur}]
|
||||
|
@ -50,7 +57,7 @@
|
|||
[rn/view {:style style/page-illustration}
|
||||
[quo/text "[Error here]"]])
|
||||
(when-not (pairing-progress pairing-status)
|
||||
[try-again-button profile-color in-onboarding?])]))
|
||||
[try-again-button profile-color in-onboarding? logged-in?])]))
|
||||
|
||||
(defn view-onboarding
|
||||
[]
|
||||
|
|
|
@ -289,14 +289,22 @@
|
|||
scan-code? (reagent/atom true)
|
||||
set-rescan-timeout (fn []
|
||||
(reset! scan-code? false)
|
||||
(js/setTimeout #(reset! scan-code? true) 3000))]
|
||||
(js/setTimeout (fn []
|
||||
(reset! scan-code? true)
|
||||
(reset! qr-code-succeed? false))
|
||||
3000))]
|
||||
(fn [{:keys [title show-bottom-view? background animated?]}]
|
||||
(let [torch-mode (if @torch? :on :off)
|
||||
flashlight-icon (if @torch? :i/flashlight-on :i/flashlight-off)
|
||||
scan-qr-code-tab? (= @active-tab 1)
|
||||
view-id (rf/sub [:view-id])
|
||||
show-camera? (and scan-qr-code-tab?
|
||||
@camera-permission-granted?
|
||||
@preflight-check-passed?
|
||||
(some #{view-id}
|
||||
[:sign-in-intro
|
||||
:sign-in
|
||||
:scan-sync-code-page])
|
||||
(boolean (not-empty @qr-view-finder)))
|
||||
camera-ready-to-scan? (and (or (not animated?) @render-camera?)
|
||||
show-camera?
|
||||
|
@ -312,8 +320,7 @@
|
|||
:show-camera? show-camera?
|
||||
:content-opacity content-opacity
|
||||
:subtitle-opacity subtitle-opacity
|
||||
:title-opacity title-opacity})
|
||||
view-id (rf/sub [:view-id])]
|
||||
:title-opacity title-opacity})]
|
||||
|
||||
(rn/use-effect
|
||||
#(set-listener-torch-off-on-app-inactive torch?))
|
||||
|
@ -348,7 +355,9 @@
|
|||
{:torch-mode torch-mode
|
||||
:qr-view-finder @qr-view-finder
|
||||
:scan-code? @scan-code?
|
||||
:set-qr-code-succeeded #(reset! qr-code-succeed? true)
|
||||
:set-qr-code-succeeded (fn []
|
||||
(reset! qr-code-succeed? true)
|
||||
(set-rescan-timeout))
|
||||
:set-rescan-timeout set-rescan-timeout}])
|
||||
[rn/view {:style (style/root-container (:top insets))}
|
||||
[:f> header
|
||||
|
|
Loading…
Reference in New Issue