Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
Ferossgp committed Feb 29, 2020
1 parent e4b0b76 commit 52e51c5
Show file tree
Hide file tree
Showing 20 changed files with 72 additions and 82 deletions.
2 changes: 0 additions & 2 deletions components/src/status_im/ui/components/react.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,4 @@
(def safe-area-provider (adapt-class (object/get js-dependencies/safe-area-context "SafeAreaProvider")))
(def safe-area-consumer (adapt-class (object/get js-dependencies/safe-area-context "SafeAreaConsumer")))

(def safe-area-consumer (adapt-class (object/get js-dependencies/safe-area-context "SafeAreaConsumer")))

(def safe-area-view (adapt-class (object/get js-dependencies/safe-area-context "SafeAreaView")))
2 changes: 1 addition & 1 deletion src/status_im/contact/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
(contacts-store/fetch-contacts-rpc cofx #(re-frame/dispatch [::contacts-loaded %])))

(fx/defn open-contact-toggle-list
[{:keys [db :as cofx]}]
[{:keys [db] :as cofx}]
(fx/merge cofx
{:db (assoc db
:group/selected-contacts #{}
Expand Down
4 changes: 1 addition & 3 deletions src/status_im/hardwallet/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,7 @@

(defn multiaccounts-screen-did-load
[{:keys [db]}]
{:db (-> db
(assoc-in [:hardwallet :setup-step] nil)
(dissoc :multiaccounts/login))})
{:db (assoc-in db [:hardwallet :setup-step] nil)})

(defn authentication-method-screen-did-load
[{:keys [db]}]
Expand Down
8 changes: 6 additions & 2 deletions src/status_im/init/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,14 @@
(let [{{:multiaccounts/keys [multiaccounts] :as db} :db} cofx]
(cond
(empty? multiaccounts)
(navigation/navigate-to-cofx cofx :intro-stack {:screen :intro})
(navigation/navigate-reset cofx {:index 1
:routes [{:name :intro-stack}
{:name :intro}]})

logout?
(navigation/navigate-to-cofx cofx :intro-stack {:screen :multiaccounts})
(navigation/navigate-reset cofx {:index 1
:routes [{:name :intro-stack}
{:name :multiaccounts}]})

:else
(let [{:keys [key-uid public-key photo-path name]} (first (#(sort-by :last-sign-in > %) (vals multiaccounts)))]
Expand Down
10 changes: 6 additions & 4 deletions src/status_im/multiaccounts/logout/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
[status-im.ui.screens.navigation :as navigation]
[status-im.utils.keychain.core :as keychain]))

(fx/defn logout-method [{:keys [db] :as cofx} auth-method]
(fx/defn logout-method [{:keys [db] :as cofx} {:keys [auth-method logout?]}]
(let [key-uid (get-in db [:multiaccount :key-uid])]
(fx/merge cofx
{::logout nil
:keychain/clear-user-password key-uid
::init/open-multiaccounts #(re-frame/dispatch [::init/initialize-multiaccounts % {:logout? true}])}
::init/open-multiaccounts #(re-frame/dispatch [::init/initialize-multiaccounts % {:logout? logout?}])}
(keychain/save-auth-method key-uid auth-method)
(transport/stop-whisper)
(chaos-mode/stop-checking)
Expand All @@ -23,7 +23,8 @@
(fx/defn logout
{:events [:logout]}
[cofx]
(logout-method cofx keychain/auth-method-none))
(logout-method cofx {:auth-method keychain/auth-method-none
:logout? true}))

(fx/defn show-logout-confirmation [_]
{:ui/show-confirmation
Expand All @@ -37,7 +38,8 @@
{:events [:biometric-logout]}
[cofx]
(fx/merge cofx
(logout-method keychain/auth-method-biometric-prepare)
(logout-method {:auth-method keychain/auth-method-biometric-prepare
:logout? false})
(fn [{:keys [db]}]
{:db (assoc-in db [:multiaccounts/login :save-password?] true)})))

Expand Down
11 changes: 6 additions & 5 deletions src/status_im/ui/components/status_bar/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
[status-im.ui.components.status-bar.styles :as styles]
[status-im.utils.platform :as platform]))

(def route->bar-type (merge {:qr-scanner {:type :black}}
(when platform/ios?
{:new-chat {:type :black}
:new-public-chat {:type :black}})))

;; TODO: Integrate into navigation
(defn get-config [view-id]
(or (get {:qr-scanner {:type :black}
:new-chat {:type :black}
:new-public-chat {:type :black}}
view-id)
{:type :main}))
(get route->bar-type view-id {:type :main}))

(defn set-status-bar
"If more than one `StatusBar` is rendered, the one which was mounted last will
Expand Down
5 changes: 5 additions & 0 deletions src/status_im/ui/screens/add_new/new_chat/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,8 @@
{:resolve-public-key {:chain chain
:contact-identity new-identity
:cb #(re-frame/dispatch [:new-chat/set-new-identity % new-identity])}}))))))

(handlers/register-handler-fx
::new-chat-focus
(fn [{:keys [db]}]
{:db (dissoc db :contacts/new-identity :contacts/new-identity-error)}))
6 changes: 0 additions & 6 deletions src/status_im/ui/screens/add_new/new_chat/navigation.cljs

This file was deleted.

2 changes: 0 additions & 2 deletions src/status_im/ui/screens/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
status-im.ui.screens.group.chat-settings.events
status-im.ui.screens.group.events
status-im.utils.universal-links.events
status-im.ui.screens.add-new.new-chat.navigation
status-im.ui.screens.profile.events
status-im.ui.screens.wallet.navigation
[re-frame.core :as re-frame]
[status-im.chat.models :as chat]
[status-im.hardwallet.core :as hardwallet]
Expand Down
8 changes: 6 additions & 2 deletions src/status_im/ui/screens/group/events.cljs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
(ns status-im.ui.screens.group.events
(:require [status-im.utils.handlers :as handlers]
[status-im.ui.screens.group.navigation]))
(:require [status-im.utils.handlers :as handlers]))

(handlers/register-handler-fx
:deselect-contact
Expand All @@ -21,3 +20,8 @@
:select-participant
(fn [{:keys [db]} [_ id]]
{:db (update db :selected-participants conj id)}))

(handlers/register-handler-fx
::add-participants-toggle-list
(fn [{db :db}]
{:db (assoc db :selected-participants #{})}))
6 changes: 0 additions & 6 deletions src/status_im/ui/screens/group/navigation.cljs

This file was deleted.

8 changes: 1 addition & 7 deletions src/status_im/ui/screens/navigation.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@

(defmethod unload-data! :default [db] db)

(defmulti preload-data!
(fn [db [_ view-id]] (or view-id (:view-id db))))

(defmethod preload-data! :default [db _] db)

(fx/defn navigate-to-cofx
[{:keys [db]} go-to-view-id screen-params]
(let [db (cond-> (assoc db :view-id go-to-view-id)
Expand Down Expand Up @@ -48,7 +43,7 @@
(re-frame/assoc-coeffect context :db (unload-data! db))))))

(def navigation-interceptors
[unload-data-interceptor (re-frame/enrich preload-data!)])
[unload-data-interceptor])

(re-frame/reg-fx
::navigate-to
Expand Down Expand Up @@ -86,7 +81,6 @@

(handlers/register-handler-fx
:navigate-back
(re-frame/enrich preload-data!)
(fn [cofx _]
(navigate-back cofx)))

Expand Down
6 changes: 2 additions & 4 deletions src/status_im/ui/screens/routing/chat_stack.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
[status-im.ui.screens.group.views :as group]
[status-im.ui.screens.profile.group-chat.views :as profile.group-chat]
[status-im.chat.models.loading :as chat.loading]
[status-im.ui.screens.group.events :as group.events]
[status-im.ui.screens.stickers.views :as stickers]))

(defonce stack (navigation/create-stack))
Expand All @@ -23,13 +24,10 @@
:component chat/select-chat}
{:name :profile
:component profile.contact/profile}

;; {:name :take-picture
;; :component }]

{:name :new-group
:component group/new-group}
{:name :add-participants-toggle-list
:on-focus [::group.events/add-participants-toggle-list]
:component group/add-participants-toggle-list}
{:name :contact-toggle-list
:component group/contact-toggle-list}
Expand Down
5 changes: 0 additions & 5 deletions src/status_im/ui/screens/routing/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@
(defn wrapped-screen-style [{:keys [insets]} insets-obj]
(merge
{:background-color :white
:position :absolute
:left 0
:right 0
:top 0
:bottom 0
:flex 1}
(when (get insets :bottom)
{:padding-bottom (oget insets-obj "bottom")})
Expand Down
2 changes: 2 additions & 0 deletions src/status_im/ui/screens/routing/intro_login_stack.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
:component intro/intro}
{:name :multiaccounts
:component multiaccounts/multiaccounts})
{:name :progress
:component progress/progress}
{:name :login
:component login/login}
;; {:name :intro-wizard
Expand Down
10 changes: 7 additions & 3 deletions src/status_im/ui/screens/routing/main.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@
[status-im.ui.screens.stickers.views :as stickers]
[status-im.ui.screens.home.views :as home]
[status-im.ui.screens.add-new.new-chat.views :as new-chat]
[status-im.ui.screens.add-new.new-chat.events :as new-chat.events]
[status-im.ui.screens.chat.views :as chat]
[status-im.ui.screens.keycard.views :as keycard]
[status-im.ui.screens.wallet.transactions.views :as wallet-transactions]
[status-im.ui.screens.routing.intro-login-stack :as intro-login-stack]
[status-im.ui.screens.routing.chat-stack :as chat-stack]
[status-im.ui.screens.routing.wallet-stack :as wallet-stack]
[status-im.ui.screens.wallet.events :as wallet.events]
[status-im.ui.screens.routing.profile-stack :as profile-stack]
[status-im.ui.screens.routing.browser-stack :as browser-stack]
[status-im.chat.models.loading :as chat.loading]
Expand All @@ -25,7 +27,7 @@
(defonce modals-stack (navigation/create-stack))
(defonce bottom-tabs (navigation/create-bottom-tabs))

;; TODO: Add two-pane navigator on chat-stack
;; TODO(Ferossgp): Add two-pane navigator on chat-stack
(defn tabs []
[bottom-tabs {:initial-route-name :chat-stack
:lazy false
Expand All @@ -38,6 +40,7 @@
:insets {:top false}
:component browser-stack/browser-stack}
{:name :wallet-stack
:on-focus [::wallet.events/wallet-stack]
:insets {:top false}
:component wallet-stack/wallet-stack}
{:name :profile-stack
Expand All @@ -46,8 +49,8 @@

(views/defview get-main-component [_]
(views/letsubs [logged-in? [:multiaccount/logged-in?]]
[main-stack (merge {:header-mode :none
:mode :modal})
[main-stack {:header-mode :none
:mode :modal}
[(if logged-in?
{:name :tabs
:insets {:top false}
Expand All @@ -69,6 +72,7 @@
{:name :keycard-welcome
:component keycard/welcome}
{:name :new-chat
:on-focus [::new-chat.events/new-chat-focus]
:transition :presentation-ios
:component new-chat/new-chat}
{:name :new-public-chat
Expand Down
8 changes: 3 additions & 5 deletions src/status_im/ui/screens/routing/wallet_stack.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
[status-im.ui.screens.wallet.account.views :as wallet.account]
[status-im.ui.screens.wallet.add-new.views :as add-account]
[status-im.ui.screens.wallet.account-settings.views :as account-settings]
[status-im.ui.screens.wallet.events :as wallet.events]
[status-im.ui.screens.routing.core :as navigation]))

(defonce stack (navigation/create-stack))
Expand All @@ -21,6 +22,7 @@
{:name :wallet-account
:component wallet.account/account}
{:name :add-new-account
:on-focus [::wallet.events/add-new-account]
:component add-account/add-account}
{:name :add-watch-account
:component add-account/add-watch-account}
Expand All @@ -34,18 +36,14 @@
:component account-settings/account-settings}
{:name :collectibles-list
:component collectibles/collectibles-list}
;; {:name :wallet-onboarding-setup
;; :component }
{:name :wallet-transaction-details
:component wallet-transactions/transaction-details}
;; {:name :wallet-settings-hook
;; :component }
{:name :wallet-settings-assets
:component wallet-settings/manage-assets}
{:name :wallet-add-custom-token
:on-focus [::wallet.events/wallet-add-custom-token]
:component custom-tokens/add-custom-token}
{:name :wallet-custom-token-details
:component custom-tokens/custom-token-details}

{:name :currency-settings
:component currency-settings/currency-settings}]])
4 changes: 2 additions & 2 deletions src/status_im/ui/screens/views.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@
(when debug?
(persist-state! state)))

(defonce main-app-navigator (routing/get-main-component false))
(defonce twopane-app-navigator (routing/get-main-component true))
(defonce main-app-navigator (partial routing/get-main-component false))
(defonce twopane-app-navigator (partial routing/get-main-component true))

(defn main []
(let [two-pane? (reagent/atom (dimensions/fit-two-pane?))]
Expand Down
24 changes: 24 additions & 0 deletions src/status_im/ui/screens/wallet/events.cljs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
(ns status-im.ui.screens.wallet.events
(:require [status-im.ui.screens.wallet.signing-phrase.views :as signing-phrase]
[status-im.utils.handlers :as handlers]))

(handlers/register-handler-fx
::wallet-stack
(fn [{:keys [db]}]
(let [wallet-set-up-passed? (get-in db [:multiaccount :wallet-set-up-passed?])
sign-phrase-showed? (get db :wallet/sign-phrase-showed?)]
{:dispatch [:wallet.ui/pull-to-refresh] ;TODO temporary simple fix for v1
:db (if (or wallet-set-up-passed? sign-phrase-showed?)
db
(assoc db :popover/popover {:view [signing-phrase/signing-phrase]}
:wallet/sign-phrase-showed? true))})))

(handlers/register-handler-fx
::wallet-add-custom-token
(fn [{:keys [db]}]
{:db (dissoc db :wallet/custom-token-screen)}))

(handlers/register-handler-fx
::add-new-account
(fn [{:keys [db]}]
{:db (dissoc db :add-account)}))
23 changes: 0 additions & 23 deletions src/status_im/ui/screens/wallet/navigation.cljs

This file was deleted.

0 comments on commit 52e51c5

Please sign in to comment.