diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-12-12 15:38:03 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-12-12 15:38:03 +0100 |
commit | 1bcc5022c27fff2c28c38b3db12ac353cc7d3481 (patch) | |
tree | 719c8f342a4cfd4c13fc3aec58a30cce6aac007c | |
parent | b4484c8af37b0c5912adce2dcf3a40d9455c7200 (diff) |
show tip in history
-rw-r--r-- | src/i18n/de.po | 16 | ||||
-rw-r--r-- | src/i18n/en-US.po | 13 | ||||
-rw-r--r-- | src/i18n/fr.po | 13 | ||||
-rw-r--r-- | src/i18n/it.po | 13 | ||||
-rw-r--r-- | src/i18n/strings.ts | 12 | ||||
-rw-r--r-- | src/i18n/taler-wallet-webex.pot | 13 | ||||
-rw-r--r-- | src/types.ts | 2 | ||||
-rw-r--r-- | src/wallet.ts | 18 | ||||
-rw-r--r-- | src/webex/pages/popup.tsx | 12 |
9 files changed, 96 insertions, 16 deletions
diff --git a/src/i18n/de.po b/src/i18n/de.po index cafa23d4e..49b7ada8f 100644 --- a/src/i18n/de.po +++ b/src/i18n/de.po @@ -255,17 +255,27 @@ msgstr "Reserve (%1$s) mit %2$s bei %3$s erzeugt" msgid "Merchant%1$sgave a refund over%2$s.\n" msgstr "" -#: src/webex/pages/popup.tsx:405 +#: src/webex/pages/popup.tsx:408 +#, fuzzy, c-format +msgid "" +"Merchant%1$sgave a%2$sof%3$s.\n" +"%4$s%5$s" +msgstr "" +"%1$s\n" +" möchte einen Vertrag über %2$s\n" +" mit Ihnen abschließen." + +#: src/webex/pages/popup.tsx:417 #, c-format msgid "Unknown event (%1$s)" msgstr "" -#: src/webex/pages/popup.tsx:448 +#: src/webex/pages/popup.tsx:460 #, c-format msgid "Error: could not retrieve event history" msgstr "" -#: src/webex/pages/popup.tsx:473 +#: src/webex/pages/popup.tsx:485 #, c-format msgid "Your wallet has no events recorded." msgstr "Ihre Geldbörse verzeichnet keine Vorkommnisse." diff --git a/src/i18n/en-US.po b/src/i18n/en-US.po index 559b8f8c5..e42d81fb5 100644 --- a/src/i18n/en-US.po +++ b/src/i18n/en-US.po @@ -252,17 +252,24 @@ msgstr "" msgid "Merchant%1$sgave a refund over%2$s.\n" msgstr "" -#: src/webex/pages/popup.tsx:405 +#: src/webex/pages/popup.tsx:408 +#, c-format +msgid "" +"Merchant%1$sgave a%2$sof%3$s.\n" +"%4$s%5$s" +msgstr "" + +#: src/webex/pages/popup.tsx:417 #, c-format msgid "Unknown event (%1$s)" msgstr "" -#: src/webex/pages/popup.tsx:448 +#: src/webex/pages/popup.tsx:460 #, c-format msgid "Error: could not retrieve event history" msgstr "" -#: src/webex/pages/popup.tsx:473 +#: src/webex/pages/popup.tsx:485 #, c-format msgid "Your wallet has no events recorded." msgstr "" diff --git a/src/i18n/fr.po b/src/i18n/fr.po index 6e31237da..6b126178f 100644 --- a/src/i18n/fr.po +++ b/src/i18n/fr.po @@ -252,17 +252,24 @@ msgstr "" msgid "Merchant%1$sgave a refund over%2$s.\n" msgstr "" -#: src/webex/pages/popup.tsx:405 +#: src/webex/pages/popup.tsx:408 +#, c-format +msgid "" +"Merchant%1$sgave a%2$sof%3$s.\n" +"%4$s%5$s" +msgstr "" + +#: src/webex/pages/popup.tsx:417 #, c-format msgid "Unknown event (%1$s)" msgstr "" -#: src/webex/pages/popup.tsx:448 +#: src/webex/pages/popup.tsx:460 #, c-format msgid "Error: could not retrieve event history" msgstr "" -#: src/webex/pages/popup.tsx:473 +#: src/webex/pages/popup.tsx:485 #, c-format msgid "Your wallet has no events recorded." msgstr "" diff --git a/src/i18n/it.po b/src/i18n/it.po index 6e31237da..6b126178f 100644 --- a/src/i18n/it.po +++ b/src/i18n/it.po @@ -252,17 +252,24 @@ msgstr "" msgid "Merchant%1$sgave a refund over%2$s.\n" msgstr "" -#: src/webex/pages/popup.tsx:405 +#: src/webex/pages/popup.tsx:408 +#, c-format +msgid "" +"Merchant%1$sgave a%2$sof%3$s.\n" +"%4$s%5$s" +msgstr "" + +#: src/webex/pages/popup.tsx:417 #, c-format msgid "Unknown event (%1$s)" msgstr "" -#: src/webex/pages/popup.tsx:448 +#: src/webex/pages/popup.tsx:460 #, c-format msgid "Error: could not retrieve event history" msgstr "" -#: src/webex/pages/popup.tsx:473 +#: src/webex/pages/popup.tsx:485 #, c-format msgid "Your wallet has no events recorded." msgstr "" diff --git a/src/i18n/strings.ts b/src/i18n/strings.ts index e2bd80a80..d18368adc 100644 --- a/src/i18n/strings.ts +++ b/src/i18n/strings.ts @@ -144,6 +144,9 @@ strings['de'] = { "Merchant%1$sgave a refund over%2$s.\n": [ "" ], + "Merchant%1$sgave a%2$sof%3$s.\n%4$s%5$s": [ + "%1$s\n möchte einen Vertrag über %2$s\n mit Ihnen abschließen." + ], "Unknown event (%1$s)": [ "" ], @@ -330,6 +333,9 @@ strings['en-US'] = { "Merchant%1$sgave a refund over%2$s.\n": [ "" ], + "Merchant%1$sgave a%2$sof%3$s.\n%4$s%5$s": [ + "" + ], "Unknown event (%1$s)": [ "" ], @@ -516,6 +522,9 @@ strings['fr'] = { "Merchant%1$sgave a refund over%2$s.\n": [ "" ], + "Merchant%1$sgave a%2$sof%3$s.\n%4$s%5$s": [ + "" + ], "Unknown event (%1$s)": [ "" ], @@ -702,6 +711,9 @@ strings['it'] = { "Merchant%1$sgave a refund over%2$s.\n": [ "" ], + "Merchant%1$sgave a%2$sof%3$s.\n%4$s%5$s": [ + "" + ], "Unknown event (%1$s)": [ "" ], diff --git a/src/i18n/taler-wallet-webex.pot b/src/i18n/taler-wallet-webex.pot index 6e31237da..6b126178f 100644 --- a/src/i18n/taler-wallet-webex.pot +++ b/src/i18n/taler-wallet-webex.pot @@ -252,17 +252,24 @@ msgstr "" msgid "Merchant%1$sgave a refund over%2$s.\n" msgstr "" -#: src/webex/pages/popup.tsx:405 +#: src/webex/pages/popup.tsx:408 +#, c-format +msgid "" +"Merchant%1$sgave a%2$sof%3$s.\n" +"%4$s%5$s" +msgstr "" + +#: src/webex/pages/popup.tsx:417 #, c-format msgid "Unknown event (%1$s)" msgstr "" -#: src/webex/pages/popup.tsx:448 +#: src/webex/pages/popup.tsx:460 #, c-format msgid "Error: could not retrieve event history" msgstr "" -#: src/webex/pages/popup.tsx:473 +#: src/webex/pages/popup.tsx:485 #, c-format msgid "Your wallet has no events recorded." msgstr "" diff --git a/src/types.ts b/src/types.ts index 69ed64446..857537251 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1948,6 +1948,8 @@ export interface TipRecord { * URL to go to once the tip has been accepted. */ nextUrl: string; + + timestamp: number; } diff --git a/src/wallet.ts b/src/wallet.ts index a597fd5bc..5b658de85 100644 --- a/src/wallet.ts +++ b/src/wallet.ts @@ -329,7 +329,7 @@ export const WALLET_PROTOCOL_VERSION = "2:0:0"; * In the future we might consider adding migration functions for * each version increment. */ -export const WALLET_DB_VERSION = 22; +export const WALLET_DB_VERSION = 23; const builtinCurrencies: CurrencyRecord[] = [ { @@ -2356,6 +2356,20 @@ export class Wallet { } } + const tips: TipRecord[] = await this.q().iter<TipRecord>(Stores.tips).toArray(); + for (const tip of tips) { + history.push({ + detail: { + merchantDomain: tip.merchantDomain, + amount: tip.amount, + reservePub: tip.accepted, + tipId: tip.tipId, + }, + timestamp: tip.timestamp, + type: "tip", + }); + } + history.sort((h1, h2) => Math.sign(h1.timestamp - h2.timestamp)); return {history}; @@ -2869,6 +2883,7 @@ export class Wallet { const denomsForWithdraw = await this.getVerifiedWithdrawDenomList(exchangeUrl, amount); const planchets = await Promise.all(denomsForWithdraw.map(d => this.cryptoApi.createTipPlanchet(d))); const coinPubs: string[] = planchets.map(x => x.coinPub); + const now = (new Date()).getTime(); tipRecord = { accepted: false, amount, @@ -2878,6 +2893,7 @@ export class Wallet { merchantDomain, nextUrl, planchets, + timestamp: now, tipId, }; await this.q().put(Stores.tips, tipRecord).finish(); diff --git a/src/webex/pages/popup.tsx b/src/webex/pages/popup.tsx index 82f3eddaa..389be3b5c 100644 --- a/src/webex/pages/popup.tsx +++ b/src/webex/pages/popup.tsx @@ -401,6 +401,18 @@ function formatHistoryItem(historyItem: HistoryRecord) { </i18n.Translate> ); } + case "tip": { + const tipPageUrl = new URI(chrome.extension.getURL("/src/webex/pages/tip.html")); + const params = { tip_id: d.tipId, merchant_domain: d.merchantDomain }; + const url = tipPageUrl.query(params).href(); + return ( + <i18n.Translate wrap="p"> + Merchant <span>{d.merchantDomain}</span> gave a <a href={url} onClick={openTab(url)}> tip</a> of <span>{renderAmount(d.amount)}</span>. + <span> </span> + {d.accepted ? null : <span>You did not accepted the tip yet.</span> } + </i18n.Translate> + ); + } default: return (<p>{i18n.str`Unknown event (${historyItem.type})`}</p>); } |