|
5 | 5 | [status-im.common.resources :as resources]
|
6 | 6 | [status-im.contexts.onboarding.common.background.view :as background]
|
7 | 7 | [status-im.contexts.onboarding.syncing.progress.style :as style]
|
| 8 | + [utils.debounce :as debounce] |
8 | 9 | [utils.i18n :as i18n]
|
9 | 10 | [utils.re-frame :as rf]))
|
10 | 11 |
|
|
25 | 26 | :title-accessibility-label :progress-screen-title
|
26 | 27 | :description-accessibility-label :progress-screen-sub-title}])
|
27 | 28 |
|
| 29 | +(defn navigate-to-enter-seed-phrase |
| 30 | + [view-id] |
| 31 | + (if (= view-id :screen/onboarding.syncing-progress-intro) |
| 32 | + (do |
| 33 | + (rf/dispatch [:navigate-back-to :screen/onboarding.sync-or-recover-profile]) |
| 34 | + (debounce/debounce-and-dispatch |
| 35 | + [:onboarding/navigate-to-sign-in-by-seed-phrase :screen/onboarding.sync-or-recover-profile] |
| 36 | + 300)) |
| 37 | + (do |
| 38 | + (rf/dispatch [:navigate-back]) |
| 39 | + (debounce/debounce-and-dispatch [:onboarding/overlay-show] 100) |
| 40 | + (debounce/debounce-and-dispatch [:open-modal :screen/onboarding.new-to-status] 200) |
| 41 | + (debounce/debounce-and-dispatch |
| 42 | + [:onboarding/navigate-to-sign-in-by-seed-phrase :screen/onboarding.new-to-status] |
| 43 | + 300)))) |
| 44 | + |
28 | 45 | (defn try-again-button
|
29 |
| - [profile-color] |
30 |
| - [quo/button |
31 |
| - {:on-press (fn [] |
32 |
| - (rf/dispatch [:syncing/clear-states]) |
33 |
| - (rf/dispatch [:navigate-back])) |
34 |
| - :accessibility-label :try-again-later-button |
35 |
| - :customization-color profile-color |
36 |
| - :size 40 |
37 |
| - :container-style style/try-again-button} |
38 |
| - (i18n/label :t/try-again)]) |
| 46 | + [profile-color logged-in?] |
| 47 | + (let [view-id (rf/sub [:view-id])] |
| 48 | + [rn/view |
| 49 | + (when-not logged-in? |
| 50 | + [quo/button |
| 51 | + {:on-press #(navigate-to-enter-seed-phrase view-id) |
| 52 | + :accessibility-label :try-seed-phrase-button |
| 53 | + :customization-color profile-color |
| 54 | + :container-style style/try-again-button} |
| 55 | + (i18n/label :t/enter-seed-phrase)]) |
| 56 | + [quo/button |
| 57 | + {:on-press (fn [] |
| 58 | + (rf/dispatch [:syncing/clear-states]) |
| 59 | + (rf/dispatch [:navigate-back])) |
| 60 | + :accessibility-label :try-again-later-button |
| 61 | + :customization-color profile-color |
| 62 | + :size 40 |
| 63 | + :container-style style/try-again-button} |
| 64 | + (i18n/label :t/try-again)]])) |
39 | 65 |
|
40 | 66 | (defn- illustration
|
41 | 67 | [pairing-progress?]
|
|
47 | 73 | (defn view
|
48 | 74 | [in-onboarding?]
|
49 | 75 | (let [pairing-status (rf/sub [:pairing/pairing-status])
|
| 76 | + logged-in? (rf/sub [:multiaccount/logged-in?]) |
50 | 77 | pairing-progress? (pairing-progress pairing-status)
|
51 | 78 | profile-color (or (:color (rf/sub [:onboarding/profile]))
|
52 | 79 | (rf/sub [:profile/customization-color]))]
|
|
58 | 85 | [page-title pairing-progress?]
|
59 | 86 | [illustration pairing-progress?]
|
60 | 87 | (when-not (pairing-progress pairing-status)
|
61 |
| - [try-again-button profile-color])])) |
| 88 | + [try-again-button profile-color logged-in?])])) |
62 | 89 |
|
63 | 90 | (defn view-onboarding
|
64 | 91 | []
|
|
0 commit comments