Skip to content

Commit

Permalink
Merge pull request #187 from aeternity/release/0.0.19
Browse files Browse the repository at this point in the history
Release 0.0.19
  • Loading branch information
mradkov authored Apr 24, 2020
2 parents e19a0e8 + 472f7a6 commit 43fe240
Show file tree
Hide file tree
Showing 32 changed files with 458 additions and 308 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

**SuperHero is a browser extension that allows you to send and recieve value to URLs and content accross Internet.**

[![Build Status](https://travis-ci.com/aeternity/superhero-wallet.svg?branch=master)](https://travis-ci.com/aeternity/superhero-wallet)
[![Build Status](https://travis-ci.com/aeternity/superhero-wallet.svg?branch=develop)](https://travis-ci.com/aeternity/superhero-wallet)

## Build

Clone the master branch of this repo.
Expand Down
2 changes: 1 addition & 1 deletion config.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.superhero.cordova" version="0.0.18" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget id="com.superhero.cordova" version="0.0.19" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>SuperHero</name>
<description>SuperHero wallet</description>
<author email="dev@cordova.apache.org" href="http://cordova.io">
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "superhero-wallet",
"version": "0.0.18",
"version": "0.0.19",
"description": "Superhero wallet",
"author": "SuperHero",
"license": "MIT",
Expand Down
23 changes: 23 additions & 0 deletions src/mixins/removeAccount.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { AEX2_METHODS } from '../popup/utils/constants';
import { postMessage } from '../popup/utils/connection';

export default {
methods: {
async removeAccount() {
const remove = await this.$store
.dispatch('modals/open', {
name: 'confirm',
title: this.$t('modals.removeAccount.title'),
msg: this.$t('modals.removeAccount.msg'),
})
.catch(() => false);
if (remove) {
this.$emit('closeMenu');
await this.$store.dispatch('reset');
await this.$router.push('/');
this.$store.commit('SET_MAIN_LOADING', false);
if (process.env.IS_EXTENSION) postMessage({ type: AEX2_METHODS.LOGOUT });
}
},
},
};
8 changes: 2 additions & 6 deletions src/popup/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,11 @@ export default {
this.pollData();
},
pollData() {
let triggerOnce = false;
const polling = setInterval(async () => {
if (!this.isLoggedIn) return;
if (!process.env.RUNNING_IN_TESTS) this.$store.dispatch('updateBalance');
if (!triggerOnce) {
this.$store.dispatch('getRegisteredNames');
triggerOnce = true;
}
if (!process.env.RUNNING_IN_TESTS && this.sdk) this.$store.dispatch('updateBalance');
}, 2500);
this.$store.dispatch('getRegisteredNames');
this.$once('hook:beforeDestroy', () => clearInterval(polling));
},
},
Expand Down
27 changes: 20 additions & 7 deletions src/popup/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,13 @@
},
"insufficient-balance": {
"msg": "The requested amount cannot be spent."
}
},
"removeAccount": {
"title": "Are you sure you want to remove this account?",
"msg": "This action will remove your account from the wallet and will delete the extension storage. Make sure you have backed up your seed phrase before proceeding. This action cannot be undone!"
},
"cancel": "Cancel",
"confirm": "Confirm"
},
"pages": {
"intro": {
Expand Down Expand Up @@ -137,7 +143,8 @@
"mainAccount": "Main account",
"reportBug": "Report a bug",
"names": "Names",
"networks": "Networks"
"networks": "Networks",
"removeAccount": "Remove account"
},
"aboutSettings": {
"heading": "About",
Expand Down Expand Up @@ -176,7 +183,9 @@
"tipsOnUrl": "Tips on this URL",
"urlNotExisting": "Tip for this url does not exist",
"moreOracles": "There are not enough active oracles to verify your claim request, please try again later.",
"oracleFailed": "Oracle service check claim failed, please try again later."
"oracleFailed": "Oracle service check claim failed, please try again later.",
"unknownError": "Error occured during claim request, please try again later.",
"noMobileClaim": "Claiming is currently only available on the web extension on desktop"
},
"accountPassword": {
"heading": "",
Expand Down Expand Up @@ -437,7 +446,7 @@
"decryptingPrivateKey": "Decrypting private key",
"showSeedPhrase": "Show seed phrase",
"seedRecoveryHeading": "Show seed phrase",
"seedRecoverySmall": "Reveals your 12 words used for generating your private key",
"seedRecoverySmall": "Your seed phrase (also referred to as private key) serves as the keys or a password to access your account. Never disclose this to anyone. And make sure you back it up on a piece of paper that no one else can see—but that you will never lose. Losing these keys means losing access to your wallet and tips",
"seedRecoveryBtn": "Show seed phrase",
"seedPhraseWarning": "Do not share your seed with anyone, it can be used to steal all your accounts",
"seedPhrase": "Your seed phrase",
Expand Down Expand Up @@ -503,7 +512,9 @@
"tabAbout": "About",
"tabAboutsmall": "Version, support center and contact info",
"tabNetworks": "Manage networks",
"tabNetworksSmall": "Connect to custom node"
"tabNetworksSmall": "Connect to custom node",
"tabRemoveAccount": "Remove account",
"tabRemoveAccountSmall": "Remove account from the wallet and delete extension storage"
},
"signAndVerifyMsg": {
"backToSignVerifyMsg": "Back to Sign/Verify Message",
Expand Down Expand Up @@ -630,12 +641,14 @@
"availableLabel": "Available",
"confirm": "Confirm",
"cancel": "Cancel",
"edit": "Edit AE Details",
"edit": "Edit Tip Details",
"whatIsVerifieddUrl": "What is \"Verified\" URL?",
"whatIsNotVerifiedUrl": "What is \"Not verified\" URL?",
"enterUrl": "Enter tip url",
"notClaimableUrlInfo": "Third party issues prevent us to ensure that tips will be directly delivered to the URL owner. You are sending the tip at your own risk.",
"notVerifiedUrlInfo": "This URL has not yet been verified. The owner of the URL has to create account to claim their tokens.",
"verifiedUrlInfo": "If a URL is marked as verified, it means the owner of this URL is already a fellow Superhero — and that is awesome! An AE address has been included in the URL and tips can be claimed."
"verifiedUrlInfo": "If a URL is marked as verified, it means the owner of this URL is already a fellow Superhero — and that is awesome! An AE address has been included in the URL and tips can be claimed.",
"minAmountError": "You need to provide more than 0.01 USD in tokens in order to tip"
},
"successTip": {
"sendMore": "Send More AE",
Expand Down
85 changes: 58 additions & 27 deletions src/popup/router/components/AmountSend.vue
Original file line number Diff line number Diff line change
@@ -1,31 +1,34 @@
<template>
<div class="flex flex-justify-between flex-align-start mt-25">
<Input
class="amount-box"
type="number"
:error="amountError || finalAmount <= 0"
v-model="finalAmount"
:placeholder="$t('pages.tipPage.amountPlaceholder')"
:label="$t('pages.tipPage.amountLabel')"
/>
<div class="ml-15 text-left" style="margin-right:auto">
<p class="label hidden">Empty</p>
<span class="secondary-text f-14 block l-1" data-cy="amount">
{{ $t('pages.appVUE.aeid') }}</span
>
<span class="f-14 block l-1" data-cy="amount-currency"
>{{ getCurrencyAmount }} {{ currentCurrency }}</span
>
</div>
<div class="balance-box">
<p class="label">{{ $t('pages.tipPage.availableLabel') }}</p>
<span class="secondary-text f-14 block l-1" data-cy="balance"
>{{ tokenBalance }} {{ $t('pages.appVUE.aeid') }}</span
>
<span class="f-14 block l-1" data-cy="balance-currency"
>{{ balanceCurrency }} {{ currentCurrency }}</span
>
<div class="amount-send-container">
<div class="amount-send">
<Input
class="amount-box"
type="number"
:error="amountError || finalAmount <= 0"
v-model="finalAmount"
:placeholder="$t('pages.tipPage.amountPlaceholder')"
:label="$t('pages.tipPage.amountLabel')"
/>
<div class="ml-15 text-left" style="margin-right:auto">
<p class="label hidden">Empty</p>
<span class="secondary-text f-14 block l-1" data-cy="amount">
{{ $t('pages.appVUE.aeid') }}
</span>
<span class="f-14 block l-1" data-cy="amount-currency">
{{ getCurrencyAmount }} {{ currentCurrency }}
</span>
</div>
<div class="balance-box">
<p class="label">{{ $t('pages.tipPage.availableLabel') }}</p>
<span class="secondary-text f-14 block l-1" data-cy="balance">
{{ tokenBalance }} {{ $t('pages.appVUE.aeid') }}
</span>
<span class="f-14 block l-1" data-cy="balance-currency">
{{ balanceCurrency }} {{ currentCurrency }}
</span>
</div>
</div>
<div v-if="errorMsg" class="error-msg">{{ $t('pages.tipPage.minAmountError') }}</div>
</div>
</template>

Expand All @@ -37,7 +40,7 @@ export default {
components: {
Input,
},
props: ['amountError', 'value'],
props: ['amountError', 'value', 'errorMsg'],
data() {
return {
finalAmount: null,
Expand All @@ -63,3 +66,31 @@ export default {
},
};
</script>

<style lang="scss">
@import '../../../common/variables';
.amount-send-container {
margin-bottom: 22px;
margin-top: 25px;
.amount-send {
display: flex;
justify-content: space-between;
align-items: flex-start;
input.input {
margin-bottom: 0;
}
}
.error-msg {
font-weight: normal;
color: $input-error-color !important;
font-size: 12px;
word-break: break-word;
margin-top: 10px;
text-align: left;
}
}
</style>
12 changes: 11 additions & 1 deletion src/popup/router/components/BoxButton.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div class="button-container">
<div class="button-content" @click="handleClick">
<div class="button-content" @click="handleClick" :class="{ disabled }">
<slot name="icon" />
<span class="button-text" :class="accent ? 'button-text-accent' : ''">{{ text }}</span>
</div>
Expand All @@ -16,6 +16,11 @@ export default {
},
to: String,
accent: Boolean,
disabled: {
type: Boolean,
default: false,
required: false,
},
},
methods: {
handleClick() {
Expand Down Expand Up @@ -58,6 +63,11 @@ export default {
color: $accent-color;
}
}
&.disabled {
pointer-events: all;
opacity: 0.3;
}
}
}
</style>
94 changes: 55 additions & 39 deletions src/popup/router/components/ClaimTips.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<template>
<BoxButton :text="$t('pages.account.claim')" accent @handleClick="claimTips" class="tour__step4">
<BoxButton
:text="$t('pages.account.claim')"
accent
@handleClick="claimTips"
class="tour__step4"
:disabled="IS_MOBILE"
>
<Claim slot="icon" />
</BoxButton>
</template>
Expand All @@ -18,46 +24,56 @@ export default {
BoxButton,
},
computed: mapGetters(['sdk', 'tipping', 'account', 'popup']),
data: () => ({ IS_MOBILE: !process.env.IS_EXTENSION }),
methods: {
async claimTips() {
this.$emit('setLoading', true);
await this.$watchUntilTruly(() => this.sdk);
await this.$watchUntilTruly(() => this.tipping);
const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
try {
if (!tab.url || tab.url.indexOf('chrome://') > -1 || tab.url.indexOf('about:newtab') > -1)
throw new Error(this.$t('pages.claim.noZeroClaim'));
const claimAmount = parseFloat(
aettosToAe(
await this.tipping.methods
.unclaimed_for_url(tab.url)
.then(r => r.decodedResult)
.catch(() => 0),
),
);
if (!claimAmount) throw new Error(this.$t('pages.claim.noZeroClaim'));
await axios
.post(`${TIP_SERVICE}`, { url: tab.url, address: this.account.publicKey })
.catch(({ response }) => {
const { error } = response.data;
if (error.includes('MORE_ORACLES_NEEDED'))
throw new Error(this.$t('pages.claim.moreOracles'));
else if (error.includes('URL_NOT_EXISTING'))
throw new Error(this.$t('pages.claim.urlNotExisting'));
else if (error.includes('NO_ZERO_AMOUNT_PAYOUT'))
throw new Error(this.$t('pages.claim.noZeroClaim'));
else if (error.includes('ORACLE_SEVICE_CHECK_CLAIM_FAILED'))
throw new Error(this.$t('pages.claim.oracleFailed'));
else throw new Error(error);
});
await axios.post(`${BACKEND_URL}/cache/invalidate/tips`).catch();
await axios.post(`${BACKEND_URL}/cache/invalidate/oracle`).catch();
this.$emit('setLoading', false);
this.$store.dispatch('modals/open', { name: 'claim-success', url: tab.url, claimAmount });
} catch (e) {
const msg = e.message.replace('Error: ', '');
this.$emit('setLoading', false);
this.$store.dispatch('modals/open', { name: 'default', msg });
if (process.env.IS_EXTENSION) {
this.$emit('setLoading', true);
await this.$watchUntilTruly(() => this.sdk);
await this.$watchUntilTruly(() => this.tipping);
const [tab] = await browser.tabs.query({ active: true, currentWindow: true });
try {
if (!tab.url || tab.url.indexOf('chrome://') > -1 || tab.url.indexOf('about:newtab') > -1)
throw new Error(this.$t('pages.claim.noZeroClaim'));
const claimAmount = parseFloat(
aettosToAe(
await this.tipping.methods
.unclaimed_for_url(tab.url)
.then(r => r.decodedResult)
.catch(() => 1),
),
);
if (!claimAmount) throw new Error(this.$t('pages.claim.noZeroClaim'));
await axios
.post(`${TIP_SERVICE}`, { url: tab.url, address: this.account.publicKey })
.catch(({ response }) => {
const { error = 'UNKNOWN_ERROR' } = response.data;
if (error.includes('MORE_ORACLES_NEEDED'))
throw new Error(this.$t('pages.claim.moreOracles'));
else if (error.includes('URL_NOT_EXISTING'))
throw new Error(this.$t('pages.claim.urlNotExisting'));
else if (error.includes('NO_ZERO_AMOUNT_PAYOUT'))
throw new Error(this.$t('pages.claim.noZeroClaim'));
else if (error.includes('ORACLE_SEVICE_CHECK_CLAIM_FAILED'))
throw new Error(this.$t('pages.claim.oracleFailed'));
else if (error.includes('UNKNOWN_ERROR'))
throw new Error(this.$t('pages.claim.unknownError'));
else throw new Error(error);
});
await axios.post(`${BACKEND_URL}/cache/invalidate/tip`).catch();
await axios.post(`${BACKEND_URL}/cache/invalidate/oracle`).catch();
this.$emit('setLoading', false);
this.$store.dispatch('modals/open', { name: 'claim-success', url: tab.url, claimAmount });
} catch (e) {
const msg = e.message.replace('Error: ', '');
this.$emit('setLoading', false);
this.$store.dispatch('modals/open', { name: 'default', msg });
}
} else {
this.$store.dispatch('modals/open', {
name: 'default',
msg: this.$t('pages.claim.noMobileClaim'),
});
}
},
},
Expand Down
Loading

1 comment on commit 43fe240

@davidyuk
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.