Skip to content

Commit

Permalink
Merge branch 'feat/reflect-page-provider' into tmp/20250110
Browse files Browse the repository at this point in the history
  • Loading branch information
cs1707 committed Jan 9, 2025
2 parents e338935 + cf2b301 commit cec4825
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 15 deletions.
7 changes: 6 additions & 1 deletion _raw/locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -1851,7 +1851,12 @@
"SignTestnetPermission": {
"title": "Signing permission"
},
"ignoreAll": "Ignore all"
"ignoreAll": "Ignore all",
"otherWalletBtn": "Connect with Another Wallet",
"SelectWallet": {
"title": "Select a Wallet to Connect",
"desc": "Choose from the wallets you have installed"
}
},
"addressDetail": {
"add-to-whitelist": "Add to Whitelist",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"@rabby-wallet/eth-walletconnect-keyring": "2.1.5",
"@rabby-wallet/eth-watch-keyring": "1.0.0",
"@rabby-wallet/gnosis-sdk": "1.3.10",
"@rabby-wallet/page-provider": "0.4.3-alpha.1",
"@rabby-wallet/page-provider": "0.4.3-alpha.2",
"@rabby-wallet/rabby-action": "0.1.8",
"@rabby-wallet/rabby-api": "0.9.9",
"@rabby-wallet/rabby-security-engine": "2.0.7",
Expand Down
8 changes: 8 additions & 0 deletions src/background/controller/provider/internalMethod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,19 @@ const getProvider = ({ origin }: { origin: string }) => {
return permissionService.getSite(origin)?.rdns;
};

const resetProvider = ({ origin }: { origin: string }) => {
const site = permissionService.getSite(origin);
if (site) {
permissionService.setSite({ ...site, rdns: undefined });
}
};

export default {
tabCheckin,
getProviderState,
providerOverwrite,
hasOtherProvider,
isDefaultWallet,
'rabby:getProvider': getProvider,
'rabby:resetProvider': resetProvider,
};
11 changes: 7 additions & 4 deletions src/ui/views/Approval/components/Connect/SelectWallet.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import clsx from 'clsx';
import React from 'react';
import { useTranslation } from 'react-i18next';
import { ReactComponent as RcIconBack } from 'ui/assets/icon-back-cc.svg';

export interface EIP6963ProviderInfo {
Expand All @@ -19,6 +20,7 @@ export const SelectWallet: React.FC<Props> = ({
providers,
onSelect,
}) => {
const { t } = useTranslation();
return (
<div className="py-[32px] px-[20px]">
<div>
Expand All @@ -27,10 +29,10 @@ export const SelectWallet: React.FC<Props> = ({
</div>
<div className="text-center mb-[32px]">
<h1 className="text-[24px] leading-[29px] font-medium text-r-neutral-title1 mt-0 mb-[8px]">
Select a Wallet to Connect
{t('page.connect.SelectWallet.title')}
</h1>
<p className="text-[15px] leading-[18px] text-r-neutral-body m-0">
Choose from the wallets you have installed
{t('page.connect.SelectWallet.desc')}
</p>
</div>
</div>
Expand All @@ -41,8 +43,9 @@ export const SelectWallet: React.FC<Props> = ({
key={item.uuid}
className={clsx(
'p-[20px] w-[172px] h-[100px] cursor-pointer',
'bg-r-neutral-card-2 rounded-[8px]',
'flex flex-col items-center justify-center'
'bg-r-neutral-card-2 rounded-[8px] border-[1px] border-transparent',
'flex flex-col items-center justify-center',
'hover:bg-r-blue-light1 hover:border-rabby-blue-default'
)}
onClick={() => {
onSelect?.(item);
Expand Down
4 changes: 2 additions & 2 deletions src/ui/views/Approval/components/Connect/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -776,13 +776,13 @@ const Connect = (props: ConnectProps) => {
<div
className={clsx(
'bg-r-neutral-card-2 p-[14px] h-[48px] text-center rounded-[6px]',
'text-[16px] leading-[19px] font-medium cursor-pointer'
'text-[16px] leading-[19px] font-medium cursor-pointer text-r-neutral-body'
)}
onClick={() => {
setIsShowSelectWallet(true);
}}
>
Connect with Another Wallet
{t('page.connect.otherWalletBtn')}
</div>
</div>
) : null}
Expand Down
3 changes: 3 additions & 0 deletions src/ui/views/Dashboard/components/CurrentConnection/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ export const CurrentConnection = memo((props: CurrentConnectionProps) => {
placement="top"
overlayClassName={clsx('rectangle max-w-[225px]')}
visible={isShowTooltip}
align={{
offset: [0, 4],
}}
title={
<Trans
t={t}
Expand Down
2 changes: 1 addition & 1 deletion src/ui/views/MetamaskModeDapps/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export const MetamaskModeDapps = () => {
<img
src={isDarkTheme ? IconMetamaskModeDark : IconMetamaskMode}
alt=""
className="block mx-auto w-[216px] h-[48px] mb-[12px]"
className="block mx-auto w-[221px] h-[54px] mb-[6px]"
/>
<div className="text-r-neutral-body text-[13px] leading-[140%]">
{t('page.metamaskModeDapps.desc')}
Expand Down
16 changes: 14 additions & 2 deletions src/utils/message/broadcastChannelMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@ export default class BroadcastChannelMessage extends Message {
}

connect = () => {
this._channel.on('data', ({ data: { type, data } }) => {
this._channel.on('data', (res) => {
if (!res.data) {
return;
}
const {
data: { type, data },
} = res;
if (type === 'message') {
this.emit('message', data);
} else if (type === 'response') {
Expand All @@ -31,7 +37,13 @@ export default class BroadcastChannelMessage extends Message {
listen = (listenCallback) => {
this.listenCallback = listenCallback;

this._channel.on('data', ({ data: { type, data } }) => {
this._channel.on('data', (res) => {
if (!res.data) {
return;
}
const {
data: { type, data },
} = res;
if (type === 'request') {
this.onRequest(data);
}
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4851,10 +4851,10 @@
typescript "^4.4.4"
web3-core "^1.6.0"

"@rabby-wallet/[email protected].1":
version "0.4.3-alpha.1"
resolved "https://registry.yarnpkg.com/@rabby-wallet/page-provider/-/page-provider-0.4.3-alpha.1.tgz#68f4313c7c5b3f49f286d2e4708eab3e36185ac2"
integrity sha512-oLO2ar8hAayW2eG9nvsvtT/n776sR+TlzzuuAa6vgje7Kr47qVFW/edFuMm4i56r/fPi0R27Fh6CPK0QlBNjMg==
"@rabby-wallet/[email protected].2":
version "0.4.3-alpha.2"
resolved "https://registry.yarnpkg.com/@rabby-wallet/page-provider/-/page-provider-0.4.3-alpha.2.tgz#63eb19b6b12a8184bd79ccd8dbda6769b7da9516"
integrity sha512-7d1Hvuba0JNySF6eIDau/2iCllAld1rNBCbBRTUeKXNmNjNLpVsa2qX1WcCFnyWT09Y5oiMPL+DgswIrTqWrlA==
dependencies:
"@ledgerhq/devices" "^6.27.1"
"@metamask/post-message-stream" "8.1.0"
Expand Down

0 comments on commit cec4825

Please sign in to comment.