chore: changes for 1.2.7

This commit is contained in:
Andrei O 2023-04-03 15:33:21 +03:00
parent 553c83c0cd
commit 277f3a7715
No known key found for this signature in database
GPG Key ID: B961E5B68389457E
11 changed files with 175 additions and 114 deletions

View File

@ -1,5 +1,9 @@
# Changelog # Changelog
## Manifest Version 1.2.7
- improve compatibility with ionic 7
## Manifest Version 1.2.6 ## Manifest Version 1.2.6
- upgrade ionic to v7 and update dependencies - upgrade ionic to v7 and update dependencies

View File

@ -3,8 +3,8 @@
"name": "__MSG_appName__", "name": "__MSG_appName__",
"description": "__MSG_appDesc__", "description": "__MSG_appDesc__",
"default_locale": "en", "default_locale": "en",
"version": "1.2.6", "version": "1.2.7",
"version_name": "1.2.6", "version_name": "1.2.7",
"icons": { "icons": {
"16": "assets/extension-icon/wallet_16.png", "16": "assets/extension-icon/wallet_16.png",
"32": "assets/extension-icon/wallet_32.png", "32": "assets/extension-icon/wallet_32.png",

View File

@ -11,6 +11,7 @@
cssClass="my-custom-class" cssClass="my-custom-class"
message="Please wait..." message="Please wait..."
:duration="4000" :duration="4000"
:key="`k${loading}`"
@didDismiss="loading = false" @didDismiss="loading = false"
> >
</ion-loading> </ion-loading>

View File

@ -31,7 +31,13 @@
<ion-item> Contract: {{ contract }} </ion-item> <ion-item> Contract: {{ contract }} </ion-item>
<ion-item> <ion-item>
<ion-label>Error From Contract:</ion-label> <ion-label>Error From Contract:</ion-label>
<ion-textarea style="overflow-y: scroll;" :rows="10" :cols="20" :value="error" readonly></ion-textarea> <ion-textarea
style="overflow-y: scroll"
:rows="10"
:cols="20"
:value="error"
readonly
></ion-textarea>
</ion-item> </ion-item>
<ion-item> <ion-item>
<ion-button @click="onCancel">Exit</ion-button> <ion-button @click="onCancel">Exit</ion-button>
@ -42,6 +48,7 @@
cssClass="my-custom-class" cssClass="my-custom-class"
message="Please wait..." message="Please wait..."
:duration="4000" :duration="4000"
:key="`k${loading}`"
@didDismiss="loading = false" @didDismiss="loading = false"
> >
</ion-loading> </ion-loading>
@ -65,7 +72,7 @@ import {
IonLoading, IonLoading,
} from "@ionic/vue"; } from "@ionic/vue";
import { useRoute } from "vue-router"; import { useRoute } from "vue-router";
import { getSelectedNetwork, getUrl, hexTostr, } from "@/utils/platform"; import { getSelectedNetwork, getUrl, hexTostr } from "@/utils/platform";
import type { Network } from "@/extension/types"; import type { Network } from "@/extension/types";
import { mainNets } from "@/utils/networks"; import { mainNets } from "@/utils/networks";
@ -86,17 +93,17 @@ export default defineComponent({
const route = useRoute(); const route = useRoute();
const error = hexTostr((route.params?.param as string) ?? ""); const error = hexTostr((route.params?.param as string) ?? "");
const loading = ref(true); const loading = ref(true);
const contract = (route.params?.contract as string) ?? "" const contract = (route.params?.contract as string) ?? "";
const selectedNetwork = (ref(null) as unknown) as Ref<Network>; const selectedNetwork = (ref(null) as unknown) as Ref<Network>;
const onCancel = () => { const onCancel = () => {
window.close(); window.close();
}; };
onIonViewWillEnter(async () => { onIonViewWillEnter(async () => {
(window as any)?.resizeTo?.(700, 600) (window as any)?.resizeTo?.(700, 600);
selectedNetwork.value = await getSelectedNetwork() selectedNetwork.value = await getSelectedNetwork();
loading.value = false loading.value = false;
}); });
return { return {
@ -106,7 +113,7 @@ export default defineComponent({
selectedNetwork, selectedNetwork,
mainNets, mainNets,
getUrl, getUrl,
error error,
}; };
}, },
}); });

View File

@ -6,33 +6,58 @@
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>
<ion-content class="ion-padding"> <ion-content class="ion-padding">
<ion-item v-if="history.length === 0"> <ion-item v-if="history.length === 0">
You don't have any transaction history You don't have any transaction history
</ion-item>
<ion-item v-else>
<ion-list>
<ion-item style="margin-bottom: 0.3rem;margin-top: 0.3rem" v-for="item of history" :key="item.txHash">
<ion-list>
<ion-item><b style="margin-right: 0.5rem">Date:</b> {{ new Date(item.date).toDateString() }}</ion-item>
<ion-item button @click="copyAddress(item.txHash, getToastRef())">
<p style="font-size: 0.7rem"><b style="margin-right: 0.5rem"><ion-icon style="margin-right: 0.3rem; display: inline-block;" :icon="copyOutline"></ion-icon>TxHash:</b>{{ item.txHash }}</p>
</ion-item>
<ion-item v-if="item.chainId"><b style="margin-right: 0.5rem">ChainId:</b> {{ item.chainId }}</ion-item>
<ion-item v-if="item.webiste"><b style="margin-right: 0.5rem">Website:</b> {{ item.webiste }}</ion-item>
<ion-item v-if="item.txUrl"><b style="margin-right: 0.5rem">ViewTx:</b> <a href="#" @click="openTab(item.txUrl as string)">LINK</a></ion-item>
</ion-list>
</ion-item> </ion-item>
<ion-item> <ion-item v-else>
<ion-button style="margin-left: 0.5rem" color="warning" @click="onWipeHistory">WIPE HISTORY</ion-button> <ion-list>
<ion-item
style="margin-bottom: 0.3rem; margin-top: 0.3rem"
v-for="item of history"
:key="item.txHash"
>
<ion-list>
<ion-item
><b style="margin-right: 0.5rem">Date:</b>
{{ new Date(item.date).toDateString() }}</ion-item
>
<ion-item button @click="copyAddress(item.txHash, getToastRef())">
<p style="font-size: 0.7rem">
<b style="margin-right: 0.5rem"
><ion-icon
style="margin-right: 0.3rem; display: inline-block"
:icon="copyOutline"
></ion-icon
>TxHash:</b
>{{ item.txHash }}
</p>
</ion-item>
<ion-item v-if="item.chainId"
><b style="margin-right: 0.5rem">ChainId:</b> {{ item.chainId }}</ion-item
>
<ion-item v-if="item.webiste"
><b style="margin-right: 0.5rem">Website:</b> {{ item.webiste }}</ion-item
>
<ion-item v-if="item.txUrl"
><b style="margin-right: 0.5rem">ViewTx:</b>
<a href="#" @click="openTab(item.txUrl as string)">LINK</a></ion-item
>
</ion-list>
</ion-item>
<ion-item>
<ion-button style="margin-left: 0.5rem" color="warning" @click="onWipeHistory"
>WIPE HISTORY</ion-button
>
</ion-item>
</ion-list>
</ion-item> </ion-item>
</ion-list>
</ion-item>
<ion-loading <ion-loading
:is-open="loading" :is-open="loading"
cssClass="my-custom-class" cssClass="my-custom-class"
message="Please wait..." message="Please wait..."
:duration="4000" :duration="4000"
:key="`k${loading}`"
@didDismiss="loading = false" @didDismiss="loading = false"
> >
</ion-loading> </ion-loading>
@ -42,42 +67,65 @@
message="Copied to clipboard" message="Copied to clipboard"
:duration="1500" :duration="1500"
></ion-toast> ></ion-toast>
</ion-content> </ion-content>
</ion-page> </ion-page>
</template> </template>
<script lang="ts"> <script lang="ts">
import { defineComponent, Ref, ref } from "vue"; import { defineComponent, Ref, ref } from "vue";
import { IonContent, IonHeader, IonPage, IonTitle, IonToolbar, onIonViewWillEnter, IonItem, IonList, IonToast, IonLoading, IonButton, IonIcon } from "@ionic/vue"; import {
import { getHistory, copyAddress, wipeHistory, openTab } from '@/utils/platform' IonContent,
import type { HistoryItem } from '@/extension/types' IonHeader,
IonPage,
IonTitle,
IonToolbar,
onIonViewWillEnter,
IonItem,
IonList,
IonToast,
IonLoading,
IonButton,
IonIcon,
} from "@ionic/vue";
import { getHistory, copyAddress, wipeHistory, openTab } from "@/utils/platform";
import type { HistoryItem } from "@/extension/types";
import { copyOutline } from "ionicons/icons"; import { copyOutline } from "ionicons/icons";
export default defineComponent({ export default defineComponent({
components: { IonContent, IonHeader, IonPage, IonTitle, IonToolbar, IonItem, IonList, IonToast, IonLoading, IonButton, IonIcon }, components: {
IonContent,
IonHeader,
IonPage,
IonTitle,
IonToolbar,
IonItem,
IonList,
IonToast,
IonLoading,
IonButton,
IonIcon,
},
setup: () => { setup: () => {
const history = ref([]) as Ref<HistoryItem[]>; const history = ref([]) as Ref<HistoryItem[]>;
const loading = ref(false) const loading = ref(false);
const toastState = ref(false); const toastState = ref(false);
const getToastRef = () => toastState; const getToastRef = () => toastState;
const loadData = async () => { const loadData = async () => {
loading.value = true loading.value = true;
history.value = await getHistory() history.value = await getHistory();
loading.value = false loading.value = false;
} };
const onWipeHistory = async () => { const onWipeHistory = async () => {
await wipeHistory() await wipeHistory();
loadData(); loadData();
} };
onIonViewWillEnter(async () => { onIonViewWillEnter(async () => {
loadData() loadData();
}) });
return { return {
history, history,
loading, loading,
@ -86,8 +134,8 @@ export default defineComponent({
toastState, toastState,
copyOutline, copyOutline,
onWipeHistory, onWipeHistory,
openTab openTab,
} };
} },
}); });
</script> </script>

View File

@ -80,6 +80,7 @@
cssClass="my-custom-class" cssClass="my-custom-class"
message="Please wait..." message="Please wait..."
:duration="4000" :duration="4000"
:key="`k${loading}`"
@didDismiss="loading = false" @didDismiss="loading = false"
/> />
</ion-content> </ion-content>

View File

@ -30,6 +30,7 @@
cssClass="my-custom-class" cssClass="my-custom-class"
message="Please wait..." message="Please wait..."
:duration="4000" :duration="4000"
:key="`k${loading}`"
@didDismiss="loading = false" @didDismiss="loading = false"
/> />
</ion-content> </ion-content>

View File

@ -99,6 +99,7 @@
cssClass="my-custom-class" cssClass="my-custom-class"
message="Please wait..." message="Please wait..."
:duration="4000" :duration="4000"
:key="`k${loading}`"
@didDismiss="loading = false" @didDismiss="loading = false"
> >
</ion-loading> </ion-loading>

View File

@ -93,6 +93,7 @@
cssClass="my-custom-class" cssClass="my-custom-class"
message="Please wait..." message="Please wait..."
:duration="4000" :duration="4000"
:key="`k${loading}`"
@didDismiss="loading = false" @didDismiss="loading = false"
/> />
</ion-content> </ion-content>

View File

@ -2,41 +2,41 @@
<ion-page> <ion-page>
<ion-header> <ion-header>
<ion-toolbar> <ion-toolbar>
<ion-buttons slot="start"> <ion-buttons slot="start">
<ion-button @click="close">Close</ion-button> <ion-button @click="close">Close</ion-button>
</ion-buttons> </ion-buttons>
<ion-title>Unlock to Proceed</ion-title> <ion-title>Unlock to Proceed</ion-title>
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>
<ion-content class="ion-padding"> <ion-content class="ion-padding">
<ion-list> <ion-list>
<ion-list v-if="unlockType === 'message'"> <ion-list v-if="unlockType === 'message'">
<ion-item>To continue signing the message, unlock wallet.</ion-item> <ion-item>To continue signing the message, unlock wallet.</ion-item>
<ion-item>Closing will reject sigining the message.</ion-item> <ion-item>Closing will reject sigining the message.</ion-item>
</ion-list> </ion-list>
<ion-list v-else-if="unlockType === 'viewPk'"> <ion-list v-else-if="unlockType === 'viewPk'">
<ion-item>To view the PK, unlock wallet.</ion-item> <ion-item>To view the PK, unlock wallet.</ion-item>
<ion-item>Closing will not show the PK.</ion-item> <ion-item>Closing will not show the PK.</ion-item>
</ion-list> </ion-list>
<ion-list v-else-if="unlockType === 'addAccount'"> <ion-list v-else-if="unlockType === 'addAccount'">
<ion-item>Storage Encrypted, Unlock to add account.</ion-item> <ion-item>Storage Encrypted, Unlock to add account.</ion-item>
<ion-item>Closing will not add the account.</ion-item> <ion-item>Closing will not add the account.</ion-item>
</ion-list> </ion-list>
<ion-list v-else> <ion-list v-else>
<ion-item>To continue sending the transaction, unlock wallet.</ion-item> <ion-item>To continue sending the transaction, unlock wallet.</ion-item>
<ion-item>Closing will reject sending the transaction.</ion-item> <ion-item>Closing will reject sending the transaction.</ion-item>
</ion-list> </ion-list>
<ion-item> <ion-item>
<ion-label>Unlock Password</ion-label> <ion-label>Unlock Password</ion-label>
</ion-item> </ion-item>
<ion-item> <ion-item>
<ion-input v-model="mpPass" type="password"></ion-input> <ion-input v-model="mpPass" type="password"></ion-input>
</ion-item> </ion-item>
</ion-list> </ion-list>
<ion-item> <ion-item>
<ion-button @click="unlock">Confirm</ion-button> <ion-button @click="unlock">Confirm</ion-button>
</ion-item> </ion-item>
<ion-alert <ion-alert
:is-open="alertOpen" :is-open="alertOpen"
header="Error" header="Error"
@ -49,6 +49,7 @@
cssClass="my-custom-class" cssClass="my-custom-class"
message="Please wait..." message="Please wait..."
:duration="4000" :duration="4000"
:key="`k${loading}`"
@didDismiss="loading = false" @didDismiss="loading = false"
/> />
</ion-content> </ion-content>
@ -71,21 +72,17 @@ import {
IonList, IonList,
IonButtons, IonButtons,
modalController, modalController,
IonLoading IonLoading,
} from "@ionic/vue"; } from "@ionic/vue";
import { import { getAccounts, replaceAccounts, saveSelectedAccount } from "@/utils/platform";
getAccounts, import { decrypt, getCryptoParams } from "@/utils/webCrypto";
replaceAccounts,
saveSelectedAccount
} from "@/utils/platform";
import { decrypt, getCryptoParams } from "@/utils/webCrypto"
export default defineComponent({ export default defineComponent({
props: { props: {
unlockType: { unlockType: {
type: String, type: String,
default: 'message' default: "message",
} },
}, },
components: { components: {
IonContent, IonContent,
@ -100,46 +97,45 @@ export default defineComponent({
IonAlert, IonAlert,
IonList, IonList,
IonButtons, IonButtons,
IonLoading IonLoading,
}, },
setup: () => { setup: () => {
const mpPass = ref(''); const mpPass = ref("");
const loading = ref(false); const loading = ref(false);
const alertOpen = ref(false); const alertOpen = ref(false);
const alertMsg = ref(''); const alertMsg = ref("");
const close = () => { const close = () => {
return modalController?.dismiss(null, 'cancel'); return modalController?.dismiss(null, "cancel");
} };
const unlock = async () => { const unlock = async () => {
try { try {
loading.value = true loading.value = true;
let accounts = await getAccounts() let accounts = await getAccounts();
const cryptoParams = await getCryptoParams(mpPass.value) const cryptoParams = await getCryptoParams(mpPass.value);
const accProm = accounts.map(async a => { const accProm = accounts.map(async (a) => {
if(a.encPk) { if (a.encPk) {
a.pk = await decrypt(a.encPk, cryptoParams) a.pk = await decrypt(a.encPk, cryptoParams);
} }
return a return a;
}) });
accounts = await Promise.all(accProm) accounts = await Promise.all(accProm);
await replaceAccounts(accounts) await replaceAccounts(accounts);
await saveSelectedAccount(accounts[0]) await saveSelectedAccount(accounts[0]);
loading.value = false loading.value = false;
return modalController?.dismiss(mpPass.value, 'confirm'); return modalController?.dismiss(mpPass.value, "confirm");
} catch { } catch {
loading.value = false loading.value = false;
alertMsg.value = 'Decryption failed, password is not correct, try again.'; alertMsg.value = "Decryption failed, password is not correct, try again.";
alertOpen.value = true alertOpen.value = true;
return return;
} }
} };
return { return {
loading, loading,
unlock, unlock,
mpPass, mpPass,
alertOpen, alertOpen,
alertMsg, alertMsg,

View File

@ -29,6 +29,7 @@
cssClass="my-custom-class" cssClass="my-custom-class"
message="Please wait..." message="Please wait..."
:duration="4000" :duration="4000"
:key="`k${loading}`"
@didDismiss="loading = false" @didDismiss="loading = false"
> >
</ion-loading> </ion-loading>