aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-webextension
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2022-03-15 00:24:39 -0300
committerSebastian <sebasjm@gmail.com>2022-03-15 00:24:39 -0300
commit984cbb7ab79b50eab38bb6a05ab56ccc278ac835 (patch)
treef1d06a6d337e3241707acce14cc6f691de37bb16 /packages/taler-wallet-webextension
parenta5f357f07857d4740931e57eb65b750ab9e66b02 (diff)
save tos etag after forced refresh
Diffstat (limited to 'packages/taler-wallet-webextension')
-rw-r--r--packages/taler-wallet-webextension/src/cta/TermsOfServiceSection.tsx11
-rw-r--r--packages/taler-wallet-webextension/src/cta/Withdraw.tsx9
-rw-r--r--packages/taler-wallet-webextension/src/popup/DeveloperPage.tsx9
-rw-r--r--packages/taler-wallet-webextension/src/wxBackend.ts3
4 files changed, 20 insertions, 12 deletions
diff --git a/packages/taler-wallet-webextension/src/cta/TermsOfServiceSection.tsx b/packages/taler-wallet-webextension/src/cta/TermsOfServiceSection.tsx
index cafc43c6f..2073ef775 100644
--- a/packages/taler-wallet-webextension/src/cta/TermsOfServiceSection.tsx
+++ b/packages/taler-wallet-webextension/src/cta/TermsOfServiceSection.tsx
@@ -27,9 +27,10 @@ export function TermsOfServiceSection({
onReview,
}: Props): VNode {
const { i18n } = useTranslationContext();
+ const ableToReviewTermsOfService = onReview !== undefined;
if (!reviewing) {
if (!reviewed) {
- if (!onReview) {
+ if (!ableToReviewTermsOfService) {
return (
<Fragment>
{terms.status === "notfound" && (
@@ -78,7 +79,7 @@ export function TermsOfServiceSection({
}
return (
<Fragment>
- {onReview && (
+ {ableToReviewTermsOfService && (
<section>
<LinkSuccess upperCased onClick={() => onReview(true)}>
<i18n.Translate>Show terms of service</i18n.Translate>
@@ -96,7 +97,7 @@ export function TermsOfServiceSection({
}
onToggle={() => {
onAccept(!reviewed);
- if (onReview) onReview(false);
+ if (ableToReviewTermsOfService) onReview(false);
}}
/>
</section>
@@ -136,7 +137,7 @@ export function TermsOfServiceSection({
)}
</section>
)}
- {reviewed && onReview && (
+ {reviewed && ableToReviewTermsOfService && (
<section>
<LinkSuccess upperCased onClick={() => onReview(false)}>
<i18n.Translate>Hide terms of service</i18n.Translate>
@@ -155,7 +156,7 @@ export function TermsOfServiceSection({
}
onToggle={() => {
onAccept(!reviewed);
- if (onReview) onReview(false);
+ if (ableToReviewTermsOfService) onReview(false);
}}
/>
</section>
diff --git a/packages/taler-wallet-webextension/src/cta/Withdraw.tsx b/packages/taler-wallet-webextension/src/cta/Withdraw.tsx
index 8535c67eb..f19da3960 100644
--- a/packages/taler-wallet-webextension/src/cta/Withdraw.tsx
+++ b/packages/taler-wallet-webextension/src/cta/Withdraw.tsx
@@ -293,11 +293,14 @@ export function WithdrawPageWithParsedURI({
const details = detailsHook.response;
- const onAccept = async (): Promise<void> => {
+ const onAccept = async (accepted: boolean): Promise<void> => {
if (!exchange) return;
try {
- await wxApi.setExchangeTosAccepted(exchange, details.tos.version);
- setReviewed(true);
+ await wxApi.setExchangeTosAccepted(
+ exchange,
+ accepted ? details.tos.version : undefined,
+ );
+ setReviewed(accepted);
} catch (e) {
if (e instanceof Error) {
//FIXME: uncomment this and display error
diff --git a/packages/taler-wallet-webextension/src/popup/DeveloperPage.tsx b/packages/taler-wallet-webextension/src/popup/DeveloperPage.tsx
index 3144a9ce3..738ece2f1 100644
--- a/packages/taler-wallet-webextension/src/popup/DeveloperPage.tsx
+++ b/packages/taler-wallet-webextension/src/popup/DeveloperPage.tsx
@@ -20,6 +20,7 @@ import {
CoinDumpJson,
ExchangeListItem,
NotificationType,
+ Timestamp,
Translate,
} from "@gnu-taler/taler-util";
import { PendingTaskInfo } from "@gnu-taler/taler-wallet-core";
@@ -246,7 +247,13 @@ export function View({
{operations.reverse().map((o) => {
return (
<NotifyUpdateFadeOut key={hashObjectId(o)}>
- <dt>{o.type}</dt>
+ <dt>
+ {o.type}{" "}
+ <Time
+ timestamp={o.timestampDue}
+ format="yy/MM/dd hh:mm:ss"
+ />
+ </dt>
<dd>
<pre>{JSON.stringify(o, undefined, 2)}</pre>
</dd>
diff --git a/packages/taler-wallet-webextension/src/wxBackend.ts b/packages/taler-wallet-webextension/src/wxBackend.ts
index 52187936b..66debf266 100644
--- a/packages/taler-wallet-webextension/src/wxBackend.ts
+++ b/packages/taler-wallet-webextension/src/wxBackend.ts
@@ -319,7 +319,6 @@ try {
function headerListener(
details: chrome.webRequest.WebResponseHeadersDetails,
): chrome.webRequest.BlockingResponse | undefined {
- console.log("header listener");
if (chrome.runtime.lastError) {
console.error(chrome.runtime.lastError);
return;
@@ -329,13 +328,11 @@ function headerListener(
console.warn("wallet not available while handling header");
return;
}
- console.log("in header listener");
if (
details.statusCode === 402 ||
details.statusCode === 202 ||
details.statusCode === 200
) {
- console.log(`got 402/202 from ${details.url}`);
for (const header of details.responseHeaders || []) {
if (header.name.toLowerCase() === "taler") {
const talerUri = header.value || "";