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

View File

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

View File

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

View File

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

View File

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

View File

@ -193,11 +193,11 @@
:keycard-settings (keycard/settings-screen-did-load %)
:reset-card (keycard/reset-card-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 %)
:keycard-authentication-method (keycard/authentication-method-screen-did-load %)
:multiaccounts (keycard/multiaccounts-screen-did-load %)
(:wallet-stack :wallet) (wallet/wallet-will-focus %)
:wallet (wallet/wallet-will-focus %)
nil)))
;;TODO :replace by named events

View File

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

View File

@ -105,6 +105,13 @@
(let [enter-step (get-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
[{:keys [db]}]
{:db (assoc-in db [:keycard :setup-step] nil)})
@ -240,9 +247,9 @@
(common/hide-connection-sheet)
(when (and (not setup?)
(not on-verified-failure))
(if exporting?
(navigation/navigate-back)
(navigation/navigate-to-cofx :enter-pin-settings nil)))
(when exporting?
(navigation/navigate-back)))
;(navigation/navigate-to-cofx :enter-pin-settings nil)))
(when (zero? pin-retries) (common/frozen-keycard-popup))
(when on-verified-failure
(fn [_] {:utils/dispatch-later

View File

@ -55,7 +55,6 @@
[{:keys [db] :as cofx}]
(fx/merge
cofx
{:db (assoc db :keycard/new-account-sheet? false)}
(signing.core/discard)
(fn [{:keys [db]}]
{:db (-> db
@ -138,7 +137,8 @@
{:events [:multiaccounts.login.callback/get-keycard-keys-success]}
[{:keys [db] :as cofx} key-uid [encryption-public-key whisper-private-key :as 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])
multiaccount-data (types/clj->json {:name name
:key-uid key-uid

View File

@ -1,10 +1,6 @@
(ns status-im.keycard.test-menu
(:require [status-im.ui.components.react :as react]
[status-im.keycard.simulated-keycard :as simulated-keycard]
[reagent.core :as reagent]
[status-im.utils.random :as random]))
(def ids (reagent/atom []))
[status-im.keycard.simulated-keycard :as simulated-keycard]))
(defn button [label accessibility-label handler]
[react/view
@ -18,26 +14,16 @@
:accessibility-label accessibility-label}
label]])
(defn test-menu-view [id]
(fn []
(println id @ids)
(when (= id (last @ids))
[react/view
{:style {:position :absolute
:top 70
:right 0
:width 50
:justify-content :center
:align-items :center}}
[button "conn" :connect-card simulated-keycard/connect-card]
[button "conn sell" :connect-selected-card simulated-keycard/connect-selected-card]
[button "pair" :connect-pairing-card simulated-keycard/connect-pairing-card]
[button "disc" :disconnect-card simulated-keycard/disconnect-card]
[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)})))
[react/view
{:style {:position :absolute
:top 70
:right 0
:width 50
:justify-content :center
:align-items :center}}
[button "conn" :connect-card simulated-keycard/connect-card]
[button "conn sell" :connect-selected-card simulated-keycard/connect-selected-card]
[button "pair" :connect-pairing-card simulated-keycard/connect-pairing-card]
[button "disc" :disconnect-card simulated-keycard/disconnect-card]
[button "res" :keycard-reset-state simulated-keycard/reset-state]])

View File

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

View File

@ -97,7 +97,7 @@
:selected-storage-type :default
:selected-id (-> result first :id)
:step :choose-key))))
:rnn-navigate-to-fx :choose-name})
:navigate-to-fx :choose-name})
(fx/defn 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)]
{:db (-> db
(assoc-in [:multiaccounts/login :processing] true)
(dissoc :intro-wizard)
(dissoc :intro-wizard :recovered-account?)
(update :keycard dissoc :flow))
::login [key-uid
(types/clj->json {:name name
@ -537,7 +537,7 @@
(fx/merge
cofx
{: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])))))
(fx/defn hide-keycard-banner

View File

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

View File

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

View File

@ -4,7 +4,7 @@
(fx/defn show-popover
{:events [:show-popover]}
[_ value]
{:rnn-show-popover nil
{:show-popover nil
;;TODO refactor popover just start animation on mount
:dispatch-later [{:ms 250 :dispatch [:show-popover-db value]}]
:dismiss-keyboard nil})
@ -18,4 +18,4 @@
{:events [:hide-popover]}
[{:keys [db]}]
{: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/merge cofx
{: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
{:events [::match-scanned-value]}
@ -88,7 +89,8 @@
:contact (handle-view-profile cofx data)
:browser (handle-browse 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])}}))
(fx/defn on-scan

View File

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

View File

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

View File

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

View File

@ -323,7 +323,7 @@
on-close #(set-active-panel nil)]
(reagent/create-class
{: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
(fn []
(let [{:keys [chat-id show-input? group-chat admins invitation-admin] :as chat}

View File

@ -195,60 +195,61 @@
[blank-page (i18n/label :t/community-info-not-found)]])
(defn community []
(let [{:keys [community-id]} (<sub [:get-screen-params])
{:keys [id chats name images members permissions color joined can-request-access?
can-join? requested-to-join-at admin]
:as community} (<sub [:communities/community community-id])]
(if community
[rn/view {:style {:flex 1}}
[topbar/topbar
{:content
[toolbar-content
id
name
color
images
(not= (:access permissions) constants/community-no-membership-access)
(count members)]
:right-accessories
(when (or admin joined)
[{:icon :main-icons/more
:accessibility-label :community-menu-button
:on-press #(>evt [:bottom-sheet/show-sheet
{:content (fn []
[community-actions community])}])}])}]
(if joined
[community-channel-list id]
[community-channel-preview-list id chats])
(when admin
[components.plus-button/plus-button
{:on-press #(>evt [:bottom-sheet/show-sheet
{:content (fn []
[community-plus-actions community])}])
:accessibility-label :new-chat-button}])
(when-not joined
(cond
can-join?
[toolbar/toolbar
{:show-border? true
:center [quo/button {:on-press #(>evt [::communities/join id])
:type :secondary}
(i18n/label :t/join)]}]
can-request-access?
(if (and (pos? requested-to-join-at)
(not (can-request-access-again? requested-to-join-at)))
[toolbar/toolbar
{:show-border? true
:left [quo/text {:color :secondary} (i18n/label :t/membership-request-pending)]}]
[toolbar/toolbar
{:show-border? true
:center [quo/button {:on-press #(>evt [::communities/request-to-join id])
:type :secondary}
(i18n/label :t/request-access)]}])
:else
[toolbar/toolbar
{:show-border? true
:center [quo/button {:on-press #(>evt [::communities/join id])
:type :secondary}
(i18n/label :t/follow)]}]))]
[unknown-community])))
(let [{:keys [community-id]} (<sub [:get-screen-params])]
(fn []
(let [{:keys [id chats name images members permissions color joined can-request-access?
can-join? requested-to-join-at admin]
:as community} (<sub [:communities/community community-id])]
(if community
[rn/view {:style {:flex 1}}
[topbar/topbar
{:content
[toolbar-content
id
name
color
images
(not= (:access permissions) constants/community-no-membership-access)
(count members)]
:right-accessories
(when (or admin joined)
[{:icon :main-icons/more
:accessibility-label :community-menu-button
:on-press #(>evt [:bottom-sheet/show-sheet
{:content (fn []
[community-actions community])}])}])}]
(if joined
[community-channel-list id]
[community-channel-preview-list id chats])
(when admin
[components.plus-button/plus-button
{:on-press #(>evt [:bottom-sheet/show-sheet
{:content (fn []
[community-plus-actions community])}])
:accessibility-label :new-chat-button}])
(when-not joined
(cond
can-join?
[toolbar/toolbar
{:show-border? true
:center [quo/button {:on-press #(>evt [::communities/join id])
:type :secondary}
(i18n/label :t/join)]}]
can-request-access?
(if (and (pos? requested-to-join-at)
(not (can-request-access-again? requested-to-join-at)))
[toolbar/toolbar
{:show-border? true
:left [quo/text {:color :secondary} (i18n/label :t/membership-request-pending)]}]
[toolbar/toolbar
{:show-border? true
:center [quo/button {:on-press #(>evt [::communities/request-to-join id])
:type :secondary}
(i18n/label :t/request-access)]}])
:else
[toolbar/toolbar
{:show-border? true
:center [quo/button {:on-press #(>evt [::communities/join id])
:type :secondary}
(i18n/label :t/follow)]}]))]
[unknown-community])))))

View File

@ -25,7 +25,7 @@
(utils/show-question
(i18n/label :t/are-you-sure-to-cancel)
(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/learn-more :t/about-names-title :t/about-names-content]
[react/view {:style {:flex 1
@ -52,7 +52,7 @@
:icon [react/image {:source {:uri (identicon/identicon public-key)}
:resize-mode :cover
: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 []
(let [dimensions (reagent/atom {})]

View File

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

View File

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

View File

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

View File

@ -15,8 +15,7 @@
[status-im.ethereum.core :as ethereum]
[status-im.utils.security :as security]
[clojure.string :as string]
[quo.core :as quo]
[status-im.ui.components.bottom-panel.views :as bottom-panel]))
[quo.core :as quo]))
(defn add-account-topbar [type]
(let [title (case type
@ -136,22 +135,6 @@
:error-label error-label
: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 []
(letsubs [{:keys [type account] :as add-account} [:add-account]
add-account-disabled? [:add-account-disabled?]
@ -161,7 +144,7 @@
:ignore-offset true}
[add-account-topbar type]
[react/scroll-view {:keyboard-should-persist-taps :handled
:style {:flex 1}}
:style {:flex 1 :padding-top 20}}
(when (or (not keycard?)
(= type :watch))
[settings add-account entered-password])
@ -189,5 +172,4 @@
(not keycard?)
(not (spec/valid? ::multiaccounts.db/password
@entered-password)))))}
(i18n/label :t/add-account)]}]
[pin-sheet]]))
(i18n/label :t/add-account)]}]]))

View File

@ -299,7 +299,7 @@
:db (-> db
(assoc :multiaccount/accounts new-accounts)
(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
{: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.datetime :as datetime]
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.popover.core :as popover.core]
[clojure.set :as clojure.set]))
@ -765,8 +764,8 @@
[{: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-n [[:wallet.ui/pull-to-refresh] ;TODO temporary simple fix for v1
[:show-popover {:view [signing-phrase/signing-phrase]}]]
{:dispatch-n [[:wallet.ui/pull-to-refresh]] ;TODO temporary simple fix for v1
;;[:show-popover {:view [signing-phrase/signing-phrase]}]]
:db (if (or wallet-set-up-passed? sign-phrase-showed?)
db
(assoc db :wallet/sign-phrase-showed? true))}))