Skip to content

Commit

Permalink
Fixed sync .. Now need to fix sessions update
Browse files Browse the repository at this point in the history
  • Loading branch information
ibrkhalil committed Sep 10, 2022
1 parent 3e6563d commit c98e736
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 30 deletions.
17 changes: 10 additions & 7 deletions src/status_im/ethereum/subscriptions.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[status-im.wallet.core :as wallet.core]
[status-im.ethereum.transactions.core :as transactions]
[status-im.utils.fx :as fx]
[status-im.wallet-connect-legacy.core :as wallet-connect-legacy]
[taoensso.timbre :as log]))

(fx/defn new-transfers
Expand All @@ -14,16 +15,18 @@
(transactions/check-watched-transactions cofx))

(fx/defn recent-history-fetching-started
[{:keys [db]} accounts]
[{:keys [db] :as cofx} accounts]
(log/debug "[wallet-subs] recent-history-fetching-started"
"accounts" accounts)
(let [event (get db :wallet/on-recent-history-fetching)]
(cond-> {:db (-> db
(transactions/update-fetching-status accounts :recent? true)
(assoc :wallet/recent-history-fetching-started? true)
(dissoc :wallet/on-recent-history-fetching))}
event
(assoc :dispatch event))))
(fx/merge cofx
(cond-> {:db (-> db
(transactions/update-fetching-status accounts :recent? true)
(assoc :wallet/recent-history-fetching-started? true)
(dissoc :wallet/on-recent-history-fetching))}
event
(assoc :dispatch event))
(wallet-connect-legacy/get-connector-session-from-db))))

(fx/defn recent-history-fetching-ended
[{:keys [db]} {:keys [accounts blockNumber]}]
Expand Down
3 changes: 1 addition & 2 deletions src/status_im/multiaccounts/login/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,7 @@
(transactions/get-fetched-transfers))
(when (ethereum/binance-chain? db)
(wallet/request-current-block-update))
(prices/update-prices)
(wallet-connect-legacy/get-connector-session-from-db)))
(prices/update-prices)))

(fx/defn login
{:events [:multiaccounts.login.ui/password-input-submitted]}
Expand Down
40 changes: 19 additions & 21 deletions src/status_im/ui/screens/wallet/manage_connections/views.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,6 @@
[status-im.utils.handlers :refer [<sub]]
[status-im.utils.utils :as utils]))

(defn get-currently-selected-accounts
[selected-tab]
(-> selected-tab
second
:session
:params
first
:accounts))

(defn account-selector-bottom-sheet [{:keys [session show-account-selector? idx]}]
(reagent/create-class
{:reagent-render (fn []
Expand Down Expand Up @@ -71,13 +62,24 @@
[rn/text {:style styles/selected-account} (:name selected-account)]])]]]]))

(defn list-item [{:keys [session visible-accounts show-account-selector?]} idx]
[rn/view
[print-session-info {:session session
:visible-accounts visible-accounts
:show-account-selector? show-account-selector?}]
[account-selector-bottom-sheet {:session session
:show-account-selector? show-account-selector?
:idx idx}]])
[rn/view
[print-session-info {:session session
:visible-accounts visible-accounts
:show-account-selector? show-account-selector?}]
[account-selector-bottom-sheet {:session session
:show-account-selector? show-account-selector?
:idx idx}]])

(defn items-list-comp []
(reagent/create-class
{:reagent-render (fn [items]
[rn/flat-list {:flex 1
:keyboardShouldPersistTaps :always
:data items
:render-fn list-item
:key-fn str}])
:component-did-update (fn [this old-argv]
(js/alert (= (keys (first (second (reagent/argv this)))) (keys (first old-argv)))))}))

(defn views []
(let [legacy-sessions (<sub [:wallet-connect-legacy/sessions])
Expand All @@ -88,8 +90,4 @@
:show-account-selector? show-account-selector?
:session session}))
legacy-sessions))]
[rn/flat-list {:flex 1
:keyboardShouldPersistTaps :always
:data items
:render-fn list-item
:key-fn str}]))
[items-list-comp items]))

0 comments on commit c98e736

Please sign in to comment.