Skip to content

Commit 83353e9

Browse files
committed
Merge branch 'develop' of https://github.com/vector-im/riot-web into rxl881/apps
2 parents db70272 + c614bc2 commit 83353e9

59 files changed

Lines changed: 2433 additions & 479 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎CHANGELOG.md‎

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,78 @@
1+
Changes in [0.11.4](https://github.com/vector-im/riot-web/releases/tag/v0.11.4) (2017-06-22)
2+
============================================================================================
3+
[Full Changelog](https://github.com/vector-im/riot-web/compare/v0.11.3...v0.11.4)
4+
5+
* Update matrix-js-sdk and react-sdk to fix a regression where the
6+
background indexedb worker was disabled, failures to open indexeddb
7+
causing the app to fail to start, a race when starting that could break
8+
switching to rooms, and the inability to invite users with mixed case
9+
usernames.
10+
11+
Changes in [0.11.3](https://github.com/vector-im/riot-web/releases/tag/v0.11.3) (2017-06-20)
12+
============================================================================================
13+
[Full Changelog](https://github.com/vector-im/riot-web/compare/v0.11.2...v0.11.3)
14+
15+
* Update to matrix-react-sdk 0.9.6 to fix infinite spinner bugs
16+
and some parts of the app that had missed translation.
17+
18+
Changes in [0.11.2](https://github.com/vector-im/riot-web/releases/tag/v0.11.2) (2017-06-19)
19+
============================================================================================
20+
[Full Changelog](https://github.com/vector-im/riot-web/compare/v0.11.2-rc.2...v0.11.2)
21+
22+
* Add more languages and translations
23+
* Add a 'register' button
24+
25+
Changes in [0.11.2-rc.2](https://github.com/vector-im/riot-web/releases/tag/v0.11.2-rc.2) (2017-06-16)
26+
======================================================================================================
27+
[Full Changelog](https://github.com/vector-im/riot-web/compare/v0.11.2-rc.1...v0.11.2-rc.2)
28+
29+
* Update react-sdk to pull in fixes for URL previews, CAS
30+
login, h2 in markdown and CAPTCHA forms.
31+
* Enable Korean translation
32+
* Update from Weblate.
33+
[\#4323](https://github.com/vector-im/riot-web/pull/4323)
34+
* Fix h2 in markdown being weird
35+
[\#4332](https://github.com/vector-im/riot-web/pull/4332)
36+
37+
Changes in [0.11.2-rc.1](https://github.com/vector-im/riot-web/releases/tag/v0.11.2-rc.1) (2017-06-15)
38+
======================================================================================================
39+
[Full Changelog](https://github.com/vector-im/riot-web/compare/v0.11.1...v0.11.2-rc.1)
40+
41+
* Attempts to deflakify the joining test
42+
[\#4313](https://github.com/vector-im/riot-web/pull/4313)
43+
* Add a test for the login flow when there is a teamserver
44+
[\#4315](https://github.com/vector-im/riot-web/pull/4315)
45+
* Remove onload simulator from loading test
46+
[\#4314](https://github.com/vector-im/riot-web/pull/4314)
47+
* Update from Weblate.
48+
[\#4305](https://github.com/vector-im/riot-web/pull/4305)
49+
* Test that we handle stored mx_last_room_id correctly
50+
[\#4292](https://github.com/vector-im/riot-web/pull/4292)
51+
* Ask for email address after setting password for the first time
52+
[\#4301](https://github.com/vector-im/riot-web/pull/4301)
53+
* i18n for setting email after password flow
54+
[\#4299](https://github.com/vector-im/riot-web/pull/4299)
55+
* Update from Weblate.
56+
[\#4290](https://github.com/vector-im/riot-web/pull/4290)
57+
* Don't show the tooltips when filtering rooms
58+
[\#4282](https://github.com/vector-im/riot-web/pull/4282)
59+
* Update from Weblate.
60+
[\#4272](https://github.com/vector-im/riot-web/pull/4272)
61+
* Add missing VOIP Dropdown width
62+
[\#4266](https://github.com/vector-im/riot-web/pull/4266)
63+
* Update import and directory path in the Translations dev guide
64+
[\#4261](https://github.com/vector-im/riot-web/pull/4261)
65+
* Use Thai string for Thai in Language-Chooser
66+
[\#4260](https://github.com/vector-im/riot-web/pull/4260)
67+
68+
Changes in [0.11.1](https://github.com/vector-im/riot-web/releases/tag/v0.11.1) (2017-06-14)
69+
============================================================================================
70+
[Full Changelog](https://github.com/vector-im/riot-web/compare/v0.11.0...v0.11.1)
71+
72+
* Update to react-sdk 0.9.4 to prompt to set an
73+
email address when setting a password and make
74+
DM guessing smarter.
75+
176
Changes in [0.11.0](https://github.com/vector-im/riot-web/releases/tag/v0.11.0) (2017-06-12)
277
============================================================================================
378
[Full Changelog](https://github.com/vector-im/riot-web/compare/v0.11.0-rc.2...v0.11.0)

‎electron_app/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "riot-web",
33
"productName": "Riot",
44
"main": "src/electron-main.js",
5-
"version": "0.11.0",
5+
"version": "0.11.4",
66
"description": "A feature-rich client for Matrix.org",
77
"author": "Vector Creations Ltd.",
88
"dependencies": {

‎electron_app/src/electron-main.js‎

Lines changed: 11 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const AutoLaunch = require('auto-launch');
2929
const tray = require('./tray');
3030
const vectorMenu = require('./vectormenu');
3131
const webContentsHandler = require('./webcontents-handler');
32+
const updater = require('./updater');
3233

3334
const windowStateKeeper = require('electron-window-state');
3435

@@ -46,69 +47,9 @@ try {
4647
// Continue with the defaults (ie. an empty config)
4748
}
4849

49-
const UPDATE_POLL_INTERVAL_MS = 60 * 60 * 1000;
50-
const INITIAL_UPDATE_DELAY_MS = 30 * 1000;
51-
5250
let mainWindow = null;
53-
let appQuitting = false;
54-
55-
function installUpdate() {
56-
// for some reason, quitAndInstall does not fire the
57-
// before-quit event, so we need to set the flag here.
58-
appQuitting = true;
59-
electron.autoUpdater.quitAndInstall();
60-
}
51+
global.appQuitting = false;
6152

62-
function pollForUpdates() {
63-
try {
64-
electron.autoUpdater.checkForUpdates();
65-
} catch (e) {
66-
console.log('Couldn\'t check for update', e);
67-
}
68-
}
69-
70-
function startAutoUpdate(updateBaseUrl) {
71-
if (updateBaseUrl.slice(-1) !== '/') {
72-
updateBaseUrl = updateBaseUrl + '/';
73-
}
74-
try {
75-
// For reasons best known to Squirrel, the way it checks for updates
76-
// is completely different between macOS and windows. On macOS, it
77-
// hits a URL that either gives it a 200 with some json or
78-
// 204 No Content. On windows it takes a base path and looks for
79-
// files under that path.
80-
if (process.platform === 'darwin') {
81-
// include the current version in the URL we hit. Electron doesn't add
82-
// it anywhere (apart from the User-Agent) so it's up to us. We could
83-
// (and previously did) just use the User-Agent, but this doesn't
84-
// rely on NSURLConnection setting the User-Agent to what we expect,
85-
// and also acts as a convenient cache-buster to ensure that when the
86-
// app updates it always gets a fresh value to avoid update-looping.
87-
electron.autoUpdater.setFeedURL(
88-
`${updateBaseUrl}macos/?localVersion=${encodeURIComponent(electron.app.getVersion())}`);
89-
90-
} else if (process.platform === 'win32') {
91-
electron.autoUpdater.setFeedURL(`${updateBaseUrl}win32/${process.arch}/`);
92-
} else {
93-
// Squirrel / electron only supports auto-update on these two platforms.
94-
// I'm not even going to try to guess which feed style they'd use if they
95-
// implemented it on Linux, or if it would be different again.
96-
console.log('Auto update not supported on this platform');
97-
}
98-
// We check for updates ourselves rather than using 'updater' because we need to
99-
// do it in the main process (and we don't really need to check every 10 minutes:
100-
// every hour should be just fine for a desktop app)
101-
// However, we still let the main window listen for the update events.
102-
// We also wait a short time before checking for updates the first time because
103-
// of squirrel on windows and it taking a small amount of time to release a
104-
// lock file.
105-
setTimeout(pollForUpdates, INITIAL_UPDATE_DELAY_MS);
106-
setInterval(pollForUpdates, UPDATE_POLL_INTERVAL_MS);
107-
} catch (err) {
108-
// will fail if running in debug mode
109-
console.log('Couldn\'t enable update checking', err);
110-
}
111-
}
11253

11354
// handle uncaught errors otherwise it displays
11455
// stack traces in popup dialogs, which is terrible (which
@@ -120,8 +61,6 @@ process.on('uncaughtException', function(error) {
12061
console.log('Unhandled exception', error);
12162
});
12263

123-
electron.ipcMain.on('install_update', installUpdate);
124-
12564
let focusHandlerAttached = false;
12665
electron.ipcMain.on('setBadgeCount', function(ev, count) {
12766
electron.app.setBadgeCount(count);
@@ -233,7 +172,7 @@ electron.app.on('ready', () => {
233172

234173
if (vectorConfig.update_base_url) {
235174
console.log(`Starting auto update with base URL: ${vectorConfig.update_base_url}`);
236-
startAutoUpdate(vectorConfig.update_base_url);
175+
updater.start(vectorConfig.update_base_url);
237176
} else {
238177
console.log('No update_base_url is defined: auto update is disabled');
239178
}
@@ -246,7 +185,7 @@ electron.app.on('ready', () => {
246185
defaultHeight: 768,
247186
});
248187

249-
mainWindow = new electron.BrowserWindow({
188+
mainWindow = global.mainWindow = new electron.BrowserWindow({
250189
icon: iconPath,
251190
show: false,
252191
autoHideMenuBar: true,
@@ -264,7 +203,7 @@ electron.app.on('ready', () => {
264203
mainWindow.hide();
265204

266205
// Create trayIcon icon
267-
tray.create(mainWindow, {
206+
tray.create({
268207
icon_path: iconPath,
269208
brand: vectorConfig.brand || 'Riot',
270209
});
@@ -276,10 +215,10 @@ electron.app.on('ready', () => {
276215
}
277216

278217
mainWindow.on('closed', () => {
279-
mainWindow = null;
218+
mainWindow = global.mainWindow = null;
280219
});
281220
mainWindow.on('close', (e) => {
282-
if (!appQuitting && (tray.hasTray() || process.platform === 'darwin')) {
221+
if (!global.appQuitting && (tray.hasTray() || process.platform === 'darwin')) {
283222
// On Mac, closing the window just hides it
284223
// (this is generally how single-window Mac apps
285224
// behave, eg. Mail.app)
@@ -302,7 +241,10 @@ electron.app.on('activate', () => {
302241
});
303242

304243
electron.app.on('before-quit', () => {
305-
appQuitting = true;
244+
global.appQuitting = true;
245+
if (mainWindow) {
246+
mainWindow.webContents.send('before-quit');
247+
}
306248
});
307249

308250
// Set the App User Model ID to match what the squirrel

‎electron_app/src/tray.js‎

Lines changed: 32 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@ exports.hasTray = function hasTray() {
2626
return (trayIcon !== null);
2727
};
2828

29-
exports.create = function(win, config) {
29+
exports.create = function(config) {
3030
// no trays on darwin
3131
if (process.platform === 'darwin' || trayIcon) return;
3232

3333
const toggleWin = function() {
34-
if (win.isVisible() && !win.isMinimized()) {
35-
win.hide();
34+
if (global.mainWindow.isVisible() && !global.mainWindow.isMinimized()) {
35+
global.mainWindow.hide();
3636
} else {
37-
if (win.isMinimized()) win.restore();
38-
if (!win.isVisible()) win.show();
39-
win.focus();
37+
if (global.mainWindow.isMinimized()) global.mainWindow.restore();
38+
if (!global.mainWindow.isVisible()) global.mainWindow.show();
39+
global.mainWindow.focus();
4040
}
4141
};
4242

@@ -54,41 +54,46 @@ exports.create = function(win, config) {
5454
},
5555
]);
5656

57-
trayIcon = new Tray(config.icon_path);
57+
const defaultIcon = nativeImage.createFromPath(config.icon_path);
58+
59+
trayIcon = new Tray(defaultIcon);
5860
trayIcon.setToolTip(config.brand);
5961
trayIcon.setContextMenu(contextMenu);
6062
trayIcon.on('click', toggleWin);
6163

6264
let lastFavicon = null;
63-
win.webContents.on('page-favicon-updated', async function(ev, favicons) {
64-
let newFavicon = config.icon_path;
65-
if (favicons && favicons.length > 0 && favicons[0].startsWith('data:')) {
66-
newFavicon = favicons[0];
65+
global.mainWindow.webContents.on('page-favicon-updated', async function(ev, favicons) {
66+
if (!favicons || favicons.length <= 0 || !favicons[0].startsWith('data:')) {
67+
if (lastFavicon !== null) {
68+
win.setIcon(defaultIcon);
69+
trayIcon.setImage(defaultIcon);
70+
lastFavicon = null;
71+
}
72+
return;
6773
}
6874

6975
// No need to change, shortcut
70-
if (newFavicon === lastFavicon) return;
71-
lastFavicon = newFavicon;
72-
73-
// if its not default we have to construct into nativeImage
74-
if (newFavicon !== config.icon_path) {
75-
newFavicon = nativeImage.createFromDataURL(favicons[0]);
76-
77-
if (process.platform === 'win32') {
78-
try {
79-
const icoPath = path.join(app.getPath('temp'), 'win32_riot_icon.ico')
80-
const icoBuf = await pngToIco(newFavicon.toPNG());
81-
fs.writeFileSync(icoPath, icoBuf);
82-
newFavicon = icoPath;
83-
} catch (e) {console.error(e);}
76+
if (favicons[0] === lastFavicon) return;
77+
lastFavicon = favicons[0];
78+
79+
let newFavicon = nativeImage.createFromDataURL(favicons[0]);
80+
81+
// Windows likes ico's too much.
82+
if (process.platform === 'win32') {
83+
try {
84+
const icoPath = path.join(app.getPath('temp'), 'win32_riot_icon.ico');
85+
fs.writeFileSync(icoPath, await pngToIco(newFavicon.toPNG()));
86+
newFavicon = nativeImage.createFromPath(icoPath);
87+
} catch (e) {
88+
console.error("Failed to make win32 ico", e);
8489
}
8590
}
8691

8792
trayIcon.setImage(newFavicon);
88-
win.setIcon(newFavicon);
93+
global.mainWindow.setIcon(newFavicon);
8994
});
9095

91-
win.webContents.on('page-title-updated', function(ev, title) {
96+
global.mainWindow.webContents.on('page-title-updated', function(ev, title) {
9297
trayIcon.setToolTip(title);
9398
});
9499
};

0 commit comments

Comments
 (0)