Move getDefaultDeviceName into the Platforms
So we can have a sensible device name on Electron
This commit is contained in:
parent
47534decb3
commit
c786980454
4 changed files with 49 additions and 15 deletions
|
@ -23,6 +23,9 @@ import request from 'browser-request';
|
|||
import dis from 'matrix-react-sdk/lib/dispatcher.js';
|
||||
import q from 'q';
|
||||
|
||||
import url from 'url';
|
||||
import UAParser from 'ua-parser-js';
|
||||
|
||||
export default class WebPlatform extends VectorBasePlatform {
|
||||
constructor() {
|
||||
super();
|
||||
|
@ -180,4 +183,16 @@ export default class WebPlatform extends VectorBasePlatform {
|
|||
installUpdate() {
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
getDefaultDeviceDisplayName() {
|
||||
// strip query-string and fragment from uri
|
||||
let u = url.parse(window.location.href);
|
||||
u.search = "";
|
||||
u.hash = "";
|
||||
let app_name = u.format();
|
||||
|
||||
let ua = new UAParser();
|
||||
return app_name + " via " + ua.getBrowser().name +
|
||||
" on " + ua.getOS().name;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue