Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
OmarBasem committed May 14, 2024
1 parent 7e41e35 commit 5069fab
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/status_im/contexts/wallet/wallet_connect/utils.cljs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
(ns status-im.contexts.wallet.wallet-connect.utils
;; NOTE: Not sorting namespaces since @walletconnect/react-native-compat should be the first
#_{:clj-kondo/ignore [:unsorted-required-namespaces]}
(:require ["@walletconnect/react-native-compat"]
["@walletconnect/core" :refer [Core]]
["@walletconnect/web3wallet" :refer [Web3Wallet]]
(:require ["@walletconnect/core" :refer [Core]]
["@walletconnect/react-native-compat"]
["@walletconnect/utils" :refer [buildApprovedNamespaces]]
["@walletconnect/web3wallet" :refer [Web3Wallet]]
[status-im.config :as config]
[utils.i18n :as i18n]))

Expand Down
9 changes: 6 additions & 3 deletions src/status_im/subs/wallet/activities.cljs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
(ns status-im.subs.wallet.activities
(:require
[re-frame.core :as rf]
[status-im.contexts.wallet.common.activity-tab.constants :as constants]
[utils.datetime :as datetime]))

(rf/reg-sub
Expand All @@ -13,9 +14,11 @@
:<- [:wallet/current-viewing-account-address]
(fn [[activities current-viewing-account-address]]
(->> activities
(filter (fn [{:keys [sender recipient]}]
(or (= sender current-viewing-account-address)
(= recipient current-viewing-account-address))))
(filter (fn [{:keys [sender recipient activity-type]}]
(let [receiving-activity? (= activity-type constants/wallet-activity-type-receive)
relevant-address (if receiving-activity? recipient sender)]
(= relevant-address current-viewing-account-address))))
(distinct)
(group-by (fn [{:keys [timestamp]}]
(datetime/timestamp->relative-short-date (* timestamp 1000))))
(map (fn [[date activities]]
Expand Down
8 changes: 6 additions & 2 deletions src/status_im/subs/wallet/activities_test.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
{:sender "acc2" :recipient "acc1" :timestamp 1588377600}
{:sender "acc3" :recipient "acc4" :timestamp 1588464000}])
(assoc-in [:wallet :current-viewing-account-address] "acc1"))))
(is (= [{:title "May 2, 2020" :data [{:sender "acc2" :recipient "acc1" :timestamp 1588377600}] :timestamp 1588377600}
{:title "May 1, 2020" :data [{:sender "acc1" :recipient "acc2" :timestamp 1588291200}] :timestamp 1588291200}]
(is (= [{:title "May 2, 2020"
:data [{:sender "acc2" :recipient "acc1" :timestamp 1588377600}]
:timestamp 1588377600}
{:title "May 1, 2020"
:data [{:sender "acc1" :recipient "acc2" :timestamp 1588291200}]
:timestamp 1588291200}]
(rf/sub [sub-name])))))

0 comments on commit 5069fab

Please sign in to comment.