fix: display offline hosted only for third party features
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
import { FunctionComponent } from "preact";
|
import { FunctionComponent } from "preact";
|
||||||
import { SNComponent } from "@standardnotes/snjs";
|
import { SNComponent } from "@standardnotes/snjs";
|
||||||
import { ComponentArea } from "@standardnotes/features";
|
|
||||||
import { PreferencesSegment, SubtitleLight, Title } from "@/preferences/components";
|
import { PreferencesSegment, SubtitleLight, Title } from "@/preferences/components";
|
||||||
import { Switch } from "@/components/Switch";
|
import { Switch } from "@/components/Switch";
|
||||||
import { WebApplication } from "@/ui_models/application";
|
import { WebApplication } from "@/ui_models/application";
|
||||||
@@ -27,28 +26,10 @@ export interface ExtensionItemProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const ExtensionItem: FunctionComponent<ExtensionItemProps> =
|
export const ExtensionItem: FunctionComponent<ExtensionItemProps> =
|
||||||
({ application, extension, first, uninstall, toggleActivate, latestVersion }) => {
|
({ application, extension, first, uninstall}) => {
|
||||||
const [autoupdateDisabled, setAutoupdateDisabled] = useState(extension.autoupdateDisabled ?? false);
|
|
||||||
const [offlineOnly, setOfflineOnly] = useState(extension.offlineOnly ?? false);
|
const [offlineOnly, setOfflineOnly] = useState(extension.offlineOnly ?? false);
|
||||||
const [extensionName, setExtensionName] = useState(extension.name);
|
const [extensionName, setExtensionName] = useState(extension.name);
|
||||||
|
|
||||||
const toggleAutoupdate = () => {
|
|
||||||
const newAutoupdateValue = !autoupdateDisabled;
|
|
||||||
setAutoupdateDisabled(newAutoupdateValue);
|
|
||||||
application
|
|
||||||
.changeAndSaveItem(extension.uuid, (m: any) => {
|
|
||||||
if (m.content == undefined) m.content = {};
|
|
||||||
m.content.autoupdateDisabled = newAutoupdateValue;
|
|
||||||
})
|
|
||||||
.then((item) => {
|
|
||||||
const component = (item as SNComponent);
|
|
||||||
setAutoupdateDisabled(component.autoupdateDisabled);
|
|
||||||
})
|
|
||||||
.catch(e => {
|
|
||||||
console.error(e);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const toggleOffllineOnly = () => {
|
const toggleOffllineOnly = () => {
|
||||||
const newOfflineOnly = !offlineOnly;
|
const newOfflineOnly = !offlineOnly;
|
||||||
setOfflineOnly(newOfflineOnly);
|
setOfflineOnly(newOfflineOnly);
|
||||||
@@ -80,6 +61,7 @@ export const ExtensionItem: FunctionComponent<ExtensionItemProps> =
|
|||||||
};
|
};
|
||||||
|
|
||||||
const localInstallable = extension.package_info.download_url;
|
const localInstallable = extension.package_info.download_url;
|
||||||
|
const isThirParty = application.isThirdPartyFeature(extension.identifier);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PreferencesSegment classes={'mb-5'}>
|
<PreferencesSegment classes={'mb-5'}>
|
||||||
@@ -91,7 +73,7 @@ export const ExtensionItem: FunctionComponent<ExtensionItemProps> =
|
|||||||
<RenameExtension extensionName={extensionName} changeName={changeExtensionName} />
|
<RenameExtension extensionName={extensionName} changeName={changeExtensionName} />
|
||||||
<div className="min-h-2" />
|
<div className="min-h-2" />
|
||||||
|
|
||||||
{localInstallable && <UseHosted offlineOnly={offlineOnly} toggleOfllineOnly={toggleOffllineOnly} />}
|
{isThirParty && localInstallable && <UseHosted offlineOnly={offlineOnly} toggleOfllineOnly={toggleOffllineOnly} />}
|
||||||
|
|
||||||
<>
|
<>
|
||||||
<div className="min-h-2" />
|
<div className="min-h-2" />
|
||||||
|
|||||||
@@ -89,7 +89,7 @@
|
|||||||
"@reach/tooltip": "^0.16.2",
|
"@reach/tooltip": "^0.16.2",
|
||||||
"@standardnotes/features": "1.20.5",
|
"@standardnotes/features": "1.20.5",
|
||||||
"@standardnotes/sncrypto-web": "1.5.3",
|
"@standardnotes/sncrypto-web": "1.5.3",
|
||||||
"@standardnotes/snjs": "2.34.1",
|
"@standardnotes/snjs": "2.34.2",
|
||||||
"mobx": "^6.3.5",
|
"mobx": "^6.3.5",
|
||||||
"mobx-react-lite": "^3.2.2",
|
"mobx-react-lite": "^3.2.2",
|
||||||
"preact": "^10.5.15",
|
"preact": "^10.5.15",
|
||||||
|
|||||||
@@ -2655,10 +2655,10 @@
|
|||||||
buffer "^6.0.3"
|
buffer "^6.0.3"
|
||||||
libsodium-wrappers "^0.7.9"
|
libsodium-wrappers "^0.7.9"
|
||||||
|
|
||||||
"@standardnotes/snjs@2.34.1":
|
"@standardnotes/snjs@2.34.2":
|
||||||
version "2.34.1"
|
version "2.34.2"
|
||||||
resolved "https://registry.yarnpkg.com/@standardnotes/snjs/-/snjs-2.34.1.tgz#d65ccc52ef316019f3461205d472ba0a1ba4164c"
|
resolved "https://registry.yarnpkg.com/@standardnotes/snjs/-/snjs-2.34.2.tgz#540f32252083f99ee635b900cc70aa19ed68e1f2"
|
||||||
integrity sha512-4IZ0b7G4Pp8zzrcacePQttm7LCF9vROL42BBALUrOIRDB6L22s978jM9bGYGIveI0FJI3mRnW4i1pXnoJzrqLA==
|
integrity sha512-JhhjAQ66sSHTnGSgTY5VSJU7Lv9fnX0X+SR/pPPi0Kv3gk+aqVi2Zmgf8htmigJSFtrmn2pXGSaJk1v92LFckw==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@standardnotes/auth" "3.8.1"
|
"@standardnotes/auth" "3.8.1"
|
||||||
"@standardnotes/common" "1.2.1"
|
"@standardnotes/common" "1.2.1"
|
||||||
|
|||||||
Reference in New Issue
Block a user