Skip to content

Commit

Permalink
Bug Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Lplenka committed Mar 10, 2017
1 parent c7ce8fb commit d7d3017
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 6 deletions.
7 changes: 6 additions & 1 deletion app/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,18 @@ function createMainWindow() {
plugins: true,
allowDisplayingInsecureContent: true,
nodeIntegration: false
}
},
show:false
});

win.once('ready-to-show', () => {
win.show();
})
win.loadURL(targetURL(),
{
userAgent: isUserAgent + ' ' + win.webContents.getUserAgent()
});

win.on('closed', onClosed);
win.setTitle('Zulip');

Expand Down
29 changes: 25 additions & 4 deletions app/main/windowmanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
const path = require('path');
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 aboutWindow;

Expand All @@ -14,10 +19,14 @@ function onClosed() {
// Change Zulip server Window
function createdomainWindow() {
const domainwin = new electron.BrowserWindow({
title: 'Switch Server',
frame: false,
height: 300,
resizable: false,
width: 400
width: 400,
show: false,
icon: iconPath()

});
const domainURL = 'file://' + path.join(__dirname, '../renderer', 'pref.html');
domainwin.loadURL(domainURL);
Expand All @@ -29,7 +38,16 @@ function createdomainWindow() {
// Call this window onClick addDomain in tray
function addDomain() {
domainWindow = createdomainWindow();
domainWindow.show();
domainWindow.once('ready-to-show', () => {
domainWindow.show();
});


setTimeout(() => {
if (domainWindow!=null) {if (!domainWindow.isDestroyed()) domainWindow.destroy()}
}, 15000);


}

// About window
Expand Down Expand Up @@ -61,9 +79,12 @@ function createAboutWindow() {
// Call this onClick About in tray
function about() {
aboutWindow = createAboutWindow();
aboutWindow.show();
aboutWindow.once('ready-to-show', () => {
aboutWindow.show();
})
}

exports = module.exports = {
addDomain, about
addDomain,
about
};
1 change: 0 additions & 1 deletion app/renderer/js/pref.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ window.prefDomain = function () {
db.push('/domain', domain);
ipcRenderer.send('new-domain', domain);
} else {
document.getElementById('pic').style.display = 'none';
document.getElementById('main').innerHTML = 'Switch';
document.getElementById('urladded').innerHTML = 'Not a valid Zulip Server.';
}
Expand Down

0 comments on commit d7d3017

Please sign in to comment.