Merge branches 'develop' and 't3chguy/remove_bluebird' of https://github.com/vector-im/riot-web into t3chguy/remove_bluebird
This commit is contained in:
commit
eac6c46d28
25 changed files with 527 additions and 110 deletions
|
@ -43,6 +43,7 @@
|
|||
<script src="<%= htmlWebpackPlugin.files.chunks['bundle'].entry %>"></script>
|
||||
<img src="<%= require('matrix-react-sdk/res/img/warning.svg') %>" width="24" height="23" style="visibility: hidden; position: absolute; top: 0px; left: 0px;"/>
|
||||
<img src="<%= require('matrix-react-sdk/res/img/e2e/warning.svg') %>" width="24" height="23" style="visibility: hidden; position: absolute; top: 0px; left: 0px;"/>
|
||||
<img src="<%= require('matrix-react-sdk/res/img/feather-customised/warning-triangle.svg') %>" width="24" height="23" style="visibility: hidden; position: absolute; top: 0px; left: 0px;"/>
|
||||
<audio id="messageAudio">
|
||||
<source src="media/message.ogg" type="audio/ogg" />
|
||||
<source src="media/message.mp3" type="audio/mpeg" />
|
||||
|
|
|
@ -55,8 +55,8 @@ import WebPlatform from './platform/WebPlatform';
|
|||
|
||||
import MatrixClientPeg from 'matrix-react-sdk/lib/MatrixClientPeg';
|
||||
import SettingsStore from "matrix-react-sdk/lib/settings/SettingsStore";
|
||||
import Tinter from 'matrix-react-sdk/lib/Tinter';
|
||||
import SdkConfig from "matrix-react-sdk/lib/SdkConfig";
|
||||
import {setTheme} from "matrix-react-sdk/lib/theme";
|
||||
|
||||
import Olm from 'olm';
|
||||
|
||||
|
@ -250,50 +250,7 @@ async function loadApp() {
|
|||
}
|
||||
|
||||
// as quickly as we possibly can, set a default theme...
|
||||
let a;
|
||||
const theme = SettingsStore.getValue("theme");
|
||||
for (let i = 0; (a = document.getElementsByTagName("link")[i]); i++) {
|
||||
const href = a.getAttribute("href");
|
||||
if (!href) continue;
|
||||
// shouldn't we be using the 'title' tag rather than the href?
|
||||
const match = href.match(/^bundles\/.*\/theme-(.*)\.css$/);
|
||||
if (match) {
|
||||
if (match[1] === theme) {
|
||||
// remove the disabled flag off the stylesheet
|
||||
|
||||
// Firefox requires setting the attribute to false, so do
|
||||
// that instead of removing it. Related:
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=1281135
|
||||
a.disabled = false;
|
||||
|
||||
// in case the Tinter.tint() in MatrixChat fires before the
|
||||
// CSS has actually loaded (which in practice happens)...
|
||||
|
||||
// This if fixes Tinter.setTheme to not fire on Firefox
|
||||
// in case it is the first time loading Riot.
|
||||
// `InstallTrigger` is a Object which only exists on Firefox
|
||||
// (it is used for their Plugins) and can be used as a
|
||||
// feature check.
|
||||
// Firefox loads css always before js. This is why we dont use
|
||||
// onload or it's EventListener as thoose will never trigger.
|
||||
if (typeof InstallTrigger !== 'undefined') {
|
||||
Tinter.setTheme(theme);
|
||||
} else {
|
||||
// FIXME: we should probably block loading the app or even
|
||||
// showing a spinner until the theme is loaded, to avoid
|
||||
// flashes of unstyled content.
|
||||
a.onload = () => {
|
||||
Tinter.setTheme(theme);
|
||||
};
|
||||
}
|
||||
} else {
|
||||
// Firefox requires this to not be done via `setAttribute`
|
||||
// or via HTML.
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=1281135
|
||||
a.disabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
await setTheme();
|
||||
|
||||
// Now that we've loaded the theme (CSS), display the config syntax error if needed.
|
||||
if (configSyntaxError) {
|
||||
|
|
|
@ -199,7 +199,8 @@ export default class ElectronPlatform extends VectorBasePlatform {
|
|||
}
|
||||
|
||||
supportsAutoHideMenuBar(): boolean {
|
||||
return true;
|
||||
// This is irelevant on Mac as Menu bars don't live in the app window
|
||||
return !navigator.platform.toUpperCase().includes('MAC');
|
||||
}
|
||||
|
||||
async getAutoHideMenuBarEnabled(): boolean {
|
||||
|
|
|
@ -85,9 +85,29 @@ export default class VectorBasePlatform extends BasePlatform {
|
|||
bgColor = "#f00";
|
||||
}
|
||||
|
||||
this.favicon.badge(notif, {
|
||||
bgColor: bgColor,
|
||||
});
|
||||
const doUpdate = () => {
|
||||
this.favicon.badge(notif, {
|
||||
bgColor: bgColor,
|
||||
});
|
||||
};
|
||||
|
||||
doUpdate();
|
||||
|
||||
// HACK: Workaround for Chrome 78+ and dependency incompatibility.
|
||||
// The library we use doesn't appear to work in Chrome 78, likely due to their
|
||||
// changes surrounding tab behaviour. Tabs went through a bit of a redesign and
|
||||
// restructuring in Chrome 78, so it's not terribly surprising that the library
|
||||
// doesn't work correctly. The library we use hasn't been updated in years and
|
||||
// does not look easy to fix/fork ourselves - we might as well write our own that
|
||||
// doesn't include animation/webcam/etc support. However, that's a bit difficult
|
||||
// so for now we'll just trigger the update twice.
|
||||
//
|
||||
// Note that trying to reproduce the problem in isolation doesn't seem to work:
|
||||
// see https://gist.github.com/turt2live/5ab87919918adbfd7cfb8f1ad10f2409 for
|
||||
// an example (you'll need your own web server to host that).
|
||||
if (window.chrome) {
|
||||
doUpdate();
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn(`Failed to set badge count: ${e.message}`);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue