Tweak default device name to be more compact
Fixes https://github.com/vector-im/riot-web/issues/13458
This commit is contained in:
parent
ab40d5b732
commit
1ad54a4dae
3 changed files with 16 additions and 5 deletions
|
@ -390,7 +390,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
|
|||
}
|
||||
|
||||
getDefaultDeviceDisplayName(): string {
|
||||
return _t('Riot Desktop on %(platformName)s', { platformName: platformFriendlyName() });
|
||||
return _t('Riot Desktop (%(platformName)s)', { platformName: platformFriendlyName() });
|
||||
}
|
||||
|
||||
screenCaptureErrorString(): ?string {
|
||||
|
|
|
@ -181,16 +181,27 @@ export default class WebPlatform extends VectorBasePlatform {
|
|||
getDefaultDeviceDisplayName(): string {
|
||||
// strip query-string and fragment from uri
|
||||
const u = url.parse(window.location.href);
|
||||
u.protocol = "";
|
||||
u.search = "";
|
||||
u.hash = "";
|
||||
const appName = u.format();
|
||||
// Remove trailing slash if present
|
||||
u.pathname = u.pathname.replace(/\/$/, "");
|
||||
|
||||
let appName = u.format();
|
||||
// Remove leading slashes if present
|
||||
appName = appName.replace(/^\/\//, "");
|
||||
// `appName` is now in the format `riot.im/develop`.
|
||||
|
||||
const ua = new UAParser();
|
||||
const browserName = ua.getBrowser().name || "unknown browser";
|
||||
let osName = ua.getOS().name || "unknown OS";
|
||||
// Stylise the value from the parser to match Apple's current branding.
|
||||
if (osName === "Mac OS") osName = "macOS";
|
||||
return _t('%(appName)s via %(browserName)s on %(osName)s', {appName: appName, browserName: browserName, osName: osName});
|
||||
return _t('%(appName)s (%(browserName)s, %(osName)s)', {
|
||||
appName,
|
||||
browserName,
|
||||
osName,
|
||||
});
|
||||
}
|
||||
|
||||
screenCaptureErrorString(): ?string {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue