Skip to content

Commit

Permalink
Revert to window
Browse files Browse the repository at this point in the history
  • Loading branch information
joel-jeremy committed Jan 17, 2025
1 parent be406ae commit 156e0ba
Show file tree
Hide file tree
Showing 18 changed files with 26 additions and 26 deletions.
8 changes: 4 additions & 4 deletions packages/desktop-client/playwright.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ expect.extend({
: locator.locator('[data-theme]');

// Check lightmode
await locator.evaluate(() => global.Actual.setTheme('auto'));
await locator.evaluate(() => window.Actual.setTheme('auto'));
await expect(dataThemeLocator).toHaveAttribute('data-theme', 'auto');
const lightmode = await expect(locator).toHaveScreenshot(config);

Expand All @@ -35,7 +35,7 @@ expect.extend({
}

// Switch to darkmode and check
await locator.evaluate(() => global.Actual.setTheme('dark'));
await locator.evaluate(() => window.Actual.setTheme('dark'));
await expect(dataThemeLocator).toHaveAttribute('data-theme', 'dark');
const darkmode = await expect(locator).toHaveScreenshot(config);

Expand All @@ -45,7 +45,7 @@ expect.extend({
}

// Switch to midnight theme and check
await locator.evaluate(() => global.Actual.setTheme('midnight'));
await locator.evaluate(() => window.Actual.setTheme('midnight'));
await expect(dataThemeLocator).toHaveAttribute('data-theme', 'midnight');
const midnightMode = await expect(locator).toHaveScreenshot(config);

Expand All @@ -55,7 +55,7 @@ expect.extend({
}

// Switch back to lightmode
await locator.evaluate(() => global.Actual.setTheme('auto'));
await locator.evaluate(() => window.Actual.setTheme('auto'));
return {
message: () => 'pass',
pass: true,
Expand Down
2 changes: 1 addition & 1 deletion packages/desktop-client/src/components/FatalError.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ export function FatalError({ error }: FatalErrorProps) {
)}

<Paragraph>
<Button onPress={() => global.Actual.relaunch()}>
<Button onPress={() => window.Actual.relaunch()}>
<Trans>Restart app</Trans>
</Button>
</Paragraph>
Expand Down
2 changes: 1 addition & 1 deletion packages/desktop-client/src/components/HelpMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const getPageDocs = (page: string) => {
};

function openDocsForCurrentPage() {
global.Actual.openURLInBrowser(getPageDocs(window.location.pathname));
window.Actual.openURLInBrowser(getPageDocs(window.location.pathname));
}

type HelpMenuItem = 'docs' | 'keyboard-shortcuts' | 'goal-templates';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export function UpdateNotification() {
textDecoration: 'underline',
}}
onClick={() =>
global.Actual.openURLInBrowser(
window.Actual.openURLInBrowser(
'https://actualbudget.org/docs/releases',
)
}
Expand Down
4 changes: 2 additions & 2 deletions packages/desktop-client/src/components/accounts/Account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ class AccountInternal extends PureComponent<
const account = this.props.accounts.find(acct => acct.id === accountId);

if (account) {
const res = await global.Actual.openFileDialog({
const res = await window.Actual.openFileDialog({
filters: [
{
name: t('Financial Files'),
Expand Down Expand Up @@ -668,7 +668,7 @@ class AccountInternal extends PureComponent<
accountName && accountName.replace(/[()]/g, '').replace(/\s+/g, '-');
const filename = `${normalizedName || 'transactions'}.csv`;

global.Actual.saveFile(
window.Actual.saveFile(
exportedTransactions,
filename,
t('Export Transactions'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export function ConfigServer() {
const [error, setError] = useState<string | null>(null);

const restartElectronServer = useCallback(() => {
global.Actual.restartElectronServer();
globalThis.window.Actual.restartElectronServer();
setError(null);
}, []);

Expand Down Expand Up @@ -88,7 +88,7 @@ export function ConfigServer() {
}

async function onSelectSelfSignedCertificate() {
const selfSignedCertificateLocation = await global.Actual.openFileDialog({
const selfSignedCertificateLocation = await window.Actual.openFileDialog({
properties: ['openFile'],
filters: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function Version() {
},
}}
>
{`App: v${global.Actual.ACTUAL_VERSION} | Server: ${version}`}
{`App: v${window.Actual.ACTUAL_VERSION} | Server: ${version}`}
</Text>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ export function ImportTransactionsModal({ options }) {
}

async function onNewFile() {
const res = await global.Actual.openFileDialog({
const res = await window.Actual.openFileDialog({
filters: [
{
name: 'Financial Files',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export function ConfirmChangeDocumentDirModal({
const dispatch = useDispatch();

const restartElectronServer = useCallback(() => {
global.Actual.restartElectronServer();
window.Actual.restartElectronServer();
}, []);

const [_documentDir, setDocumentDirPref] = useGlobalPref(
Expand All @@ -64,7 +64,7 @@ export function ConfirmChangeDocumentDirModal({
setLoading(true);
try {
if (moveFiles) {
await global.Actual.moveBudgetDirectory(
await window.Actual.moveBudgetDirectory(
currentBudgetDirectory,
newDirectory,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function FileLocationSettings() {
const dispatch = useDispatch();

async function onChooseDocumentDir() {
const chosenDirectory = await global.Actual.openFileDialog({
const chosenDirectory = await window.Actual.openFileDialog({
properties: ['openDirectory'],
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export function ImportActualModal() {
const [importing, setImporting] = useState(false);

async function onImport() {
const res = await global.Actual.openFileDialog({
const res = await window.Actual.openFileDialog({
properties: ['openFile'],
filters: [{ name: 'actual', extensions: ['zip', 'blob'] }],
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export function ImportYNAB4Modal() {
const [importing, setImporting] = useState(false);

async function onImport() {
const res = await global.Actual.openFileDialog({
const res = await window.Actual.openFileDialog({
properties: ['openFile'],
filters: [{ name: 'ynab', extensions: ['zip'] }],
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function ImportYNAB5Modal() {
const [importing, setImporting] = useState(false);

async function onImport() {
const res = await global.Actual.openFileDialog({
const res = await window.Actual.openFileDialog({
properties: ['openFile'],
filters: [{ name: 'ynab', extensions: ['json'] }],
});
Expand Down
4 changes: 2 additions & 2 deletions packages/desktop-client/src/components/reports/Overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -211,14 +211,14 @@ export function Overview() {
}),
} satisfies ExportImportDashboard;

global.Actual.saveFile(
window.Actual.saveFile(
JSON.stringify(data, null, 2),
'dashboard.json',
'Export Dashboard',
);
};
const onImport = async () => {
const openFileDialog = global.Actual.openFileDialog;
const openFileDialog = window.Actual.openFileDialog;

if (!openFileDialog) {
dispatch(
Expand Down
2 changes: 1 addition & 1 deletion packages/desktop-client/src/components/settings/Export.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function ExportBudget() {
return;
}

global.Actual.saveFile(
window.Actual.saveFile(
response.data,
`${format(new Date(), 'yyyy-MM-dd')}-${budgetName}.zip`,
t('Export budget'),
Expand Down
2 changes: 1 addition & 1 deletion packages/desktop-client/src/global-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,6 @@ export function handleGlobalEvents(store: AppStore) {
});

listen('api-fetch-redirected', () => {
global.Actual.reload();
window.Actual.reload();
});
}
2 changes: 1 addition & 1 deletion packages/desktop-client/src/gocardless.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function _authorize(

if ('error' in resp) return resp;
const { link, requisitionId } = resp;
global.Actual.openURLInBrowser(link);
window.Actual.openURLInBrowser(link);

return send('gocardless-poll-web-token', {
upgradingAccountId,
Expand Down
4 changes: 2 additions & 2 deletions packages/desktop-client/src/util/versions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export async function getLatestVersion(): Promise<string | 'unknown'> {
const json = await response.json();
const tags = json
.map(t => t.name)
.concat([`v${global.Actual.ACTUAL_VERSION}`]);
.concat([`v${window.Actual.ACTUAL_VERSION}`]);
tags.sort(cmpSemanticVersion);

return tags[tags.length - 1];
Expand All @@ -41,7 +41,7 @@ export async function getLatestVersion(): Promise<string | 'unknown'> {
}

export async function getIsOutdated(latestVersion: string): Promise<boolean> {
const clientVersion = global.Actual.ACTUAL_VERSION;
const clientVersion = window.Actual.ACTUAL_VERSION;
if (latestVersion === 'unknown') {
return Promise.resolve(false);
}
Expand Down

0 comments on commit 156e0ba

Please sign in to comment.