mirror of
https://github.com/zulip/zulip-desktop.git
synced 2025-11-14 10:57:44 +00:00
Merge pull request #128 from Lplenka/master
show window when the web page has been rendered and window can be displayed without a visual flash.
This commit is contained in:
@@ -147,13 +147,18 @@ function createMainWindow() {
|
|||||||
plugins: true,
|
plugins: true,
|
||||||
allowDisplayingInsecureContent: true,
|
allowDisplayingInsecureContent: true,
|
||||||
nodeIntegration: false
|
nodeIntegration: false
|
||||||
}
|
},
|
||||||
|
show: false
|
||||||
});
|
});
|
||||||
|
|
||||||
|
win.once('ready-to-show', () => {
|
||||||
|
win.show();
|
||||||
|
});
|
||||||
win.loadURL(targetURL(),
|
win.loadURL(targetURL(),
|
||||||
{
|
{
|
||||||
userAgent: isUserAgent + ' ' + win.webContents.getUserAgent()
|
userAgent: isUserAgent + ' ' + win.webContents.getUserAgent()
|
||||||
});
|
});
|
||||||
|
|
||||||
win.on('closed', onClosed);
|
win.on('closed', onClosed);
|
||||||
win.setTitle('Zulip');
|
win.setTitle('Zulip');
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,11 @@
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
const electron = require('electron');
|
const electron = require('electron');
|
||||||
|
|
||||||
|
const APP_ICON = path.join(__dirname, '../resources', 'Icon');
|
||||||
|
|
||||||
|
const iconPath = () => {
|
||||||
|
return APP_ICON + (process.platform === 'win32' ? '.ico' : '.png');
|
||||||
|
};
|
||||||
let domainWindow;
|
let domainWindow;
|
||||||
let aboutWindow;
|
let aboutWindow;
|
||||||
|
|
||||||
@@ -14,10 +19,14 @@ function onClosed() {
|
|||||||
// Change Zulip server Window
|
// Change Zulip server Window
|
||||||
function createdomainWindow() {
|
function createdomainWindow() {
|
||||||
const domainwin = new electron.BrowserWindow({
|
const domainwin = new electron.BrowserWindow({
|
||||||
|
title: 'Switch Server',
|
||||||
frame: false,
|
frame: false,
|
||||||
height: 300,
|
height: 300,
|
||||||
resizable: false,
|
resizable: false,
|
||||||
width: 400
|
width: 400,
|
||||||
|
show: false,
|
||||||
|
icon: iconPath()
|
||||||
|
|
||||||
});
|
});
|
||||||
const domainURL = 'file://' + path.join(__dirname, '../renderer', 'pref.html');
|
const domainURL = 'file://' + path.join(__dirname, '../renderer', 'pref.html');
|
||||||
domainwin.loadURL(domainURL);
|
domainwin.loadURL(domainURL);
|
||||||
@@ -25,13 +34,20 @@ function createdomainWindow() {
|
|||||||
|
|
||||||
return domainwin;
|
return domainwin;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call this window onClick addDomain in tray
|
// Call this window onClick addDomain in tray
|
||||||
function addDomain() {
|
function addDomain() {
|
||||||
domainWindow = createdomainWindow();
|
domainWindow = createdomainWindow();
|
||||||
|
domainWindow.once('ready-to-show', () => {
|
||||||
domainWindow.show();
|
domainWindow.show();
|
||||||
|
});
|
||||||
|
setTimeout(() => {
|
||||||
|
if (domainWindow !== null) {
|
||||||
|
if (!domainWindow.isDestroyed()) {
|
||||||
|
domainWindow.destroy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 15000);
|
||||||
}
|
}
|
||||||
|
|
||||||
// About window
|
// About window
|
||||||
function createAboutWindow() {
|
function createAboutWindow() {
|
||||||
const aboutwin = new electron.BrowserWindow({
|
const aboutwin = new electron.BrowserWindow({
|
||||||
@@ -61,9 +77,12 @@ function createAboutWindow() {
|
|||||||
// Call this onClick About in tray
|
// Call this onClick About in tray
|
||||||
function about() {
|
function about() {
|
||||||
aboutWindow = createAboutWindow();
|
aboutWindow = createAboutWindow();
|
||||||
|
aboutWindow.once('ready-to-show', () => {
|
||||||
aboutWindow.show();
|
aboutWindow.show();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
exports = module.exports = {
|
exports = module.exports = {
|
||||||
addDomain, about
|
addDomain,
|
||||||
|
about
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -60,7 +60,6 @@ window.prefDomain = function () {
|
|||||||
db.push('/domain', domain);
|
db.push('/domain', domain);
|
||||||
ipcRenderer.send('new-domain', domain);
|
ipcRenderer.send('new-domain', domain);
|
||||||
} else {
|
} else {
|
||||||
document.getElementById('pic').style.display = 'none';
|
|
||||||
document.getElementById('main').innerHTML = 'Switch';
|
document.getElementById('main').innerHTML = 'Switch';
|
||||||
document.getElementById('urladded').innerHTML = 'Not a valid Zulip Server.';
|
document.getElementById('urladded').innerHTML = 'Not a valid Zulip Server.';
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user