Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
displayQuitAndInstallDialog() {
dialog.showMessageBox(
{
type: 'question',
buttons: ['Update & Restart', 'Cancel'],
title: 'Update Available',
cancelId: 99,
message:
'New version ready to install. Would you like to update CoinWatch now?',
},
response => {
console.log(`Exit: ${response}`); // eslint-disable-line no-console
if (response === 0) {
this.setQuitState(true);
autoUpdater.quitAndInstall();
}
},
_handleShowAsyncMessageDialog = (evt, options) => {
if (!this[privConnected].has(evt.sender.id)) { return }
const bw = BrowserWindow.fromWebContents(ElectronWebContents.rootWebContents(evt.sender))
dialog.showMessageBox(bw, options, () => {
/* no-op */
})
}
_askToApplyUpdate: function() {
var self = this;
dialog.showMessageBox({
type: 'question',
message: 'An update is available! Would you like to quit to install it? The application will then restart.',
buttons: ['Ask me later', 'Quit and install']
}, function(result) {
if (result > 0) {
// Emit the 'before-quit' event since the app won't quit otherwise
// (https://app.asana.com/0/19141607276671/74169390751974) and the app won't:
// https://github.com/atom/electron/issues/3837
var event = {
_defaultPrevented: false,
isDefaultPrevented: function() {
return this._defaultPrevented;
},
preventDefault: function() {
this._defaultPrevented = true;
}
ipcMain.on('HTMLData', (event, arg) => {
if (timeReload) {
let stringCommand = `document.getElementById("book-time-left").innerHTML="${arg}"`;
browserWindow.webContents.executeJavaScript(stringCommand);
} else {
let data = site.processHTML(arg);
if (data != undefined) {
browserWindow.webContents.send('asyncMessage', site.processHTML(arg));
} else {
dialog.showMessageBox(browserWindow, { type: "info", message: "Something wrong with Packtpub site?" }, (index) => {
if (index === 0) {
if (process.platform !== 'darwin') {
app.quit();
}
}
});
}
}
})
timer = setTimeout(()=>{
dialog.showMessageBox(mainWindow, {
type: "warning",
buttons: ["Cancel", "Close without Saving"],
title: "Warning",
message: "Node-RED contains unsaved changes"
}, (response)=>{
if (response == 1) {
mainWindow.send("iframe:node-red:visible", false);
timer = setTimeout(()=>{mainWindow.close()}, 100);
}
});
}, 1000);
})
function uploadFiles (files) {
if (uploading) return
const weiboCookies = storage.get('weibo_cookies')
if (!weiboCookies) {
app.focus()
dialog.showMessageBox({
type: 'info',
message: '您还没有登陆围脖账号',
detail: [
'围脖图床是通过围脖来上传图片的,',
'你需要通过使用您的围脖账号登陆来完成这这步操作'
].join('\n'),
buttons: ['登陆微博', '取消'],
}, res => {
if (res !== 0) return
weiboLogin((err, cookies) => {
storage.set('weibo_cookies', cookies)
updateMenu()
doUpload(cookies, files)
})
})
} else {
const confirmExit = function () {
let choice = dialog.showMessageBox(null, {
type: 'warning',
buttons: ['Yes', 'No'],
title: 'Quit RcloneTray',
message: 'Are you sure you want to quit?',
detail: 'There is active processes that will be terminated.'
})
return choice === 0
}
export async function showReadOnlyDialog(
mainWindow: BrowserWindow,
messages: MessagesType
): Promise {
const options = {
type: 'warning',
buttons: [messages.ok.message],
title: messages.cannotUpdate.message,
message: messages.readOnlyVolume.message,
};
await dialog.showMessageBox(mainWindow, options);
}
expect(() => {
const w = new BrowserWindow()
dialog.showMessageBox(w, { message: 'i am message' })
}).to.not.throw()
})
function showAbout() {
dialog.showMessageBox({
title: `About ${CONFIG.APP_NAME}`,
message: `${CONFIG.APP_NAME} ${CONFIG.APP_VERSION}`,
detail: `The community platform for the future.`,
buttons: [],
icon: CONFIG.ICON,
});
}