Skip to content

Commit

Permalink
fix: format and linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Frewacom committed Jun 6, 2021
1 parent 159d6d2 commit c947882
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 17 deletions.
4 changes: 2 additions & 2 deletions src/background/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -572,13 +572,13 @@ export default class Extension {
this.state.setNativeError(nativeError);

if (!this.state.getNativeErrorMuted()) {
await this.nativeErrorPage.open();
await this.nativeErrorPage.open();
}

Messenger.UI.sendDebuggingInfo({
version: this.state.getVersion(),
connected: false,
nativeError: nativeError,
nativeError,
});
}

Expand Down
16 changes: 8 additions & 8 deletions src/background/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,8 @@ export default class State {
}

public async load(themeRefreshCallback: () => void) {
let shouldRefresh = false
const browserInfo = await browser.runtime.getBrowserInfo()
let shouldRefresh = false;
const browserInfo = await browser.runtime.getBrowserInfo();
this.currentState = await browser.storage.local.get(this.initialState);

// Temporary state migration until a real migration system is implemented
Expand All @@ -415,24 +415,24 @@ export default class State {

// Fix for v89 tab border
if (browserInfo?.version && browserInfo.version.split('.')[0] === '89') {
const { dark, light } = this.currentState.theme.templates
const { dark, light } = this.currentState.theme.templates;

// We make sure to only change this property if it has not been modified by the user
if (dark.browser.tab_line === PaletteColors.AccentPrimary) {
this.currentState.theme.templates.dark.browser.tab_line = PaletteColors.BackgroundLight
shouldRefresh = true
this.currentState.theme.templates.dark.browser.tab_line = PaletteColors.BackgroundLight;
shouldRefresh = true;
}

if (light.browser.tab_line === PaletteColors.AccentPrimary) {
this.currentState.theme.templates.light.browser.tab_line = PaletteColors.BackgroundLight
shouldRefresh = true
this.currentState.theme.templates.light.browser.tab_line = PaletteColors.BackgroundLight;
shouldRefresh = true;
}
}

await browser.storage.local.set(this.currentState);

if (shouldRefresh) {
themeRefreshCallback()
themeRefreshCallback();
}
}

Expand Down
5 changes: 4 additions & 1 deletion src/communication/native-messenger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,15 @@ export default class NativeApp {
switch (error.message) {
case 'Error: No such native application pywalfox':
nativeError.type = NativeAppErrors.ManifestNotInstalled;
case "Error: An unexpected error occurred":
break;
case 'Error: An unexpected error occurred':
// BUG: For some reason, the "File at path <path> does not exist, or is not executable"
// error does not get set, so we will just assume that is the cause for this for now.
nativeError.type = NativeAppErrors.UnexpectedError;
break;
default:
nativeError.type = NativeAppErrors.Unknown;
break;
}

nativeError.message = error.message;
Expand Down
4 changes: 2 additions & 2 deletions src/ui/native-error.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import {
NativeAppErrors,
IExtensionMessage,
IDebuggingInfoData
IDebuggingInfoData,
} from '@definitions';

import {
requestDebuggingInfo,
requestNativeErrorPageMute,
} from '@communication/content-scripts/ui';

import initializeExtensionPage from '@ui/page';
import { EXTENSION_MESSAGES } from '@config/general';
import { initializeExtensionPage } from '@ui/page';

const retryButton = <HTMLButtonElement>document.getElementById('retry-button');
const disableButton = <HTMLButtonElement>document.getElementById('disable-button');
Expand Down
4 changes: 2 additions & 2 deletions src/ui/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ function setThemeMode(mode: ThemeModes) {
currentThemeMode = mode;
}

export function initializeExtensionPage(
export default function initializeExtensionPage(
versionLabel: HTMLElement,
callback: IExtensionMessageCallback
callback: IExtensionMessageCallback,
) {
if (callback) {
messageCallback = callback;
Expand Down
4 changes: 2 additions & 2 deletions src/ui/update.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { initializeExtensionPage } from '@ui/page';
import initializeExtensionPage from '@ui/page';
import { requestUpdatePageMute } from '@communication/content-scripts/ui';

const disableButton = <HTMLButtonElement>document.getElementById('disable-button');
Expand All @@ -7,5 +7,5 @@ disableButton.addEventListener('click', requestUpdatePageMute);

initializeExtensionPage(
document.getElementById('version'),
null
null,
);

0 comments on commit c947882

Please sign in to comment.