Skip to content

Commit

Permalink
save WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Viterbo committed Dec 19, 2023
2 parents 4d8cd04 + 056dee9 commit 25a86a4
Show file tree
Hide file tree
Showing 6 changed files with 177 additions and 130 deletions.
5 changes: 3 additions & 2 deletions src/antelope/wallets/ual/MetakeepUAL.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export interface MetakeepUALOptions {
reasonCallback?: (transaction: any) => string;
}
let metakeep: MetaKeep | null = null;
const metakeep_name = 'metakeep.ual';

// This interface is used to store the data in the local cache
export interface MetakeepData {
Expand Down Expand Up @@ -92,7 +93,7 @@ export class MetakeepAuthenticator extends Authenticator {
}

getName() {
return 'metakeep.ual';
return metakeep_name;
}

/**
Expand Down Expand Up @@ -125,7 +126,7 @@ export class MetakeepAuthenticator extends Authenticator {
// An icon displayed to app users when selecting their authentication method
icon: 'no-icon',
// Name displayed to app users
text: 'metakeep',
text: metakeep_name,
// Background color displayed to app users who select your authenticator
background: '#030238',
// Color of text used on top the `backgound` property above
Expand Down
4 changes: 4 additions & 0 deletions src/antelope/wallets/ual/utils/metakeep-cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ class MetakeepCache {
}
}

public getMails(): string[] {
return Object.keys(this.cache);
}

public getEosAddress(email: string): string {
this.assertCache(email);
return this.cache[email]?.wallet?.eosAddress ?? '';
Expand Down
12 changes: 12 additions & 0 deletions src/i18n/en-us/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -618,5 +618,17 @@ export default {
telos_cloud_discontinued_title: 'Important',
telos_cloud_discontinued_message_title: 'Attention Users: Telos Cloud Wallet account option will be discontinued.',
telos_cloud_discontinued_message_body:'The Telos Cloud Wallet (ORE ID via Google) account option to connect and sign transactions will be discontinued after December 31st. If you use the Telos Cloud Wallet to access your account, please transfer your assets to another wallet before this deadline. <strong> This change does <i>not</i> impact users accessing their accounts via Metamask, WalletConnect, Anchor, or other sign-in methods.</strong>',
welcome_new_telos_cloud_title_part_1: 'New Telos Cloud Wallet',
welcome_new_telos_cloud_title_part_2: 'Welcome back',
welcome_new_telos_cloud: 'If you are new to Telos Cloud Wallet, please sign in with your Google account to create a new Telos account.',
warn_old_telos_cloud_users_title: 'Attention Old Users',
warn_old_telos_cloud_users_part_1: 'If you are an old Telos Cloud Wallet user, you need to log in with the Google above first, button to create your brand-new account. Then log out and come back here to start the migration.',
warn_old_telos_cloud_users_part_2: 'If you are an old Telos Cloud Wallet user, now you can start migrating all your assets to your new account. Please click the button below to start the migration.',

you_need_to_migrate_title: 'You need to migrate your assets',
you_need_to_migrate_sub_title: 'The access to this account will be discontinued, therefore you need to migrate your assets to a new account.',
you_need_to_migrate_nfts_first: 'You should start transfer all your collectibles to your new account first, and then continue with your tokens.',
you_need_to_migrate_all_tokens: 'You should start transfer all your tokens to your new account. Leave the TLOS tokens for the end.',

},
};
43 changes: 42 additions & 1 deletion src/pages/evm/wallet/WalletPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ import WalletPageHeader from 'pages/evm/wallet/WalletPageHeader.vue';
import WalletBalanceRow from 'pages/evm/wallet/WalletBalanceRow.vue';
import { CURRENT_CONTEXT, useAccountStore, useBalancesStore, useFeedbackStore, useHistoryStore } from 'src/antelope';
import WalletTransactionsTab from 'pages/evm/wallet/WalletTransactionsTab.vue';
// import { metakeepCache } from 'src/antelope/wallets/ual/utils/metakeep-cache';
import { useI18n } from 'vue-i18n';
const route = useRoute();
const { t: $t } = useI18n();
const historyStore = useHistoryStore();
const accountStore = useAccountStore();
const feedback = useFeedbackStore();
Expand Down Expand Up @@ -51,6 +53,45 @@ watch(accountStore, (newAccountStoreState) => {
}, { immediate: true });
// -------- migration functions ------------
/*
const metakeepAlreadyCreated = computed(() => {
const emails = metakeepCache.getMails();
if (emails.length > 0) {
const ethPubKey = metakeepCache.getEthAddress(emails[0]);
if (ethPubKey) {
return ethPubKey;
}
}
return '';
});
const nftsStore = useNftsStore();
const balanceStore = useBalancesStore();
const nfts = computed(() => nftsStore.loggedInventory);
const balances = computed(() => balanceStore.loggedBalances);
const authenticator = useAccountStore().getAccount(CURRENT_CONTEXT).authenticator;
console.log('authenticator', authenticator);
const currentAuthName = authenticator?.getName() || '';
if (currentAuthName === 'metakeep' && metakeepAlreadyCreated.value !== '') {
// we need to notify the user that he needs to migrate his assets
getAntelope().config.notifyRememberInfoHandler(
$t('temporal.you_need_to_migrate_title'),
[{
tag: 'p',
class: 'c-notify__message--subtitle',
text: $t('temporal.you_need_to_migrate_sub_title'),
}, {
tag: 'p',
class: '',
text: nfts.value.length > 0 ? $t('temporal.you_need_to_migrate_nfts_first') : $t('temporal.you_need_to_migrate_all_tokens'),
}],
'',
'telos-cloud-discontinued',
);
}
*/
</script>

<template>
Expand Down
66 changes: 45 additions & 21 deletions src/pages/home/EVMLoginButtons.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Menu } from 'src/pages/home/MenuType';
import InlineSvg from 'vue-inline-svg';
import { isTodayBeforeTelosCloudDown } from 'src/App.vue';
import { googleCtrl } from 'src/pages/home/GoogleOneTap';
import { metakeepCache } from 'src/antelope/wallets/ual/utils/metakeep-cache';
export default defineComponent({
name: 'EVMLoginButtons',
Expand Down Expand Up @@ -155,6 +156,17 @@ export default defineComponent({
},
});
const newAccountAlreadyCreated = computed(() => {
const emails = metakeepCache.getMails();
if (emails.length > 0) {
const ethPubKey = metakeepCache.getEthAddress(emails[0]);
if (ethPubKey) {
return true;
}
}
return false;
});
return {
isLoading,
isLoadingOreId,
Expand Down Expand Up @@ -182,6 +194,7 @@ export default defineComponent({
googleSubscription,
showGoogleLoading,
googleCtrl,
newAccountAlreadyCreated,
};
},
unmounted() {
Expand Down Expand Up @@ -316,6 +329,13 @@ export default defineComponent({
<!-- telos cloud menu -->
<template v-if="showTelosCloudMenu">

<div class="c-evm-login-buttons__title">{{
newAccountAlreadyCreated ?
$t('temporal.welcome_new_telos_cloud_title_part_2') :
$t('temporal.welcome_new_telos_cloud_title_part_1')
}}</div>
<div class="c-evm-login-buttons__sub-title">{{ $t('temporal.welcome_new_telos_cloud') }}</div>

<div v-if="showGoogleLoading" >
<div class="c-evm-login-buttons__loading"><QSpinnerFacebook /></div>
</div>
Expand All @@ -327,35 +347,33 @@ export default defineComponent({
<div class="c-evm-login-buttons__loading"><QSpinnerFacebook /></div>
</div>

<div class="c-evm-login-buttons__sub-title">{{ $t('home.coming_soon') }}</div>
<div class="c-evm-login-buttons__title q-mt-md">{{ $t('temporal.warn_old_telos_cloud_users_title') }}</div>

<!-- Facebook OAuth Provider -->
<div class="c-evm-login-buttons__option c-evm-login-buttons__option--web2 c-evm-login-buttons__option--disabled">
<template v-if="isLoadingOreId('facebook')">
<div class="c-evm-login-buttons__loading"><QSpinnerFacebook /></div>
</template>
<template v-else>
<img
width="24"
class="c-evm-login-buttons__icon c-evm-login-buttons__icon--disabled"
src="~assets/icon--facebook.svg"
>
{{ $t('home.sign_with_facebook') }}
</template>
</div>
<div class="c-evm-login-buttons__sub-title">{{
newAccountAlreadyCreated ?
$t('temporal.warn_old_telos_cloud_users_part_2') :
$t('temporal.warn_old_telos_cloud_users_part_1')
}}</div>

<!-- X OAuth Provider -->
<div class="c-evm-login-buttons__option c-evm-login-buttons__option--web2 c-evm-login-buttons__option--disabled">
<template v-if="isLoadingOreId('facebook')">
<!-- Google old OreId Authenticator -->
<div
:class="{
'c-evm-login-buttons__option': true,
'c-evm-login-buttons__option--web2': true,
'c-evm-login-buttons__option--disabled': !newAccountAlreadyCreated,
}"
@click="setOreIdAuthenticator('google')"
>
<template v-if="isLoadingOreId('google')">
<div class="c-evm-login-buttons__loading"><QSpinnerFacebook /></div>
</template>
<template v-else>
<img
width="24"
class="c-evm-login-buttons__icon c-evm-login-buttons__icon--disabled"
src="~assets/icon--twitter.svg"
class="c-evm-login-buttons__icon"
src="~assets/icon--google.svg"
>
{{ $t('home.sign_with_x') }}
{{ $t('home.sign_with_google') }}
</template>
</div>

Expand Down Expand Up @@ -421,6 +439,12 @@ export default defineComponent({
gap: 8px;
}
&__title {
@include text--header-4;
color: $white;
text-align: center;
}
&__sub-title {
color: $white;
}
Expand Down
Loading

0 comments on commit 25a86a4

Please sign in to comment.