fix remove provider from backup and #7167
This commit is contained in:
parent
54d5cc02d1
commit
bc1c33e1ce
@ -81,6 +81,7 @@ export function getPermissionsApi(): CrossBrowserPermissionsApi {
|
||||
) {
|
||||
return {
|
||||
addPermissionsListener: () => {
|
||||
console.log("not supported for firefox")
|
||||
// Not supported yet.
|
||||
},
|
||||
contains: myBrowser.permissions.contains,
|
||||
|
@ -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}
|
||||
/>
|
||||
);
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user