Fix failing test for navigation task

Handle default case for ens confirmation

Before navigation away the registration state is cleared and case does not handle default value for nil

Remove extra space on home button

Remove outdated options

Fix e2e

Change navigation replace arguments as per rn5

Fixes #10178

Dispatch navigation later

Do not restore state for react-native-screens

Signed-off-by: Gheorghe Pinzaru <feross95@gmail.com>
This commit is contained in:
Gheorghe Pinzaru 2020-03-17 12:15:02 +03:00
parent d2478bbd34
commit d24f4690b8
No known key found for this signature in database
GPG Key ID: C9A094959935A952
7 changed files with 19 additions and 19 deletions

View File

@ -117,7 +117,8 @@ public class MainActivity extends ReactFragmentActivity
setSecureFlag(); setSecureFlag();
SplashScreen.show(this, true); SplashScreen.show(this, true);
super.onCreate(savedInstanceState); // NOTE: Try to not restore the state https://github.com/software-mansion/react-native-screens/issues/17
super.onCreate(null);
if (!shouldShowRootedNotification()) { if (!shouldShowRootedNotification()) {
configureStatus(); configureStatus();

View File

@ -32,6 +32,7 @@
:multiaccounts/loading true)}) :multiaccounts/loading true)})
(fx/defn initialize-views (fx/defn initialize-views
{:events [::initialize-view]}
[cofx {:keys [logout?]}] [cofx {:keys [logout?]}]
(let [{{:multiaccounts/keys [multiaccounts] :as db} :db} cofx] (let [{{:multiaccounts/keys [multiaccounts] :as db} :db} cofx]
(when (and (seq multiaccounts) (not logout?)) (when (and (seq multiaccounts) (not logout?))
@ -50,11 +51,13 @@
{} {}
all-multiaccounts)] all-multiaccounts)]
(fx/merge cofx (fx/merge cofx
{:db (-> db {:db (-> db
(assoc :multiaccounts/multiaccounts multiaccounts) (assoc :multiaccounts/multiaccounts multiaccounts)
(assoc :multiaccounts/logout? logout?) (assoc :multiaccounts/logout? logout?)
(assoc :multiaccounts/loading false))} (assoc :multiaccounts/loading false))
(initialize-views {:logout? logout?})))) ;; NOTE: Try to dispatch later navigation because of that https://github.com/react-navigation/react-navigation/issues/6879
:dispatch-later [{:dispatch [::initialize-view {:logout? logout?}]
:ms 100}]})))
(fx/defn start-app [cofx] (fx/defn start-app [cofx]
(fx/merge cofx (fx/merge cofx

View File

@ -371,7 +371,8 @@
(i18n/label :t/ens-saved-title) (i18n/label :t/ens-saved-title)
;;NOTE: this state can't be reached atm ;;NOTE: this state can't be reached atm
:registration-failed :registration-failed
(i18n/label :t/ens-registration-failed-title))) (i18n/label :t/ens-registration-failed-title)
nil))
(defn- final-state-details (defn- final-state-details
[state username] [state username]
@ -391,7 +392,8 @@
;;NOTE: this state can't be reached atm ;;NOTE: this state can't be reached atm
:registration-failed :registration-failed
[react/text {:style {:color colors/gray :font-size 14}} [react/text {:style {:color colors/gray :font-size 14}}
(i18n/label :t/ens-registration-failed)])) (i18n/label :t/ens-registration-failed)]
nil))
(views/defview confirmation [] (views/defview confirmation []
(views/letsubs [{:keys [state username]} [:ens/confirmation-screen]] (views/letsubs [{:keys [state username]} [:ens/confirmation-screen]]

View File

@ -120,7 +120,4 @@
(def home-container (def home-container
(merge (merge
{:flex 1} {:flex 1}))
;;TODO move this to navigation layer
(when platform/ios?
{:margin-bottom tabs.styles/tabs-diff})))

View File

@ -126,6 +126,4 @@
(defn navigate-replace [route params] (defn navigate-replace [route params]
(when (can-be-called?) (when (can-be-called?)
(ocall @navigator-ref "dispatch" (ocall @navigator-ref "dispatch"
(ocall stack-actions "replace" (ocall stack-actions "replace" (name route) (clj->js params)))))
#js {:name (name route)
:params (clj->js params)}))))

View File

@ -39,7 +39,6 @@
{:name :login {:name :login
:component login/login} :component login/login}
{:name :create-multiaccount-generate-key {:name :create-multiaccount-generate-key
:options {:stackPresentation "modal"}
:component intro/wizard-generate-key} :component intro/wizard-generate-key}
{:name :create-multiaccount-choose-key {:name :create-multiaccount-choose-key
:back-handler :noop :back-handler :noop

View File

@ -594,14 +594,14 @@ class BaseView(object):
def get_back_to_home_view(self, times_to_click_on_back_btn=5): def get_back_to_home_view(self, times_to_click_on_back_btn=5):
counter = 0 counter = 0
from views.home_view import PlusButton while BackButton(self.driver).is_element_displayed(2):
while not PlusButton(self.driver).is_element_displayed(2):
try: try:
if counter >= times_to_click_on_back_btn: if counter >= times_to_click_on_back_btn:
break break
self.back_button.click() self.back_button.click()
except (NoSuchElementException, TimeoutException):
counter += 1 counter += 1
except (NoSuchElementException, TimeoutException):
continue
return self.home_button.click() return self.home_button.click()
def relogin(self, password=common_password): def relogin(self, password=common_password):