Skip to content

Commit

Permalink
chore: remove connected wallet (#10450)
Browse files Browse the repository at this point in the history
  • Loading branch information
nuanyang233 committed Aug 17, 2023
1 parent 66fb216 commit 5c2d9b1
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 22 deletions.
1 change: 0 additions & 1 deletion packages/app/src/helpers/createSharedContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export function createSharedContext(): Omit<Plugin.SiteAdaptor.SiteAdaptorContex
hasPaymentPassword: reject,
lastRecognizedProfile: UNDEFINED,
openDashboard: reject,
openPopupConnectWindow: reject,
openPopupWindow: reject,
fetchJSON: reject,
openWalletConnectDialog: async (uri: string) => {
Expand Down
1 change: 0 additions & 1 deletion packages/mask/background/services/helper/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export {
removePopupWindow,
openDashboard,
queryCurrentActiveTab,
openPopupConnectWindow,
openWalletStartUpWindow,
} from './popup-opener.js'
export {
Expand Down
10 changes: 0 additions & 10 deletions packages/mask/background/services/helper/popup-opener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,6 @@ export async function openWalletStartUpWindow(params: Record<string, any>) {
return openPopupWindow(PopupRoutes.Wallet, params)
}

export async function openPopupConnectWindow(params: Record<string, any> = {}): Promise<void> {
const url = urlcat('popups-connect.html#', PopupRoutes.ConnectWallet, {
toBeClose: 1,
from: PopupRoutes.ConnectWallet,
...params,
})

return openWindow(url)
}

export async function removePopupWindow(): Promise<void> {
if (!currentPopupWindowId) return
browser.windows.remove(currentPopupWindowId)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
import { useCallback, useEffect, useMemo, useState } from 'react'
import { useAsyncRetry } from 'react-use'
import { first } from 'lodash-es'
import { InjectedDialog, usePersonaProofs } from '@masknet/shared'
import { InjectedDialog, PopupHomeTabType, usePersonaProofs } from '@masknet/shared'
import {
useActivatedPluginsSiteAdaptor,
usePluginI18NField,
getSettingsTabContent,
} from '@masknet/plugin-infra/content-script'
import { PluginID, NextIDPlatform, EMPTY_LIST, CrossIsolationMessages, MaskMessages } from '@masknet/shared-base'
import {
PluginID,
NextIDPlatform,
EMPTY_LIST,
CrossIsolationMessages,
MaskMessages,
PopupRoutes,
} from '@masknet/shared-base'
import { getAvailablePlugins } from '@masknet/plugin-infra'
import { makeStyles, MaskTabList, useTabs } from '@masknet/theme'
import { TabContext } from '@mui/lab'
Expand Down Expand Up @@ -59,8 +66,9 @@ export function PluginSettingsDialog() {

const openPopupWindow = useCallback(
() =>
Services.Helper.openPopupConnectWindow({
internal: true,
Services.Helper.openPopupWindow(PopupRoutes.Personas, {
tab: PopupHomeTabType.ConnectedWallets,
disableNewWindow: true,
}),
[],
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,11 @@ export const LogoutUI = memo<LogoutUIProps>(

const disabled = useMemo(() => {
if (loading || error || paymentPasswordError) return true
if (backupPassword) return !password.length
if (manageWallets.length) {
if (!backupPassword) return false
if (hasPassword) return !paymentPassword.length
if (!backupPassword) return false
}
if (backupPassword) return !password.length
return false
}, [
loading,
Expand Down
1 change: 0 additions & 1 deletion packages/mask/src/utils/plugin-context-shared-ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ export const RestPartOfPluginUIContextShared: Omit<
openDashboard: Services.Helper.openDashboard,
openPopupWindow: Services.Helper.openPopupWindow,
closePopupWindow: Services.Helper.removePopupWindow,
openPopupConnectWindow: Services.Helper.openPopupConnectWindow,
fetchJSON: Services.Helper.fetchJSON,

openWalletConnectDialog: async (uri: string) => {
Expand Down
2 changes: 0 additions & 2 deletions packages/plugin-infra/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,6 @@ export namespace Plugin.Shared {

/** Fetch json from background */
fetchJSON<T>(input: RequestInfo | URL, init?: RequestInit): Promise<T>
/** Open popup connect window */
openPopupConnectWindow(): Promise<void>

/** Open walletconnect dialog */
openWalletConnectDialog(uri: string): Promise<void>
Expand Down
2 changes: 1 addition & 1 deletion packages/web3-providers/src/Web3/EVM/state/Message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class Message extends MessageState<MessageRequest, MessageResponse> {
const fromState =
route !== PopupRoutes.ContractInteraction ? { from: PopupRoutes.ContractInteraction } : EMPTY_OBJECT

if (Sniffings.is_popup_page) {
if (Sniffings.is_popup_page && !location.hash.includes('/swap')) {
PopupsHistory.push(urlcat(route, fromState))
} else {
// open the popups window and wait for approvement from the user.
Expand Down

0 comments on commit 5c2d9b1

Please sign in to comment.