Move getDefaultDeviceName into the Platforms
So we can have a sensible device name on Electron
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user