From ab973076ebf79f3e4928847e8baa6036c1cf1f08 Mon Sep 17 00:00:00 2001 From: Ibrahem Khalil Date: Tue, 9 May 2023 10:49:25 +0300 Subject: [PATCH] [15612] Only allow showing universal links after clicking start using status (#15786) --- src/status_im/events.cljs | 6 ++++-- src/status_im/transport/core.cljs | 18 ++++++++++-------- src/status_im/utils/universal_links/core.cljs | 1 + .../contexts/onboarding/welcome/view.cljs | 4 +++- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/status_im/events.cljs b/src/status_im/events.cljs index 01ee5c0d3b..516f1a226f 100644 --- a/src/status_im/events.cljs +++ b/src/status_im/events.cljs @@ -148,7 +148,8 @@ (rf/defn on-return-from-background [{:keys [db now] :as cofx}] - (let [app-in-background-since (get db :app-in-background-since) + (let [new-account? (get db :onboarding-2/new-account?) + app-in-background-since (get db :app-in-background-since) signed-up? (get-in db [:multiaccount :signed-up?]) biometric-auth? (= (:auth-method db) "biometric") requires-bio-auth (and @@ -161,7 +162,8 @@ {:db (dissoc db :app-in-background-since)} (mailserver/process-next-messages-request) (wallet/restart-wallet-service-after-background app-in-background-since) - (universal-links/process-stored-event) + (when-not new-account? + (universal-links/process-stored-event)) #(when-let [chat-id (:current-chat-id db)] {:dispatch [:chat/mark-all-as-read chat-id]}) #(when requires-bio-auth diff --git a/src/status_im/transport/core.cljs b/src/status_im/transport/core.cljs index 60c35dd4ee..6116eea48e 100644 --- a/src/status_im/transport/core.cljs +++ b/src/status_im/transport/core.cljs @@ -45,11 +45,13 @@ {:events [::messenger-started]} [{:keys [db] :as cofx} {:keys [mailservers] :as response}] (log/info "Messenger started") - (rf/merge cofx - {:db (-> db - (assoc :messenger/started? true) - (add-mailservers mailservers))} - (fetch-node-info-fx) - (pairing/init) - (stickers/load-packs) - (universal-links/process-stored-event))) + (let [new-account? (get db :onboarding-2/new-account?)] + (rf/merge cofx + {:db (-> db + (assoc :messenger/started? true) + (add-mailservers mailservers))} + (fetch-node-info-fx) + (pairing/init) + (stickers/load-packs) + (when-not new-account? + (universal-links/process-stored-event))))) diff --git a/src/status_im/utils/universal_links/core.cljs b/src/status_im/utils/universal_links/core.cljs index af034b7f6d..73a7397e24 100644 --- a/src/status_im/utils/universal_links/core.cljs +++ b/src/status_im/utils/universal_links/core.cljs @@ -184,6 +184,7 @@ (rf/defn process-stored-event "Return an event description for processing a url if in the database" + {:events [:universal-links/process-stored-event]} [{:keys [db] :as cofx}] (when-let [url (:universal-links/url db)] (rf/merge cofx diff --git a/src/status_im2/contexts/onboarding/welcome/view.cljs b/src/status_im2/contexts/onboarding/welcome/view.cljs index 5faa8f658b..f321e7620d 100644 --- a/src/status_im2/contexts/onboarding/welcome/view.cljs +++ b/src/status_im2/contexts/onboarding/welcome/view.cljs @@ -46,7 +46,9 @@ "Illustration here"]] [rn/view {:style (style/buttons insets)} [quo/button - {:on-press #(rf/dispatch [:init-root :shell-stack]) + {:on-press (fn [] + (rf/dispatch [:init-root :shell-stack]) + (rf/dispatch [:universal-links/process-stored-event])) :type :primary :accessibility-label :welcome-button :override-background-color (colors/custom-color profile-color 60)}