rnn leftovers

Signed-off-by: andrey <motor4ik@gmail.com>
This commit is contained in:
andrey 2021-06-16 14:00:41 +02:00
parent dd5864ff25
commit 706d6a44a4
No known key found for this signature in database
GPG Key ID: 89B67245FD2F0272
30 changed files with 198 additions and 216 deletions

View File

@ -3,7 +3,7 @@
(fx/defn show-bottom-sheet (fx/defn show-bottom-sheet
[{:keys [db]} {:keys [view options]}] [{:keys [db]} {:keys [view options]}]
{:rnn-show-bottom-sheet nil {:show-bottom-sheet nil
:db (assoc db :db (assoc db
:bottom-sheet/show? true :bottom-sheet/show? true
:bottom-sheet/view view :bottom-sheet/view view
@ -20,5 +20,5 @@
(fx/defn hide-bottom-sheet (fx/defn hide-bottom-sheet
{:events [:bottom-sheet/hide]} {:events [:bottom-sheet/hide]}
[{:keys [db]}] [{:keys [db]}]
{:rnn-hide-bottom-sheet nil {:hide-bottom-sheet nil
:db (assoc db :bottom-sheet/show? false)}) :db (assoc db :bottom-sheet/show? false)})

View File

@ -522,7 +522,7 @@
(re-frame/reg-fx (re-frame/reg-fx
:browser/show-browser-selection :browser/show-browser-selection
(fn [link] (fn [link]
(list-selection/browse link))) (js/setTimeout #(list-selection/browse link) 500)))
(re-frame/reg-fx (re-frame/reg-fx
:browser/show-web-browser-selection :browser/show-web-browser-selection

View File

@ -11,7 +11,7 @@
:commands/select-account :commands/select-account
{:message message {:message message
:from (ethereum/get-default-account (:multiaccount/accounts db))}) :from (ethereum/get-default-account (:multiaccount/accounts db))})
:rnn-show-select-acc-sheet nil}) :show-select-acc-sheet nil})
(fx/defn set-selected-account (fx/defn set-selected-account
{:events [::set-selected-account]} {:events [::set-selected-account]}

View File

@ -321,7 +321,7 @@
(fx/merge cofx (fx/merge cofx
(reset-community-id-input id) (reset-community-id-input id)
(reset-channel-info) (reset-channel-info)
(navigation/navigate-to :communities {:screen :create-community-channel}))) (navigation/navigate-to :create-community-channel nil)))
(fx/defn edit-channel-pressed (fx/defn edit-channel-pressed
{:events [::edit-channel-pressed]} {:events [::edit-channel-pressed]}
@ -331,7 +331,7 @@
:description description :description description
:color color :color color
:community-id community-id})} :community-id community-id})}
(navigation/navigate-to :communities {:screen :edit-community-channel}))) (navigation/navigate-to :edit-community-channel nil)))
(fx/defn community-created (fx/defn community-created
{:events [::community-created]} {:events [::community-created]}
@ -367,7 +367,7 @@
:membership access :membership access
:color color :color color
:editing? true})} :editing? true})}
(navigation/navigate-to :community-edit :nil)))) (navigation/navigate-to :community-edit nil))))
(fx/defn community-imported (fx/defn community-imported
{:events [::community-imported]} {:events [::community-imported]}

View File

@ -10,8 +10,8 @@
:interceptors [(re-frame/inject-cofx :random-id-generator)]} :interceptors [(re-frame/inject-cofx :random-id-generator)]}
[cofx {:keys [public-key]}] [cofx {:keys [public-key]}]
(fx/merge cofx (fx/merge cofx
(navigation/pop-to-root-tab :chat-stack) {:dispatch-later [{:ms 1000 :dispatch [:chat.ui/start-chat public-key]}]}
(chat/start-chat public-key))) (navigation/pop-to-root-tab :chat-stack)))
(fx/defn contact-code-submitted (fx/defn contact-code-submitted
{:events [:contact.ui/contact-code-submitted] {:events [:contact.ui/contact-code-submitted]

View File

@ -193,11 +193,11 @@
:keycard-settings (keycard/settings-screen-did-load %) :keycard-settings (keycard/settings-screen-did-load %)
:reset-card (keycard/reset-card-screen-did-load %) :reset-card (keycard/reset-card-screen-did-load %)
:enter-pin-settings (keycard/enter-pin-screen-did-load %) :enter-pin-settings (keycard/enter-pin-screen-did-load %)
:keycard-login-pin (keycard/enter-pin-screen-did-load %) :keycard-login-pin (keycard/login-pin-screen-did-load %)
:add-new-account-pin (keycard/enter-pin-screen-did-load %) :add-new-account-pin (keycard/enter-pin-screen-did-load %)
:keycard-authentication-method (keycard/authentication-method-screen-did-load %) :keycard-authentication-method (keycard/authentication-method-screen-did-load %)
:multiaccounts (keycard/multiaccounts-screen-did-load %) :multiaccounts (keycard/multiaccounts-screen-did-load %)
(:wallet-stack :wallet) (wallet/wallet-will-focus %) :wallet (wallet/wallet-will-focus %)
nil))) nil)))
;;TODO :replace by named events ;;TODO :replace by named events

View File

@ -15,8 +15,8 @@
[cofx chat-id] [cofx chat-id]
(when (get-in cofx [:db :chats chat-id :is-active]) (when (get-in cofx [:db :chats chat-id :is-active])
(fx/merge cofx (fx/merge cofx
(navigation/pop-to-root-tab :chat-stack) {:dispatch-later [{:ms 1000 :dispatch [:chat.ui/navigate-to-chat chat-id]}]}
(models.chat/navigate-to-chat chat-id)))) (navigation/pop-to-root-tab :chat-stack))))
(fx/defn handle-chat-removed (fx/defn handle-chat-removed
{:events [:chat-removed]} {:events [:chat-removed]}

View File

@ -105,6 +105,13 @@
(let [enter-step (get-in db [:keycard :pin :enter-step])] (let [enter-step (get-in db [:keycard :pin :enter-step])]
{:db (assoc-in db [:keycard :pin enter-step] [])})) {:db (assoc-in db [:keycard :pin enter-step] [])}))
(defn login-pin-screen-did-load
[{:keys [db]}]
(let [enter-step (get-in db [:keycard :pin :enter-step])]
{:db (-> db
(assoc-in [:keycard :pin enter-step] [])
(dissoc :intro-wizard :recovered-account?))}))
(defn multiaccounts-screen-did-load (defn multiaccounts-screen-did-load
[{:keys [db]}] [{:keys [db]}]
{:db (assoc-in db [:keycard :setup-step] nil)}) {:db (assoc-in db [:keycard :setup-step] nil)})
@ -240,9 +247,9 @@
(common/hide-connection-sheet) (common/hide-connection-sheet)
(when (and (not setup?) (when (and (not setup?)
(not on-verified-failure)) (not on-verified-failure))
(if exporting? (when exporting?
(navigation/navigate-back) (navigation/navigate-back)))
(navigation/navigate-to-cofx :enter-pin-settings nil))) ;(navigation/navigate-to-cofx :enter-pin-settings nil)))
(when (zero? pin-retries) (common/frozen-keycard-popup)) (when (zero? pin-retries) (common/frozen-keycard-popup))
(when on-verified-failure (when on-verified-failure
(fn [_] {:utils/dispatch-later (fn [_] {:utils/dispatch-later

View File

@ -55,7 +55,6 @@
[{:keys [db] :as cofx}] [{:keys [db] :as cofx}]
(fx/merge (fx/merge
cofx cofx
{:db (assoc db :keycard/new-account-sheet? false)}
(signing.core/discard) (signing.core/discard)
(fn [{:keys [db]}] (fn [{:keys [db]}]
{:db (-> db {:db (-> db
@ -138,7 +137,8 @@
{:events [:multiaccounts.login.callback/get-keycard-keys-success]} {:events [:multiaccounts.login.callback/get-keycard-keys-success]}
[{:keys [db] :as cofx} key-uid [encryption-public-key whisper-private-key :as creds]] [{:keys [db] :as cofx} key-uid [encryption-public-key whisper-private-key :as creds]]
(if (nil? creds) (if (nil? creds)
(navigation/navigate-to-cofx cofx :keycard-login-pin nil) (navigation/set-stack-root cofx :multiaccounts-stack [:multiaccounts
:keycard-login-pin])
(let [{:keys [identicon name]} (get-in db [:multiaccounts/multiaccounts key-uid]) (let [{:keys [identicon name]} (get-in db [:multiaccounts/multiaccounts key-uid])
multiaccount-data (types/clj->json {:name name multiaccount-data (types/clj->json {:name name
:key-uid key-uid :key-uid key-uid

View File

@ -1,10 +1,6 @@
(ns status-im.keycard.test-menu (ns status-im.keycard.test-menu
(:require [status-im.ui.components.react :as react] (:require [status-im.ui.components.react :as react]
[status-im.keycard.simulated-keycard :as simulated-keycard] [status-im.keycard.simulated-keycard :as simulated-keycard]))
[reagent.core :as reagent]
[status-im.utils.random :as random]))
(def ids (reagent/atom []))
(defn button [label accessibility-label handler] (defn button [label accessibility-label handler]
[react/view [react/view
@ -18,10 +14,7 @@
:accessibility-label accessibility-label} :accessibility-label accessibility-label}
label]]) label]])
(defn test-menu-view [id] (defn test-menu []
(fn []
(println id @ids)
(when (= id (last @ids))
[react/view [react/view
{:style {:position :absolute {:style {:position :absolute
:top 70 :top 70
@ -33,11 +26,4 @@
[button "conn sell" :connect-selected-card simulated-keycard/connect-selected-card] [button "conn sell" :connect-selected-card simulated-keycard/connect-selected-card]
[button "pair" :connect-pairing-card simulated-keycard/connect-pairing-card] [button "pair" :connect-pairing-card simulated-keycard/connect-pairing-card]
[button "disc" :disconnect-card simulated-keycard/disconnect-card] [button "disc" :disconnect-card simulated-keycard/disconnect-card]
[button "res" :keycard-reset-state simulated-keycard/reset-state]]))) [button "res" :keycard-reset-state simulated-keycard/reset-state]])
(defn test-menu []
(let [id (random/id)]
(reagent/create-class
{:component-did-mount (fn [] (swap! ids conj id))
:component-will-unmount (fn [] (reset! ids (vec (remove #(= % id) @ids))))
:reagent-render (test-menu-view id)})))

View File

@ -4,7 +4,9 @@
[status-im.keycard.common :as common] [status-im.keycard.common :as common]
[status-im.constants :as constants] [status-im.constants :as constants]
[status-im.ethereum.eip55 :as eip55] [status-im.ethereum.eip55 :as eip55]
[status-im.utils.hex :as utils.hex])) [status-im.utils.hex :as utils.hex]
[status-im.ui.screens.wallet.add-new.views :as add-new.views]
[status-im.bottom-sheet.core :as bottom-sheet]))
(fx/defn show-pin-sheet (fx/defn show-pin-sheet
{:events [:keycard/new-account-pin-sheet]} {:events [:keycard/new-account-pin-sheet]}
@ -13,9 +15,9 @@
cofx cofx
{:db (-> db {:db (-> db
(assoc-in [:keycard :pin :enter-step] :export-key) (assoc-in [:keycard :pin :enter-step] :export-key)
(update-in [:keycard :pin] dissoc :export-key) (update-in [:keycard :pin] dissoc :export-key))
(assoc :keycard/new-account-sheet? true)) :dismiss-keyboard nil}
:dismiss-keyboard nil})) (bottom-sheet/show-bottom-sheet {:view {:content add-new.views/pin}})))
(fx/defn verify-pin-with-delay (fx/defn verify-pin-with-delay
[cofx] [cofx]
@ -26,8 +28,8 @@
(fx/defn hide-pin-sheet (fx/defn hide-pin-sheet
{:events [:keycard/new-account-pin-sheet-hide]} {:events [:keycard/new-account-pin-sheet-hide]}
[{:keys [db]}] [cofx]
{:db (assoc db :keycard/new-account-sheet? false)}) (bottom-sheet/hide-bottom-sheet cofx))
(fx/defn generate-new-keycard-account (fx/defn generate-new-keycard-account
{:events [:wallet.accounts/generate-new-keycard-account]} {:events [:wallet.accounts/generate-new-keycard-account]}

View File

@ -97,7 +97,7 @@
:selected-storage-type :default :selected-storage-type :default
:selected-id (-> result first :id) :selected-id (-> result first :id)
:step :choose-key)))) :step :choose-key))))
:rnn-navigate-to-fx :choose-name}) :navigate-to-fx :choose-name})
(fx/defn generate-and-derive-addresses (fx/defn generate-and-derive-addresses
{:events [:generate-and-derive-addresses]} {:events [:generate-and-derive-addresses]}

View File

@ -119,7 +119,7 @@
(let [{:keys [key-uid password name identicon]} (:multiaccounts/login db)] (let [{:keys [key-uid password name identicon]} (:multiaccounts/login db)]
{:db (-> db {:db (-> db
(assoc-in [:multiaccounts/login :processing] true) (assoc-in [:multiaccounts/login :processing] true)
(dissoc :intro-wizard) (dissoc :intro-wizard :recovered-account?)
(update :keycard dissoc :flow)) (update :keycard dissoc :flow))
::login [key-uid ::login [key-uid
(types/clj->json {:name name (types/clj->json {:name name
@ -537,7 +537,7 @@
(fx/merge (fx/merge
cofx cofx
{:db (update db :keycard dissoc :application-info) {:db (update db :keycard dissoc :application-info)
:rnn-navigate-to-fx (if keycard-multiaccount? :keycard-login-pin :login)} :navigate-to-fx (if keycard-multiaccount? :keycard-login-pin :login)}
(open-login (select-keys multiaccount [:key-uid :name :public-key :identicon :images]))))) (open-login (select-keys multiaccount [:key-uid :name :public-key :identicon :images])))))
(fx/defn hide-keycard-banner (fx/defn hide-keycard-banner

View File

@ -17,6 +17,7 @@
should-send-metrics? (get-in db [:multiaccount :anon-metrics/should-send?])] should-send-metrics? (get-in db [:multiaccount :anon-metrics/should-send?])]
(fx/merge cofx (fx/merge cofx
{:init-root-fx :progress {:init-root-fx :progress
:hide-popover nil
::logout nil ::logout nil
::multiaccounts/webview-debug-changed false ::multiaccounts/webview-debug-changed false
::disable-local-notifications nil ::disable-local-notifications nil

View File

@ -15,7 +15,7 @@
{:db {:db
(-> (assoc db :view-id go-to-view-id) (-> (assoc db :view-id go-to-view-id)
(all-screens-params go-to-view-id screen-params)) (all-screens-params go-to-view-id screen-params))
:rnn-navigate-to-fx go-to-view-id :navigate-to-fx go-to-view-id
;; simulate a navigate-to event so it can be captured be anon-metrics ;; simulate a navigate-to event so it can be captured be anon-metrics
::anon-metrics/transform-and-log {:coeffects {:event [:navigate-to go-to-view-id screen-params]}}}) ::anon-metrics/transform-and-log {:coeffects {:event [:navigate-to go-to-view-id screen-params]}}})
@ -27,12 +27,12 @@
(fx/defn navigate-back (fx/defn navigate-back
{:events [:navigate-back]} {:events [:navigate-back]}
[_] [_]
{:rnn-navigate-back-fx nil}) {:navigate-back-fx nil})
(fx/defn pop-to-root-tab (fx/defn pop-to-root-tab
{:events [:pop-to-root-tab]} {:events [:pop-to-root-tab]}
[_ tab] [_ tab]
{:rnn-pop-to-root-tab-fx tab}) {:pop-to-root-tab-fx tab})
(fx/defn set-stack-root (fx/defn set-stack-root
{:events [:set-stack-root]} {:events [:set-stack-root]}
@ -42,7 +42,7 @@
(fx/defn change-tab (fx/defn change-tab
{:events [:navigate-change-tab]} {:events [:navigate-change-tab]}
[_ tab] [_ tab]
{:rnn-change-tab-fx tab}) {:change-tab-fx tab})
(fx/defn navigate-replace (fx/defn navigate-replace
{:events [:navigate-replace] {:events [:navigate-replace]
@ -71,30 +71,20 @@
[_ root-id comp-id] [_ root-id comp-id]
{:init-root-with-component-fx [root-id comp-id]}) {:init-root-with-component-fx [root-id comp-id]})
(fx/defn rnn-navigate-to
{:events [:rnn-navigate-to]}
[_ key]
{:rnn-navigate-to-fx key})
(fx/defn rnn-navigate-back
{:events [:rnn-navigate-back]}
[_]
{:rnn-navigate-back-fx nil})
(fx/defn change-tab-count (fx/defn change-tab-count
{:events [:change-tab-count]} {:events [:change-tab-count]}
[_ tab cnt] [_ tab cnt]
{:rnn-change-tab-count-fx [tab cnt]}) {:change-tab-count-fx [tab cnt]})
(fx/defn hide-signing-sheet (fx/defn hide-signing-sheet
{:events [:hide-signing-sheet]} {:events [:hide-signing-sheet]}
[_] [_]
{:rnn-hide-signing-sheet nil}) {:hide-signing-sheet nil})
(fx/defn hide-select-acc-sheet (fx/defn hide-select-acc-sheet
{:events [:hide-select-acc-sheet]} {:events [:hide-select-acc-sheet]}
[_] [_]
{:rnn-hide-select-acc-sheet nil}) {:hide-select-acc-sheet nil})

View File

@ -5,12 +5,13 @@
[status-im.ui.screens.views :as views] [status-im.ui.screens.views :as views]
[status-im.utils.platform :as platform] [status-im.utils.platform :as platform]
[status-im.navigation.roots :as roots] [status-im.navigation.roots :as roots]
["react-native-navigation" :refer (Navigation)]
["react-native-gesture-handler" :refer (gestureHandlerRootHOC)]
[status-im.ui.components.react :as react] [status-im.ui.components.react :as react]
[quo.components.text-input :as quo.text-input] [quo.components.text-input :as quo.text-input]
[status-im.ui.components.icons.icons :as icons] [status-im.ui.components.icons.icons :as icons]
[quo.design-system.colors :as quo.colors] [quo.design-system.colors :as quo.colors]
[status-im.utils.fx :as fx]
["react-native-navigation" :refer (Navigation)]
["react-native-gesture-handler" :refer (gestureHandlerRootHOC)]
["react-native" :as rn])) ["react-native" :as rn]))
(def debug? ^boolean js/goog.DEBUG) (def debug? ^boolean js/goog.DEBUG)
@ -34,6 +35,14 @@
(defonce rset-lazy-reg (defonce rset-lazy-reg
(.setLazyComponentRegistrator Navigation reg-comp)) (.setLazyComponentRegistrator Navigation reg-comp))
(defn dismiss-all-modals []
(when @curr-modal
(reset! curr-modal false)
(reset! dissmissing true)
(doseq [modal @modals]
(.dismissModal Navigation (name modal)))
(reset! modals [])))
;; PUSH SCREEN ;; PUSH SCREEN
(defn navigate [comp] (defn navigate [comp]
(let [{:keys [options]} (get views/screens comp)] (let [{:keys [options]} (get views/screens comp)]
@ -45,10 +54,7 @@
(roots/status-bar-options) (roots/status-bar-options)
(roots/merge-top-bar (roots/topbar-options) options))}})) (roots/merge-top-bar (roots/topbar-options) options))}}))
;;if we push the screen from modal, we want to dismiss all modals ;;if we push the screen from modal, we want to dismiss all modals
(when @curr-modal (dismiss-all-modals)))
(reset! curr-modal false)
(reset! modals [])
(.dismissAllModals Navigation))))
;; OPEN MODAL ;; OPEN MODAL
(defn update-modal-topbar-options [options] (defn update-modal-topbar-options [options]
@ -67,7 +73,6 @@
(if @dissmissing (if @dissmissing
(reset! dissmissing comp) (reset! dissmissing comp)
(do (do
(println "SHOW MODAL" comp)
(reset! curr-modal true) (reset! curr-modal true)
(swap! modals conj comp) (swap! modals conj comp)
(.showModal Navigation (.showModal Navigation
@ -84,7 +89,6 @@
;; DISSMISS MODAL ;; DISSMISS MODAL
(defn dissmissModal [] (defn dissmissModal []
(println "dissmissModal" @modals)
(reset! dissmissing true) (reset! dissmissing true)
(.dismissModal Navigation (name (last @modals)))) (.dismissModal Navigation (name (last @modals))))
@ -105,7 +109,6 @@
(.registerModalDismissedListener (.registerModalDismissedListener
(.events Navigation) (.events Navigation)
(fn [_] (fn [_]
(println "DismissedListener" @dissmissing @modals)
(if (> (count @modals) 1) (if (> (count @modals) 1)
(let [new-modals (butlast @modals)] (let [new-modals (butlast @modals)]
(reset! modals (vec new-modals)) (reset! modals (vec new-modals))
@ -129,6 +132,7 @@
(when-let [{:keys [on-focus]} (get views/screens view-id)] (when-let [{:keys [on-focus]} (get views/screens view-id)]
(when (and (not= view-id :bottom-sheet) (not= view-id :popover)) (when (and (not= view-id :bottom-sheet) (not= view-id :popover))
(re-frame/dispatch [:set :view-id view-id]) (re-frame/dispatch [:set :view-id view-id])
(re-frame/dispatch [:screens/on-will-focus view-id])
(when on-focus (when on-focus
(re-frame/dispatch on-focus)) (re-frame/dispatch on-focus))
(when-not @curr-modal (when-not @curr-modal
@ -159,12 +163,23 @@
(reset! root-id @root-comp-id) (reset! root-id @root-comp-id)
(.setRoot Navigation (clj->js (get (roots/roots) new-root-id))))) (.setRoot Navigation (clj->js (get (roots/roots) new-root-id)))))
(fx/defn set-multiaccount-root
{:events [::set-multiaccount-root]}
[{:keys [db]}]
(let [key-uid (get-in db [:multiaccounts/login :key-uid])
keycard-account? (boolean (get-in db [:multiaccounts/multiaccounts
key-uid
:keycard-pairing]))]
{:init-root-fx (if keycard-account? :multiaccounts-keycard :multiaccounts)}))
(defonce rset-app-launched (defonce rset-app-launched
(.registerAppLaunchedListener (.events Navigation) (.registerAppLaunchedListener (.events Navigation)
(fn [] (fn []
(if (or (= @root-id :multiaccounts) (= @root-id :multiaccounts-keycard))
(re-frame/dispatch-sync [::set-multiaccount-root])
(when @root-id (when @root-id
(reset! root-comp-id @root-id) (reset! root-comp-id @root-id)
(.setRoot Navigation (clj->js (get (roots/roots) @root-id)))) (.setRoot Navigation (clj->js (get (roots/roots) @root-id)))))
(.hide ^js splash-screen)))) (.hide ^js splash-screen))))
(defn get-screen-component [comp] (defn get-screen-component [comp]
@ -199,14 +214,16 @@
:profile 4}) :profile 4})
(re-frame/reg-fx (re-frame/reg-fx
:rnn-change-tab-fx :change-tab-fx
(fn [tab] (fn [tab]
(reset! root-comp-id (get tab-root-ids (get tab-key-idx tab))) (reset! root-comp-id (get tab-root-ids (get tab-key-idx tab)))
(.mergeOptions Navigation "tabs-stack" (clj->js {:bottomTabs {:currentTabIndex (get tab-key-idx tab)}})))) (.mergeOptions Navigation "tabs-stack" (clj->js {:bottomTabs {:currentTabIndex (get tab-key-idx tab)}}))
;;when we change tab we want to dismiss all modals
(dismiss-all-modals)))
;issue on ios https://github.com/wix/react-native-navigation/issues/7146 ;issue on ios https://github.com/wix/react-native-navigation/issues/7146
(re-frame/reg-fx (re-frame/reg-fx
:rnn-change-tab-count-fx :change-tab-count-fx
(fn [[tab cnt]] (fn [[tab cnt]]
(.mergeOptions Navigation (.mergeOptions Navigation
(name (get tab-root-ids (get tab-key-idx tab))) (name (get tab-root-ids (get tab-key-idx tab)))
@ -225,8 +242,9 @@
{:dotIndicator {:visible false} :badge nil}))})))) {:dotIndicator {:visible false} :badge nil}))}))))
(re-frame/reg-fx (re-frame/reg-fx
:rnn-pop-to-root-tab-fx :pop-to-root-tab-fx
(fn [comp] (fn [comp]
(dismiss-all-modals)
(.popToRoot Navigation (name comp)))) (.popToRoot Navigation (name comp))))
(defonce register-bottom-tab-reg (defonce register-bottom-tab-reg
@ -240,7 +258,7 @@
;; OVERLAY (Popover and bottom sheets) ;; OVERLAY (Popover and bottom sheets)
(defn dissmiss-overlay [comp] (defn dissmiss-overlay [comp]
(.dismissOverlay Navigation comp)) (.catch (.dismissOverlay Navigation comp) #()))
(defn show-overlay [comp] (defn show-overlay [comp]
(dissmiss-overlay comp) (dissmiss-overlay comp)
@ -263,8 +281,8 @@
(fn [] (gestureHandlerRootHOC views/popover-comp)) (fn [] (gestureHandlerRootHOC views/popover-comp))
(fn [] views/popover-comp))) (fn [] views/popover-comp)))
(re-frame/reg-fx :rnn-show-popover (fn [] (show-overlay "popover"))) (re-frame/reg-fx :show-popover (fn [] (show-overlay "popover")))
(re-frame/reg-fx :rnn-hide-popover (fn [] (dissmiss-overlay "popover"))) (re-frame/reg-fx :hide-popover (fn [] (dissmiss-overlay "popover")))
;; BOTTOM SHEETS ;; BOTTOM SHEETS
(defonce bottom-sheet-reg (defonce bottom-sheet-reg
@ -273,8 +291,8 @@
(fn [] (gestureHandlerRootHOC views/sheet-comp)) (fn [] (gestureHandlerRootHOC views/sheet-comp))
(fn [] views/sheet-comp))) (fn [] views/sheet-comp)))
(re-frame/reg-fx :rnn-show-bottom-sheet (fn [] (show-overlay "bottom-sheet"))) (re-frame/reg-fx :show-bottom-sheet (fn [] (show-overlay "bottom-sheet")))
(re-frame/reg-fx :rnn-hide-bottom-sheet (fn [] (dissmiss-overlay "bottom-sheet"))) (re-frame/reg-fx :hide-bottom-sheet (fn [] (dissmiss-overlay "bottom-sheet")))
;; SIGNING ;; SIGNING
@ -284,8 +302,8 @@
(fn [] (gestureHandlerRootHOC views/signing-comp)) (fn [] (gestureHandlerRootHOC views/signing-comp))
(fn [] views/signing-comp))) (fn [] views/signing-comp)))
(re-frame/reg-fx :rnn-show-signing-sheet (fn [] (show-overlay "signing-sheet"))) (re-frame/reg-fx :show-signing-sheet (fn [] (show-overlay "signing-sheet")))
(re-frame/reg-fx :rnn-hide-signing-sheet (fn [] (dissmiss-overlay "signing-sheet"))) (re-frame/reg-fx :hide-signing-sheet (fn [] (dissmiss-overlay "signing-sheet")))
;; Select account ;; Select account
;; TODO why is this not a regular bottom sheet ? ;; TODO why is this not a regular bottom sheet ?
@ -296,20 +314,20 @@
(fn [] (gestureHandlerRootHOC views/select-acc-comp)) (fn [] (gestureHandlerRootHOC views/select-acc-comp))
(fn [] views/select-acc-comp))) (fn [] views/select-acc-comp)))
(re-frame/reg-fx :rnn-show-select-acc-sheet (fn [] (show-overlay "select-acc-sheet"))) (re-frame/reg-fx :show-select-acc-sheet (fn [] (show-overlay "select-acc-sheet")))
(re-frame/reg-fx :rnn-hide-select-acc-sheet (fn [] (dissmiss-overlay "select-acc-sheet"))) (re-frame/reg-fx :hide-select-acc-sheet (fn [] (dissmiss-overlay "select-acc-sheet")))
;; NAVIGATION ;; NAVIGATION
(re-frame/reg-fx (re-frame/reg-fx
:rnn-navigate-to-fx :navigate-to-fx
(fn [key] (fn [key]
;;TODO WHY #{:home} ? we need to review all navigations to root screens home, wallet profile etc ;;TODO WHY #{:home} ? we need to review all navigations to root screens home, wallet profile etc
(when-not (#{:home} key) (when-not (#{:home} key)
(navigate key)))) (navigate key))))
(re-frame/reg-fx (re-frame/reg-fx
:rnn-navigate-back-fx :navigate-back-fx
(fn [] (fn []
(if @curr-modal (if @curr-modal
(dissmissModal) (dissmissModal)

View File

@ -4,7 +4,7 @@
(fx/defn show-popover (fx/defn show-popover
{:events [:show-popover]} {:events [:show-popover]}
[_ value] [_ value]
{:rnn-show-popover nil {:show-popover nil
;;TODO refactor popover just start animation on mount ;;TODO refactor popover just start animation on mount
:dispatch-later [{:ms 250 :dispatch [:show-popover-db value]}] :dispatch-later [{:ms 250 :dispatch [:show-popover-db value]}]
:dismiss-keyboard nil}) :dismiss-keyboard nil})
@ -18,4 +18,4 @@
{:events [:hide-popover]} {:events [:hide-popover]}
[{:keys [db]}] [{:keys [db]}]
{:db (dissoc db :popover/popover) {:db (dissoc db :popover/popover)
:rnn-hide-popover nil}) :hide-popover nil})

View File

@ -76,7 +76,8 @@
(fx/defn handle-eip681 [cofx data] (fx/defn handle-eip681 [cofx data]
(fx/merge cofx (fx/merge cofx
{:dispatch [:wallet/parse-eip681-uri-and-resolve-ens data]} {:dispatch [:wallet/parse-eip681-uri-and-resolve-ens data]}
(navigation/navigate-to-cofx :tabs {:screen :wallet}))) (navigation/change-tab :wallet)
(navigation/pop-to-root-tab :wallet-stack)))
(fx/defn match-scan (fx/defn match-scan
{:events [::match-scanned-value]} {:events [::match-scanned-value]}
@ -88,7 +89,8 @@
:contact (handle-view-profile cofx data) :contact (handle-view-profile cofx data)
:browser (handle-browse cofx data) :browser (handle-browse cofx data)
:eip681 (handle-eip681 cofx data) :eip681 (handle-eip681 cofx data)
{:utils/show-popup {:title (i18n/label :t/unable-to-read-this-code) {:dispatch [:navigate-back]
:utils/show-popup {:title (i18n/label :t/unable-to-read-this-code)
:on-dismiss #(re-frame/dispatch [:pop-to-root-tab :chat-stack])}})) :on-dismiss #(re-frame/dispatch [:pop-to-root-tab :chat-stack])}}))
(fx/defn on-scan (fx/defn on-scan

View File

@ -216,7 +216,7 @@
:else :password) :else :password)
:formatted-data (if typed? (types/json->clj data) (ethereum/hex->text data)) :formatted-data (if typed? (types/json->clj data) (ethereum/hex->text data))
:keycard-step (when pinless? :connect)}) :keycard-step (when pinless? :connect)})
:rnn-show-signing-sheet nil} :show-signing-sheet nil}
#(when-not wallet-set-up-passed? #(when-not wallet-set-up-passed?
{:dispatch-n [[:show-popover {:view :signing-phrase}]]}) {:dispatch-n [[:show-popover {:view :signing-phrase}]]})
(when pinless? (when pinless?
@ -230,7 +230,7 @@
{:db (assoc db {:db (assoc db
:signing/queue (drop-last queue) :signing/queue (drop-last queue)
:signing/tx (prepare-tx db tx)) :signing/tx (prepare-tx db tx))
:rnn-show-signing-sheet nil :show-signing-sheet nil
:dismiss-keyboard nil} :dismiss-keyboard nil}
#(when-not wallet-set-up-passed? #(when-not wallet-set-up-passed?
{:dispatch-n [[:show-popover {:view :signing-phrase}]]}) {:dispatch-n [[:show-popover {:view :signing-phrase}]]})

View File

@ -195,7 +195,6 @@
(reg-root-key-sub ::pagination-info :pagination-info) (reg-root-key-sub ::pagination-info :pagination-info)
;; keycard ;; keycard
(reg-root-key-sub :keycard/new-account-sheet? :keycard/new-account-sheet?)
(reg-root-key-sub :keycard/banner-hidden :keycard/banner-hidden) (reg-root-key-sub :keycard/banner-hidden :keycard/banner-hidden)
;; delete profile ;; delete profile

View File

@ -16,7 +16,7 @@
keyboard (react/state {:height 0 keyboard (react/state {:height 0
:duration min-duration :duration min-duration
:end-position height :end-position height
:max-height (+ bottom default-kb-height)})] :max-height (+ (if platform/ios? bottom 0) default-kb-height)})]
(react/effect! (react/effect!
(fn [] (fn []
(letfn [(dimensions-change [evt] (letfn [(dimensions-change [evt]

View File

@ -323,7 +323,7 @@
on-close #(set-active-panel nil)] on-close #(set-active-panel nil)]
(reagent/create-class (reagent/create-class
{:component-will-unmount #(re-frame/dispatch-sync [:close-chat curr-chat-id]) {:component-will-unmount #(re-frame/dispatch-sync [:close-chat curr-chat-id])
:component-did-mount (fn [] (js/setTimeout #(re-frame/dispatch [:set :ignore-close-chat false]) 200)) :component-did-mount (fn [] (js/setTimeout #(re-frame/dispatch [:set :ignore-close-chat false]) 1000))
:reagent-render :reagent-render
(fn [] (fn []
(let [{:keys [chat-id show-input? group-chat admins invitation-admin] :as chat} (let [{:keys [chat-id show-input? group-chat admins invitation-admin] :as chat}

View File

@ -195,8 +195,9 @@
[blank-page (i18n/label :t/community-info-not-found)]]) [blank-page (i18n/label :t/community-info-not-found)]])
(defn community [] (defn community []
(let [{:keys [community-id]} (<sub [:get-screen-params]) (let [{:keys [community-id]} (<sub [:get-screen-params])]
{:keys [id chats name images members permissions color joined can-request-access? (fn []
(let [{:keys [id chats name images members permissions color joined can-request-access?
can-join? requested-to-join-at admin] can-join? requested-to-join-at admin]
:as community} (<sub [:communities/community community-id])] :as community} (<sub [:communities/community community-id])]
(if community (if community
@ -251,4 +252,4 @@
:center [quo/button {:on-press #(>evt [::communities/join id]) :center [quo/button {:on-press #(>evt [::communities/join id])
:type :secondary} :type :secondary}
(i18n/label :t/follow)]}]))] (i18n/label :t/follow)]}]))]
[unknown-community]))) [unknown-community])))))

View File

@ -25,7 +25,7 @@
(utils/show-question (utils/show-question
(i18n/label :t/are-you-sure-to-cancel) (i18n/label :t/are-you-sure-to-cancel)
(i18n/label :t/you-will-start-from-scratch) (i18n/label :t/you-will-start-from-scratch)
#(re-frame/dispatch [:rnn-navigate-back])))}}] #(re-frame/dispatch [:navigate-back])))}}]
[ui/title-with-description :t/intro-wizard-title2 :t/intro-wizard-text2] [ui/title-with-description :t/intro-wizard-title2 :t/intro-wizard-text2]
[ui/learn-more :t/about-names-title :t/about-names-content] [ui/learn-more :t/about-names-title :t/about-names-content]
[react/view {:style {:flex 1 [react/view {:style {:flex 1
@ -52,7 +52,7 @@
:icon [react/image {:source {:uri (identicon/identicon public-key)} :icon [react/image {:source {:uri (identicon/identicon public-key)}
:resize-mode :cover :resize-mode :cover
:style styles/multiaccount-image}]}]))]] :style styles/multiaccount-image}]}]))]]
[ui/next-button #(dispatch-and-chill [:rnn-navigate-to :select-key-storage] 300) false]])) [ui/next-button #(dispatch-and-chill [:navigate-to :select-key-storage] 300) false]]))
(defn get-your-keys-image [] (defn get-your-keys-image []
(let [dimensions (reagent/atom {})] (let [dimensions (reagent/atom {})]

View File

@ -43,6 +43,6 @@
(if recovering? (if recovering?
[:multiaccounts.recover/select-storage-next-pressed] [:multiaccounts.recover/select-storage-next-pressed]
[:keycard/start-onboarding-flow]) [:keycard/start-onboarding-flow])
[:rnn-navigate-to :create-password]) [:navigate-to :create-password])
300) 300)
false]])) false]]))

View File

@ -537,6 +537,8 @@
;[Communities] Invite people ;[Communities] Invite people
{:name :invite-people-community {:name :invite-people-community
;;TODO dyn title
:options {:topBar {:visible false}}
:component communities.invite/invite :component communities.invite/invite
:insets {:bottom true}} :insets {:bottom true}}

View File

@ -56,20 +56,19 @@
(defn screen [key] (defn screen [key]
(reagent.core/reactify-component (reagent.core/reactify-component
(fn [] (fn []
(let [{:keys [component insets]} (get (if js/goog.DEBUG (get-screens) screens) (keyword key))]
^{:key (str "root" key @reloader/cnt)} ^{:key (str "root" key @reloader/cnt)}
[react/safe-area-provider [react/safe-area-provider
[react/safe-area-consumer [react/safe-area-consumer
(fn [insets] (fn [safe-insets]
(reagent/as-element (reagent/as-element
[react/view {:style (wrapped-screen-style [react/view {:style (wrapped-screen-style
{:insets (get-in screens [(keyword key) :insets])} {:insets insets}
insets)} safe-insets)}
[inactive] [inactive]
[(get-in (if js/goog.DEBUG (get-screens) screens) [(keyword key) :component])]]))] [component]]))]
(when js/goog.DEBUG (when js/goog.DEBUG
[reloader/reload-view]) [reloader/reload-view])]))))
(when config/keycard-test-menu-enabled?
[keycard.test-menu/test-menu])])))
(defn component [comp] (defn component [comp]
(reagent/reactify-component (reagent/reactify-component
@ -85,9 +84,7 @@
[inactive] [inactive]
[popover/popover] [popover/popover]
(when js/goog.DEBUG (when js/goog.DEBUG
[reloader/reload-view]) [reloader/reload-view])])))
(when config/keycard-test-menu-enabled?
[keycard.test-menu/test-menu])])))
(def sheet-comp (def sheet-comp
(reagent/reactify-component (reagent/reactify-component
@ -109,9 +106,7 @@
[inactive] [inactive]
[signing/signing] [signing/signing]
(when js/goog.DEBUG (when js/goog.DEBUG
[reloader/reload-view]) [reloader/reload-view])])))
(when config/keycard-test-menu-enabled?
[keycard.test-menu/test-menu])])))
(def select-acc-comp (def select-acc-comp
(reagent/reactify-component (reagent/reactify-component
@ -121,6 +116,4 @@
[inactive] [inactive]
[wallet.send.views/select-account] [wallet.send.views/select-account]
(when js/goog.DEBUG (when js/goog.DEBUG
[reloader/reload-view]) [reloader/reload-view])])))
(when config/keycard-test-menu-enabled?
[keycard.test-menu/test-menu])])))

View File

@ -15,8 +15,7 @@
[status-im.ethereum.core :as ethereum] [status-im.ethereum.core :as ethereum]
[status-im.utils.security :as security] [status-im.utils.security :as security]
[clojure.string :as string] [clojure.string :as string]
[quo.core :as quo] [quo.core :as quo]))
[status-im.ui.components.bottom-panel.views :as bottom-panel]))
(defn add-account-topbar [type] (defn add-account-topbar [type]
(let [title (case type (let [title (case type
@ -136,22 +135,6 @@
:error-label error-label :error-label error-label
:step :export-key}]])) :step :export-key}]]))
(defn pin-sheet []
(let [show-sheet? @(re-frame/subscribe [:keycard/new-account-sheet?])
{window-height :height} @(re-frame/subscribe [:dimensions/window])]
[bottom-panel/bottom-panel
show-sheet?
(fn [_]
[react/view {:style
{:background-color colors/white
:border-top-right-radius 16
:border-top-left-radius 16
:padding-bottom 40
:flex 1}}
[pin]])
window-height
#()]))
(defview add-account [] (defview add-account []
(letsubs [{:keys [type account] :as add-account} [:add-account] (letsubs [{:keys [type account] :as add-account} [:add-account]
add-account-disabled? [:add-account-disabled?] add-account-disabled? [:add-account-disabled?]
@ -161,7 +144,7 @@
:ignore-offset true} :ignore-offset true}
[add-account-topbar type] [add-account-topbar type]
[react/scroll-view {:keyboard-should-persist-taps :handled [react/scroll-view {:keyboard-should-persist-taps :handled
:style {:flex 1}} :style {:flex 1 :padding-top 20}}
(when (or (not keycard?) (when (or (not keycard?)
(= type :watch)) (= type :watch))
[settings add-account entered-password]) [settings add-account entered-password])
@ -189,5 +172,4 @@
(not keycard?) (not keycard?)
(not (spec/valid? ::multiaccounts.db/password (not (spec/valid? ::multiaccounts.db/password
@entered-password)))))} @entered-password)))))}
(i18n/label :t/add-account)]}] (i18n/label :t/add-account)]}]]))
[pin-sheet]]))

View File

@ -299,7 +299,7 @@
:db (-> db :db (-> db
(assoc :multiaccount/accounts new-accounts) (assoc :multiaccount/accounts new-accounts)
(update-in [:wallet :accounts] dissoc deleted-address))} (update-in [:wallet :accounts] dissoc deleted-address))}
(navigation/navigate-to-cofx :wallet nil)))) (navigation/pop-to-root-tab :wallet-stack))))
(fx/defn view-only-qr-scanner-result (fx/defn view-only-qr-scanner-result
{:events [:wallet.add-new/qr-scanner-result]} {:events [:wallet.add-new/qr-scanner-result]}

View File

@ -25,7 +25,6 @@
[status-im.utils.mobile-sync :as mobile-network-utils] [status-im.utils.mobile-sync :as mobile-network-utils]
[status-im.utils.datetime :as datetime] [status-im.utils.datetime :as datetime]
status-im.wallet.recipient.core status-im.wallet.recipient.core
[status-im.ui.screens.wallet.signing-phrase.views :as signing-phrase]
[status-im.async-storage.core :as async-storage] [status-im.async-storage.core :as async-storage]
[status-im.popover.core :as popover.core] [status-im.popover.core :as popover.core]
[clojure.set :as clojure.set])) [clojure.set :as clojure.set]))
@ -765,8 +764,8 @@
[{:keys [db]}] [{:keys [db]}]
(let [wallet-set-up-passed? (get-in db [:multiaccount :wallet-set-up-passed?]) (let [wallet-set-up-passed? (get-in db [:multiaccount :wallet-set-up-passed?])
sign-phrase-showed? (get db :wallet/sign-phrase-showed?)] sign-phrase-showed? (get db :wallet/sign-phrase-showed?)]
{:dispatch-n [[:wallet.ui/pull-to-refresh] ;TODO temporary simple fix for v1 {:dispatch-n [[:wallet.ui/pull-to-refresh]] ;TODO temporary simple fix for v1
[:show-popover {:view [signing-phrase/signing-phrase]}]] ;;[:show-popover {:view [signing-phrase/signing-phrase]}]]
:db (if (or wallet-set-up-passed? sign-phrase-showed?) :db (if (or wallet-set-up-passed? sign-phrase-showed?)
db db
(assoc db :wallet/sign-phrase-showed? true))})) (assoc db :wallet/sign-phrase-showed? true))}))