[UI > Settings] Fix alert race condition (#162)

This commit is contained in:
nexpid 2023-10-20 18:06:04 +02:00 committed by GitHub
parent 8352072654
commit 43d351ce4f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -49,16 +49,16 @@ export const getScreens = (youKeys = false): Screen[] => [
alertTitle="Install Plugin" alertTitle="Install Plugin"
installFunction={async (input) => { installFunction={async (input) => {
if (!input.startsWith(PROXY_PREFIX) && !settings.developerSettings) if (!input.startsWith(PROXY_PREFIX) && !settings.developerSettings)
showConfirmationAlert({ setImmediate(() => showConfirmationAlert({
title: "Unproxied Plugin", title: "Unproxied Plugin",
content: "The plugin you are trying to install has not been proxied/verified by Vendetta staff. Are you sure you want to continue?", content: "The plugin you are trying to install has not been proxied/verified by Vendetta staff. Are you sure you want to continue?",
confirmText: "Install", confirmText: "Install",
onConfirm: () => onConfirm: () =>
installPlugin(input) installPlugin(input)
.then(() => showToast("Installed plugin", getAssetIDByName("Check"))) .then(() => showToast("Installed plugin", getAssetIDByName("Check")))
.catch((x) => showToast(x.toString(), getAssetIDByName("Small"))), .catch((x) => showToast(x?.message ?? `${x}`, getAssetIDByName("Small"))),
cancelText: "Cancel", cancelText: "Cancel",
}); }));
else return await installPlugin(input); else return await installPlugin(input);
}} }}
/> />