aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2022-02-01 13:26:56 -0300
committerSebastian <sebasjm@gmail.com>2022-02-16 15:16:21 -0300
commitbc1c33e1ce4ea760fb87de0dee66ca22cce9b7b7 (patch)
treeb3399f442e3708ef92436eca1b0d1e2380ceb47a
parent54d5cc02d1a7c54758f3a391385e1f8684fde108 (diff)
fix remove provider from backup and #7167
-rw-r--r--packages/taler-wallet-webextension/src/compat.ts1
-rw-r--r--packages/taler-wallet-webextension/src/components/TransactionItem.tsx2
-rw-r--r--packages/taler-wallet-webextension/src/hooks/useExtendedPermissions.ts41
-rw-r--r--packages/taler-wallet-webextension/src/wallet/ProviderDetailPage.tsx2
4 files changed, 27 insertions, 19 deletions
diff --git a/packages/taler-wallet-webextension/src/compat.ts b/packages/taler-wallet-webextension/src/compat.ts
index 36846e615..b17d0fb80 100644
--- a/packages/taler-wallet-webextension/src/compat.ts
+++ b/packages/taler-wallet-webextension/src/compat.ts
@@ -81,6 +81,7 @@ export function getPermissionsApi(): CrossBrowserPermissionsApi {
) {
return {
addPermissionsListener: () => {
+ console.log("not supported for firefox")
// Not supported yet.
},
contains: myBrowser.permissions.contains,
diff --git a/packages/taler-wallet-webextension/src/components/TransactionItem.tsx b/packages/taler-wallet-webextension/src/components/TransactionItem.tsx
index db26abec6..89d6235aa 100644
--- a/packages/taler-wallet-webextension/src/components/TransactionItem.tsx
+++ b/packages/taler-wallet-webextension/src/components/TransactionItem.tsx
@@ -111,7 +111,7 @@ export function TransactionItem(props: { tx: Transaction }): VNode {
debitCreditIndicator={"debit"}
title={tx.targetPaytoUri}
timestamp={tx.timestamp}
- iconPath={imageRefresh}
+ iconPath={imageBank}
pending={tx.pending}
/>
);
diff --git a/packages/taler-wallet-webextension/src/hooks/useExtendedPermissions.ts b/packages/taler-wallet-webextension/src/hooks/useExtendedPermissions.ts
index 12a913b1f..6bf6a7bdf 100644
--- a/packages/taler-wallet-webextension/src/hooks/useExtendedPermissions.ts
+++ b/packages/taler-wallet-webextension/src/hooks/useExtendedPermissions.ts
@@ -19,11 +19,11 @@ import * as wxApi from "../wxApi";
import { getPermissionsApi } from "../compat";
import { getReadRequestPermissions } from "../permissions";
-export function useExtendedPermissions(): [boolean, () => void] {
+export function useExtendedPermissions(): [boolean, () => Promise<void>] {
const [enabled, setEnabled] = useState(false);
- const toggle = () => {
- handleExtendedPerm(enabled, setEnabled)
+ const toggle = async () => {
+ return handleExtendedPerm(enabled, setEnabled)
};
useEffect(() => {
@@ -36,22 +36,29 @@ export function useExtendedPermissions(): [boolean, () => void] {
return [enabled, toggle];
}
-function handleExtendedPerm(isEnabled: boolean, onChange: (value: boolean) => void): void {
+async function handleExtendedPerm(isEnabled: boolean, onChange: (value: boolean) => void): Promise<void> {
if (!isEnabled) {
// We set permissions here, since apparently FF wants this to be done
// as the result of an input event ...
- getPermissionsApi().request(getReadRequestPermissions(), async (granted: boolean) => {
- if (chrome.runtime.lastError) {
- console.error("error requesting permissions");
- console.error(chrome.runtime.lastError);
- onChange(false);
- return;
- }
- console.log("permissions granted:", granted);
- const res = await wxApi.setExtendedPermissions(granted);
- onChange(res.newValue);
- });
- } else {
- wxApi.setExtendedPermissions(false).then(r => onChange(r.newValue));
+ return new Promise<void>((res) => {
+ getPermissionsApi().request(getReadRequestPermissions(), async (granted: boolean) => {
+ console.log("permissions granted:", granted);
+ if (chrome.runtime.lastError) {
+ console.error("error requesting permissions");
+ console.error(chrome.runtime.lastError);
+ onChange(false);
+ return;
+ }
+ try {
+ const res = await wxApi.setExtendedPermissions(granted);
+ onChange(res.newValue);
+ } finally {
+ res()
+ }
+
+ });
+ })
}
+ await wxApi.setExtendedPermissions(false).then(r => onChange(r.newValue));
+ return
}
diff --git a/packages/taler-wallet-webextension/src/wallet/ProviderDetailPage.tsx b/packages/taler-wallet-webextension/src/wallet/ProviderDetailPage.tsx
index d14429ee5..239a7b31d 100644
--- a/packages/taler-wallet-webextension/src/wallet/ProviderDetailPage.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/ProviderDetailPage.tsx
@@ -83,7 +83,7 @@ export function ProviderDetailPage({ pid: providerURL, onBack }: Props): VNode {
<ProviderView
info={state.response}
onSync={async () => wxApi.syncOneProvider(providerURL)}
- onDelete={async () => wxApi.syncOneProvider(providerURL).then(onBack)}
+ onDelete={async () => wxApi.removeProvider(providerURL).then(onBack)}
onBack={onBack}
onExtend={() => {
null;