diff --git a/ts/components/CallingSelectPresentingSourcesModal.stories.tsx b/ts/components/CallingSelectPresentingSourcesModal.stories.tsx index b0c0829879d9..08c1d19ec768 100644 --- a/ts/components/CallingSelectPresentingSourcesModal.stories.tsx +++ b/ts/components/CallingSelectPresentingSourcesModal.stories.tsx @@ -21,29 +21,34 @@ const createProps = (): PropsType => ({ { id: 'screen', name: 'Entire Screen', + isScreen: true, thumbnail: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+P/1PwAF8AL1sEVIPAAAAABJRU5ErkJggg==', }, { id: 'window:123', name: 'Bozirro Airhorse', + isScreen: false, thumbnail: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z1D4HwAF5wJxzsNOIAAAAABJRU5ErkJggg==', }, { id: 'window:456', name: 'Discoverer', + isScreen: false, thumbnail: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8HwHwAFHQIIj4yLtgAAAABJRU5ErkJggg==', }, { id: 'window:789', name: 'Signal Beta', + isScreen: false, thumbnail: '', }, { id: 'window:xyz', name: 'Window that has a really long name and overflows', + isScreen: false, thumbnail: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+O/wHwAEhgJAyqFnAgAAAABJRU5ErkJggg==', }, diff --git a/ts/components/CallingSelectPresentingSourcesModal.tsx b/ts/components/CallingSelectPresentingSourcesModal.tsx index 26404e94d556..f89b87c34efb 100644 --- a/ts/components/CallingSelectPresentingSourcesModal.tsx +++ b/ts/components/CallingSelectPresentingSourcesModal.tsx @@ -9,7 +9,6 @@ import { LocalizerType } from '../types/Util'; import { Modal } from './Modal'; import { PresentedSource, PresentableSource } from '../types/Calling'; import { Theme } from '../util/theme'; -import { isScreenSource, translateSourceName } from '../services/calling'; export type PropsType = { i18n: LocalizerType; @@ -18,18 +17,14 @@ export type PropsType = { }; const Source = ({ - i18n, onSourceClick, source, sourceToPresent, }: { - i18n: LocalizerType; onSourceClick: (source: PresentedSource) => void; source: PresentableSource; sourceToPresent?: PresentedSource; }): JSX.Element => { - const name = translateSourceName(i18n, source); - return ( @@ -82,7 +77,10 @@ export const CallingSelectPresentingSourcesModal = ({ throw new Error('No sources available for presenting'); } - const sources = groupBy(presentingSourcesAvailable, isScreenSource); + const sources = groupBy( + presentingSourcesAvailable, + source => source.isScreen + ); return ( {sources.true.map(source => ( setSourceToPresent(selectedSource)} source={source} @@ -115,7 +112,6 @@ export const CallingSelectPresentingSourcesModal = ({
{sources.false.map(source => ( setSourceToPresent(selectedSource)} source={source} diff --git a/ts/services/calling.ts b/ts/services/calling.ts index 36269eec5808..0af6e7b8ae90 100644 --- a/ts/services/calling.ts +++ b/ts/services/calling.ts @@ -90,11 +90,11 @@ enum GroupCallUpdateMessageState { SentLeft, } -export function isScreenSource(source: PresentedSource): boolean { +function isScreenSource(source: PresentedSource): boolean { return source.id.startsWith('screen'); } -export function translateSourceName( +function translateSourceName( i18n: LocalizerType, source: PresentedSource ): string { @@ -940,7 +940,8 @@ export class CallingClass { ? source.appIcon.toDataURL() : undefined, id: source.id, - name: source.name, + name: translateSourceName(window.i18n, source), + isScreen: isScreenSource(source), thumbnail: source.thumbnail.toDataURL(), }); }); @@ -982,10 +983,7 @@ export class CallingClass { this.setOutgoingVideoIsScreenShare(call, isPresenting); if (source) { - ipcRenderer.send( - 'show-screen-share', - translateSourceName(window.i18n, source) - ); + ipcRenderer.send('show-screen-share', source.name); notify({ icon: 'images/icons/v2/video-solid-24.svg', message: window.i18n('calling__presenting--notification-body'), diff --git a/ts/types/Calling.ts b/ts/types/Calling.ts index c969f99a62bf..647ed8295b27 100644 --- a/ts/types/Calling.ts +++ b/ts/types/Calling.ts @@ -14,6 +14,7 @@ export type PresentableSource = { appIcon?: string; id: string; name: string; + isScreen: boolean; thumbnail: string; };