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

Fix schema validation crash #1037

Merged
merged 2 commits into from
Aug 14, 2019
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
26 changes: 16 additions & 10 deletions source/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,23 @@ const schema: {[key: string]: JSONSchema} = {
type: 'object',
properties: {
width: {
type: 'number',
default: 800
type: 'number'
},
height: {
type: 'number',
default: 600
type: 'number'
},
x: {
type: 'number'
},
y: {
type: 'number'
}
},
default: {
width: 800,
height: 600,
x: undefined,
y: undefined
}
},
menuBarMode: {
Expand Down Expand Up @@ -88,17 +92,19 @@ const schema: {[key: string]: JSONSchema} = {
type: 'object',
properties: {
chatSeen: {
type: 'boolean',
default: false
type: 'boolean'
},
typingIndicator: {
type: 'boolean',
default: false
type: 'boolean'
},
deliveryReceipt: {
type: 'boolean',
default: false
type: 'boolean'
}
},
default: {
chatSeen: false,
typingIndicator: false,
deliveryReceipt: false
}
},
emojiStyle: {
Expand Down
18 changes: 7 additions & 11 deletions source/ensure-online.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,13 @@ import isOnline from 'is-online';
import pWaitFor from 'p-wait-for';

function showWaitDialog(): void {
const buttonIndex = dialog.showMessageBoxSync(
// @ts-ignore
undefined,
{
message: 'You appear to be offline. Caprine requires a working internet connection.',
detail: 'Do you want to wait?',
buttons: ['Wait', 'Quit'],
defaultId: 0,
cancelId: 1
}
);
const buttonIndex = dialog.showMessageBoxSync({
message: 'You appear to be offline. Caprine requires a working internet connection.',
detail: 'Do you want to wait?',
buttons: ['Wait', 'Quit'],
defaultId: 0,
cancelId: 1
});

if (buttonIndex === 1) {
app.quit();
Expand Down
18 changes: 7 additions & 11 deletions source/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,13 @@ export function sendBackgroundAction(action: string, ...args: unknown[]): void {
}

export function showRestartDialog(message: string): void {
const buttonIndex = dialog.showMessageBoxSync(
// @ts-ignore
undefined,
{
message,
detail: 'Do you want to restart the app now?',
buttons: ['Restart', 'Ignore'],
defaultId: 0,
cancelId: 1
}
);
const buttonIndex = dialog.showMessageBoxSync({
message,
detail: 'Do you want to restart the app now?',
buttons: ['Restart', 'Ignore'],
defaultId: 0,
cancelId: 1
});

if (buttonIndex === 0) {
app.relaunch();
Expand Down