Skip to content

Commit

Permalink
feat: dapp connected notification
Browse files Browse the repository at this point in the history
  • Loading branch information
yqrashawn committed Jul 29, 2024
1 parent 55c620e commit 43efe77
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 12 deletions.
18 changes: 11 additions & 7 deletions src/legacy/status_im/data_store/activities.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,17 @@
[item]
(-> item
rpc->type
(set/rename-keys {:lastMessage :last-message
:replyMessage :reply-message
:chatId :chat-id
:contactVerificationStatus :contact-verification-status
:communityId :community-id
:membershipStatus :membership-status
:albumMessages :album-messages})
(set/rename-keys {:lastMessage :last-message
:replyMessage :reply-message
:chatId :chat-id
:contactVerificationStatus :contact-verification-status
:communityId :community-id
:membershipStatus :membership-status
:albumMessages :album-messages
:walletProviderSessionTopic :wallet-provider-session-topic
:dappURL :dapp-url
:dappName :dapp-name
:dappIconURL :dapp-icon-url})
(update :last-message #(when % (messages/<-rpc %)))
(update :message #(when % (messages/<-rpc %)))
(update :reply-message #(when % (messages/<-rpc %)))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
(ns status-im.contexts.shell.activity-center.notification.dapp-connection.view
(:require
[quo.core :as quo]
[quo.foundations.resources :as quo.resources]
[status-im.contexts.shell.activity-center.notification.common.view :as common]
[utils.datetime :as datetime]
[utils.i18n :as i18n]
utils.url))

(defn view
[{:keys [customization-color active-swipeable notification extra-fn]}]
(let [{:keys [timestamp read dapp-url dapp-icon-url]} notification]
[common/swipeable
{:left-button common/swipe-button-read-or-unread
:left-on-press common/swipe-on-press-toggle-read
:right-button common/swipe-button-delete
:right-on-press common/swipe-on-press-delete
:active-swipeable active-swipeable
:extra-fn extra-fn}
[quo/activity-log
{:title (i18n/label :t/connected-to-dapp)
:customization-color customization-color
:icon :i/dapps
:timestamp (datetime/timestamp->relative timestamp)
:unread? (not read)
:context [[quo/context-tag
{:type :dapp
:size 24
:dapp-logo dapp-icon-url
:dapp-name (utils.url/url-host dapp-url)}]
"via"
[quo/context-tag
{:type :dapp
:size 24
:dapp-logo (quo.resources/get-dapp :wallet-connect)
:dapp-name "Wallet Connect"}]]}]]))
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
(def ^:const admin 8)
(def ^:const community-kicked 9)
(def ^:const contact-verification 10)
(def ^:const dapp-connected 23)
(def ^:const dapp-disconnected 24)

(def ^:const all-supported
#{one-to-one-chat
Expand Down
4 changes: 4 additions & 0 deletions src/status_im/contexts/shell/activity_center/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
contact-requests]
[status-im.contexts.shell.activity-center.notification.contact-verification.view :as
contact-verification]
[status-im.contexts.shell.activity-center.notification.dapp-connection.view :as dapp-connection]
[status-im.contexts.shell.activity-center.notification.membership.view :as membership]
[status-im.contexts.shell.activity-center.notification.mentions.view :as mentions]
[status-im.contexts.shell.activity-center.notification.reply.view :as reply]
Expand Down Expand Up @@ -51,6 +52,9 @@
(= type types/admin)
[admin/view props]

(= type types/dapp-connected)
[dapp-connection/view props]

(some types/membership [type])
(condp = type
types/private-group-chat [membership/view props]
Expand Down
2 changes: 1 addition & 1 deletion src/status_im/feature_flags.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
::wallet.long-press-watch-only-asset (enabled-in-env? :FLAG_LONG_PRESS_WATCH_ONLY_ASSET_ENABLED)
::wallet.saved-addresses (enabled-in-env? :WALLET_SAVED_ADDRESSES)
::wallet.swap (enabled-in-env? :FLAG_SWAP_ENABLED)
::wallet.wallet-connect (enabled-in-env? :FLAG_WALLET_CONNECT_ENABLED)
::wallet.wallet-connect (or true (enabled-in-env? :FLAG_WALLET_CONNECT_ENABLED))
::wallet.custom-network-amounts (enabled-in-env? :FLAG_WALLET_CUSTOM_NETWORK_AMOUNTS_ENABLED)})

(defonce ^:private feature-flags-config
Expand Down
1 change: 0 additions & 1 deletion src/status_im/subs/wallet/activities.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
[clojure.string :as string]
[native-module.core :as native-module]
[quo.foundations.resources :as quo.resources]
[quo.foundations.resources]
[re-frame.core :as rf]
[status-im.contexts.wallet.common.activity-tab.constants :as constants]
[utils.datetime :as datetime]
Expand Down
6 changes: 3 additions & 3 deletions status-go-version.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"_comment": "Instead use: scripts/update-status-go.sh <rev>",
"owner": "status-im",
"repo": "status-go",
"version": "v0.182.38",
"commit-sha1": "2bbdb35f6cabd1a4f7775e180e0647b70ce8d1aa",
"src-sha256": "03bksi5gn44ky76kblikpr6j3x69baid81ghfk27a4qx9hnc0qgc"
"version": "feat/wallet-connect-session-notification",
"commit-sha1": "9bc67a04a1c99c744275eb6aba3b39d0166b1b59",
"src-sha256": "08my977pqk1zhzlgmrsjv9637120xlmdi5ipsl0v3gkwjg79914d"
}
1 change: 1 addition & 0 deletions translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,7 @@
"connected": "Connected",
"connected-dapps": "Connected dApps",
"connected-to": "Connected to",
"connected-to-dapp": "Connected to dApp",
"connecting": "Connecting...",
"connecting-requires-login": "Connecting to another network requires login",
"connection-request": "Connection Request",
Expand Down

0 comments on commit 43efe77

Please sign in to comment.