Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pre-release channel support #1318

Merged
merged 4 commits into from
Mar 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 47 additions & 65 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@
"debounce-promise": "^3.1.2",
"delayable-setinterval": "^0.1.1",
"electron-is-dev": "^2.0.0",
"electron-updater": "^5.3.0",
"electron-updater": "^6.1.8",
"env-paths": "^2.2.1",
"eventemitter3": "^4.0.7",
"execution-time": "^1.4.1",
Expand Down
2 changes: 1 addition & 1 deletion source/main/library/build.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// This file updated automatically: changes made here will be overwritten!

export const VERSION = "2.26.1";
export const VERSION = "2.26.4";
11 changes: 10 additions & 1 deletion source/main/services/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,23 @@ export async function getVaultSettings(sourceID: VaultSourceID): Promise<VaultSe
}

export async function initialise(): Promise<void> {
// Run migrations
// Initialise config
const storage = getConfigStorage();
const config = (await storage.getValues()) as unknown as Config;
// Run migrations
const [updatedConfig, didMigrate] = runConfigMigrations(config);
if (didMigrate) {
logInfo("Detected config migration changes");
await storage.setValues(updatedConfig);
}
// Fill empty config values
for (const key in DEFAULT_CONFIG) {
const configKey = key as keyof Config;
if (typeof config[configKey] === "undefined") {
// Fill value
await setConfigValue(configKey, DEFAULT_CONFIG[configKey]);
}
}
// Initialise preferences
const preferences = naiveClone(await getConfigValue("preferences"));
for (const key in PREFERENCES_DEFAULT) {
Expand Down
4 changes: 4 additions & 0 deletions source/main/services/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { clearDelayedInterval, setDelayedInterval } from "delayable-setinterval"
import { getMainWindow } from "./windows";
import { logErr, logInfo, logWarn } from "../library/log";
import { fileExists } from "../library/file";
import { getConfigValue } from "./config";
import { UpdateProgressInfo } from "../types";

const UPDATE_AUTO_CHECK = ms("30m");
Expand Down Expand Up @@ -80,6 +81,9 @@ async function checkForUpdateInternal() {
__currentUpdate = null;
__readyUpdate = null;
__updateErrored = false;
const prefs = await getConfigValue("preferences");
logInfo(`Using pre-release channel for updates: ${prefs.prereleaseUpdates ? "yes" : "no"}`);
autoUpdater.allowPrerelease = prefs.prereleaseUpdates;
autoUpdater.autoDownload = false;
autoUpdater.setFeedURL({
provider: "github",
Expand Down
31 changes: 23 additions & 8 deletions source/renderer/components/PreferencesDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const LOCK_VAULTS_TIME_MAX = ms("1d") / 1000;
const PAGE_CONNECTIVITY = "connectivity";
const PAGE_GENERAL = "general";
const PAGE_SECURITY = "security";
const PAGE_UPDATES = "updates";
const THEME_AUTO_NAME = "Auto (OS)";

const DialogFreeWidth = styled(Dialog)`
Expand Down Expand Up @@ -252,6 +253,23 @@ export function PreferencesDialog() {
</FormGroup>
</>
);
const pageUpdates = () => (
<>
<FormGroup label={t("preferences.item.pre-release.title")}>
<Callout icon="lab-test" intent={Intent.WARNING}>
<div dangerouslySetInnerHTML={{ __html: t("preferences.item.pre-release.description") }} />
</Callout>
<Switch
checked={preferences.prereleaseUpdates}
label={t("preferences.item.pre-release.label")}
onChange={(evt: React.ChangeEvent<HTMLInputElement>) => setPreferences({
...naiveClone(preferences),
prereleaseUpdates: evt.target.checked
})}
/>
</FormGroup>
</>
);
// Render
return (
<DialogFreeWidth isOpen={showPreferences.get()} onClose={close}>
Expand Down Expand Up @@ -283,21 +301,18 @@ export function PreferencesDialog() {
text={t("preferences.section.connectivity")}
/>
<Button
disabled
icon="eye-off"
text={t("preferences.section.privacy")}
/>
<Button
disabled
icon="lab-test"
text={t("preferences.section.debug")}
active={currentPage === PAGE_UPDATES}
icon="updated"
onClick={() => setCurrentPage(PAGE_UPDATES)}
text={t("preferences.section.updates")}
/>
</PreferencesMenu>
</PreferencesSidebar>
<PageContent>
{currentPage === PAGE_GENERAL && pageGeneral()}
{currentPage === PAGE_SECURITY && pageSecurity()}
{currentPage === PAGE_CONNECTIVITY && pageConnectivity()}
{currentPage === PAGE_UPDATES && pageUpdates()}
</PageContent>
</PreferencesContent>
)}
Expand Down
9 changes: 8 additions & 1 deletion source/shared/i18n/trans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@ import i18next, { TOptions } from "i18next";
import translations from "./translations/index";
import { DEFAULT_LANGUAGE } from "../symbols";

let __lastLanguage: string | null = null;

export async function changeLanguage(lang: string) {
await i18next.changeLanguage(lang);
}

export async function initialise(lang: string) {
__lastLanguage = lang;
await i18next.init({
lng: lang,
fallbackLng: DEFAULT_LANGUAGE,
Expand All @@ -24,7 +27,11 @@ export async function initialise(lang: string) {
}

export function onLanguageChanged(callback: (lang: string) => void): () => void {
const cb = (lang: string) => callback(lang);
const cb = (lang: string) => {
if (__lastLanguage === lang) return;
__lastLanguage = lang;
callback(lang);
};
i18next.on("languageChanged", cb);
return () => {
i18next.off("languageChanged", cb);
Expand Down
1 change: 0 additions & 1 deletion source/shared/i18n/translations/ca_es.json
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,6 @@
},
"section": {
"connectivity": "Connectivitat",
"debug": "Depurar",
"general": "General",
"privacy": "Privacitat",
"security": "Seguretat"
Expand Down
Loading
Loading