fix: profile redirect on newly created account (#16340)

This commit gets rid of the app-state check which is buggy,
The app-state becomes `active` after the universal link code has executed always resulting in the redirect not happening.
This commit is contained in:
Siddarth Kumar 2023-07-07 19:21:00 +05:30 committed by GitHub
parent ac675e28eb
commit d76e64b1bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 9 deletions

View File

@ -13,8 +13,7 @@
[status-im.wallet.choose-recipient.core :as choose-recipient] [status-im.wallet.choose-recipient.core :as choose-recipient]
[status-im2.navigation.events :as navigation] [status-im2.navigation.events :as navigation]
[taoensso.timbre :as log] [taoensso.timbre :as log]
[native-module.core :as native-module] [native-module.core :as native-module]))
[react-native.platform :as platform]))
;; TODO(yenda) investigate why `handle-universal-link` event is ;; TODO(yenda) investigate why `handle-universal-link` event is
;; dispatched 7 times for the same link ;; dispatched 7 times for the same link
@ -175,15 +174,10 @@
(rf/defn handle-url (rf/defn handle-url
"Store url in the database if the user is not logged in, to be processed "Store url in the database if the user is not logged in, to be processed
on login, otherwise just handle it. On Android platform the app-state value on login, otherwise just handle it."
in db is `background` immediately after account creation, hence we avoid the
app-state check for android platforms to fix this e2e blocker :
https://github.com/status-im/status-mobile/issues/15859
"
{:events [:universal-links/handle-url]} {:events [:universal-links/handle-url]}
[{:keys [db] :as cofx} url] [{:keys [db] :as cofx} url]
(if (and (multiaccounts.model/logged-in? db) (if (multiaccounts.model/logged-in? db)
(or platform/android? (= (:app-state db) "active")))
(route-url cofx url) (route-url cofx url)
(store-url-for-later cofx url))) (store-url-for-later cofx url)))