forked from matrix/element-web
Merge pull request #13465 from vector-im/jryans/update-default-device-format
Tweak default device name to be more compact
This commit is contained in:
commit
ba6e1d924f
|
@ -10,10 +10,10 @@
|
||||||
"Unexpected error preparing the app. See console for details.": "Unexpected error preparing the app. See console for details.",
|
"Unexpected error preparing the app. See console for details.": "Unexpected error preparing the app. See console for details.",
|
||||||
"Open user settings": "Open user settings",
|
"Open user settings": "Open user settings",
|
||||||
"Previous/next recently visited room or community": "Previous/next recently visited room or community",
|
"Previous/next recently visited room or community": "Previous/next recently visited room or community",
|
||||||
"Riot Desktop on %(platformName)s": "Riot Desktop on %(platformName)s",
|
"Riot Desktop (%(platformName)s)": "Riot Desktop (%(platformName)s)",
|
||||||
"Go to your browser to complete Sign In": "Go to your browser to complete Sign In",
|
"Go to your browser to complete Sign In": "Go to your browser to complete Sign In",
|
||||||
"Unknown device": "Unknown device",
|
"Unknown device": "Unknown device",
|
||||||
"%(appName)s via %(browserName)s on %(osName)s": "%(appName)s via %(browserName)s on %(osName)s",
|
"%(appName)s (%(browserName)s, %(osName)s)": "%(appName)s (%(browserName)s, %(osName)s)",
|
||||||
"You need to be using HTTPS to place a screen-sharing call.": "You need to be using HTTPS to place a screen-sharing call.",
|
"You need to be using HTTPS to place a screen-sharing call.": "You need to be using HTTPS to place a screen-sharing call.",
|
||||||
"powered by Matrix": "powered by Matrix",
|
"powered by Matrix": "powered by Matrix",
|
||||||
"Custom Server Options": "Custom Server Options",
|
"Custom Server Options": "Custom Server Options",
|
||||||
|
|
|
@ -390,7 +390,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
|
||||||
}
|
}
|
||||||
|
|
||||||
getDefaultDeviceDisplayName(): string {
|
getDefaultDeviceDisplayName(): string {
|
||||||
return _t('Riot Desktop on %(platformName)s', { platformName: platformFriendlyName() });
|
return _t('Riot Desktop (%(platformName)s)', { platformName: platformFriendlyName() });
|
||||||
}
|
}
|
||||||
|
|
||||||
screenCaptureErrorString(): ?string {
|
screenCaptureErrorString(): ?string {
|
||||||
|
|
|
@ -181,16 +181,27 @@ export default class WebPlatform extends VectorBasePlatform {
|
||||||
getDefaultDeviceDisplayName(): string {
|
getDefaultDeviceDisplayName(): string {
|
||||||
// strip query-string and fragment from uri
|
// strip query-string and fragment from uri
|
||||||
const u = url.parse(window.location.href);
|
const u = url.parse(window.location.href);
|
||||||
|
u.protocol = "";
|
||||||
u.search = "";
|
u.search = "";
|
||||||
u.hash = "";
|
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 ua = new UAParser();
|
||||||
const browserName = ua.getBrowser().name || "unknown browser";
|
const browserName = ua.getBrowser().name || "unknown browser";
|
||||||
let osName = ua.getOS().name || "unknown OS";
|
let osName = ua.getOS().name || "unknown OS";
|
||||||
// Stylise the value from the parser to match Apple's current branding.
|
// Stylise the value from the parser to match Apple's current branding.
|
||||||
if (osName === "Mac OS") osName = "macOS";
|
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 {
|
screenCaptureErrorString(): ?string {
|
||||||
|
|
Loading…
Reference in New Issue