:typescript: - Fix screen sharing indicator text and format string

This commit is contained in:
Kiran Niranjan 2019-01-16 13:02:47 +05:30
parent 8fabaa5c56
commit 05bedadc77
9 changed files with 16 additions and 10 deletions

View File

@ -217,6 +217,7 @@ export class WindowHandler {
// only for Window and if it is enabled // only for Window and if it is enabled
await injectStyles(this.mainWindow, this.isCustomTitleBarAndWindowOS); await injectStyles(this.mainWindow, this.isCustomTitleBarAndWindowOS);
if (this.isCustomTitleBarAndWindowOS) this.mainWindow.webContents.send('initiate-custom-title-bar'); if (this.isCustomTitleBarAndWindowOS) this.mainWindow.webContents.send('initiate-custom-title-bar');
this.mainWindow.webContents.send('page-load', { this.mainWindow.webContents.send('page-load', {
isWindowsOS, isWindowsOS,
locale: i18n.getLocale(), locale: i18n.getLocale(),
@ -373,6 +374,12 @@ export class WindowHandler {
* @param id {number} * @param id {number}
*/ */
public createScreenSharingIndicatorWindow(screenSharingWebContents: Electron.webContents, displayId: string, id: number): void { public createScreenSharingIndicatorWindow(screenSharingWebContents: Electron.webContents, displayId: string, id: number): void {
if (this.screenSharingIndicatorWindow && !this.screenSharingIndicatorWindow.isDestroyed()) {
this.screenSharingIndicatorWindow.close();
this.screenSharingIndicatorWindow = null;
}
const indicatorScreen = (displayId && electron.screen.getAllDisplays().filter((d) => displayId.includes(d.id.toString()))[ 0 ]) || electron.screen.getPrimaryDisplay(); const indicatorScreen = (displayId && electron.screen.getAllDisplays().filter((d) => displayId.includes(d.id.toString()))[ 0 ]) || electron.screen.getPrimaryDisplay();
const screenRect = indicatorScreen.workArea; const screenRect = indicatorScreen.workArea;
let opts = WindowHandler.getScreenSharingIndicatorOpts(); let opts = WindowHandler.getScreenSharingIndicatorOpts();

View File

@ -19,10 +19,10 @@ export const formatString = (str: string, data?: object): string => {
if (Object.prototype.hasOwnProperty.call(data, key)) { if (Object.prototype.hasOwnProperty.call(data, key)) {
return str.replace(/({([^}]+)})/g, (i) => { return str.replace(/({([^}]+)})/g, (i) => {
const replacedKey = i.replace(/{/, '').replace(/}/, ''); const replacedKey = i.replace(/{/, '').replace(/}/, '');
if (!data[replacedKey]) { if (!data[key] || !data[key][replacedKey]) {
return i; return i;
} }
return data[replacedKey]; return data[key][replacedKey];
}); });
} }
} }

View File

@ -112,7 +112,7 @@
"Share": "Share" "Share": "Share"
}, },
"ScreenSharingIndicator": { "ScreenSharingIndicator": {
"You are sharing your screen on Symphony": "You are sharing your screen on Symphony", "You are sharing your screen on {appName}": "You are sharing your screen on {appName}",
"Stop sharing": "Stop sharing", "Stop sharing": "Stop sharing",
"Hide": "Hide" "Hide": "Hide"
}, },

View File

@ -110,7 +110,7 @@
"Share": "Share" "Share": "Share"
}, },
"ScreenSharingIndicator": { "ScreenSharingIndicator": {
"You are sharing your screen on Symphony": "You are sharing your screen on Symphony", "You are sharing your screen on {appName}": "You are sharing your screen on {appName}",
"Stop sharing": "Stop sharing", "Stop sharing": "Stop sharing",
"Hide": "Hide" "Hide": "Hide"
}, },

View File

@ -110,7 +110,7 @@
"Share":"Partager" "Share":"Partager"
}, },
"ScreenSharingIndicator": { "ScreenSharingIndicator": {
"You are sharing your screen on Symphony": "Vous partagez votre écran sur Symphony", "You are sharing your screen on {appName}": "Vous partagez votre écran sur {appName}",
"Stop sharing": "Arrêter le partage", "Stop sharing": "Arrêter le partage",
"Hide": "Masquer" "Hide": "Masquer"
}, },

View File

@ -110,7 +110,7 @@
"Share":"Partager" "Share":"Partager"
}, },
"ScreenSharingIndicator": { "ScreenSharingIndicator": {
"You are sharing your screen on Symphony": "Vous partagez votre écran sur Symphony", "You are sharing your screen on {appName}": "Vous partagez votre écran sur {appName}",
"Stop sharing": "Arrêter le partage", "Stop sharing": "Arrêter le partage",
"Hide": "Masquer" "Hide": "Masquer"
}, },

View File

@ -112,7 +112,7 @@
"Share": "共有" "Share": "共有"
}, },
"ScreenSharingIndicator": { "ScreenSharingIndicator": {
"You are sharing your screen on Symphony": "あなたはSymphony上であなたの画面を共有しています", "You are sharing your screen on {appName}": "あなたは{appName}上であなたの画面を共有しています",
"Stop Sharing": "共有を停止", "Stop Sharing": "共有を停止",
"Hide": "非表示にする" "Hide": "非表示にする"
}, },

View File

@ -110,7 +110,7 @@
"Share": "共有" "Share": "共有"
}, },
"ScreenSharingIndicator": { "ScreenSharingIndicator": {
"You are sharing your screen on Symphony": "あなたはSymphony上であなたの画面を共有しています", "You are sharing your screen on {appName}": "あなたは{appName}上であなたの画面を共有しています",
"Stop Sharing": "共有を停止", "Stop Sharing": "共有を停止",
"Hide": "非表示にする" "Hide": "非表示にする"
}, },

View File

@ -36,8 +36,7 @@ export default class ScreenSharingIndicator extends React.Component<{}, IState>
return ( return (
<div className={classNames('ScreenSharingIndicator', { mac: isMac })}> <div className={classNames('ScreenSharingIndicator', { mac: isMac })}>
<span className='drag-area'/> <span className='drag-area'/>
<span className='text-label'>{i18n.t(`You are sharing your screen on `, namespace)()}</span> <span className='text-label'>{i18n.t(`You are sharing your screen on {appName}`, namespace)({ appName: remote.app.getName() })}</span>
<span className='text-label'><b>{remote.app.getName()}</b></span>
<span className='buttons'> <span className='buttons'>
<a className='hide-button' href='#' onClick={() => this.eventHandlers.onClose(id)}>{i18n.t('Hide', namespace)()}</a> <a className='hide-button' href='#' onClick={() => this.eventHandlers.onClose(id)}>{i18n.t('Hide', namespace)()}</a>
<button className='stop-sharing-button' onClick={() => this.eventHandlers.onStopScreenSharing(id)}> <button className='stop-sharing-button' onClick={() => this.eventHandlers.onStopScreenSharing(id)}>