Skip to content

Commit

Permalink
Resolve conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
hieu-w committed Aug 22, 2024
1 parent ea55542 commit 2a15bc0
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions demo/vue-app-new/src/MainView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { useWeb3Auth } from "@web3auth/modal-vue-composables";
import { OpenloginAdapter } from "@web3auth/openlogin-adapter";
import { PhantomAdapter } from "@web3auth/phantom-adapter";
import { SolanaPrivateKeyProvider } from "@web3auth/solana-provider";
import { SolanaWalletConnectorPlugin } from "@web3auth/solana-wallet-connector-plugin";
import { TorusWalletAdapter } from "@web3auth/torus-evm-adapter";
import { SolanaWalletAdapter } from "@web3auth/torus-solana-adapter";
import { WalletServicesPlugin } from "@web3auth/wallet-services-plugin";
Expand Down Expand Up @@ -46,7 +45,6 @@ const formData = ref<FormData>({
},
loginProviders: [],
adapters: [],
enableWalletServicePlugin: false,
loginMethods: defaultLoginMethod,
walletPlugin: {
enable: false,
Expand Down Expand Up @@ -172,6 +170,10 @@ const getExternalAdapterByName = (name: string) => {
}
};
const isWalletPluginEnabled = () => {
return formData.value.chainNamespace == CHAIN_NAMESPACES.EIP155 && formData.value.walletPlugin.enable;
};
const initW3A = async () => {
if (!chainOptions.value.find((option) => option.value === formData.value.chain)) formData.value.chain = chainOptions.value[0]?.value;
if (storageAvailable("sessionStorage")) sessionStorage.setItem("state", JSON.stringify(formData.value));
Expand All @@ -181,7 +183,7 @@ const initW3A = async () => {
const externalAdapter = getExternalAdapterByName(formData.value.adapters[i]);
if (externalAdapter) web3Auth.value.configureAdapter(externalAdapter);
}
if (formData.value.walletPlugin.enable) await addPlugin(walletPlugin.value);
if (isWalletPluginEnabled()) await addPlugin(walletPlugin.value);
await initModal(modalParams.value);
};
Expand Down Expand Up @@ -315,7 +317,7 @@ const isDisplay = (name: string): boolean => {
return formData.value.chainNamespace === CHAIN_NAMESPACES.SOLANA;
case "walletServices":
return formData.value.walletPlugin.enable;
return isWalletPluginEnabled();
default: {
return false;
Expand Down Expand Up @@ -613,19 +615,24 @@ const showWalletConnectScanner = async () => {
<Card v-if="isActiveTab(3)" class="grid grid-cols-1 gap-2 py-4 px-4" :shadow="false">
<Toggle
v-model="formData.walletPlugin.enable"
:disabled="isDisabled('walletServicePlugin')"
:show-label="true"
:size="'small'"
:label-disabled="$t('app.walletPlugin.title')"
:label-enabled="$t('app.walletPlugin.title')"
class="mb-2"
/>
<TextField
v-model="formData.walletPlugin.logoLight"
:label="$t('app.walletPlugin.logoLight')"
:disabled="isDisabled('walletServicePlugin')"
:aria-label="$t('app.walletPlugin.logoLight')"
:placeholder="$t('app.walletPlugin.logoLight')"
class="sm:col-span-2"
/>
<TextField
v-model="formData.walletPlugin.logoDark"
:disabled="isDisabled('walletServicePlugin')"
:label="$t('app.walletPlugin.logoDark')"
:aria-label="$t('app.walletPlugin.logoDark')"
:placeholder="$t('app.walletPlugin.logoDark')"
Expand Down

0 comments on commit 2a15bc0

Please sign in to comment.