Skip to content

Commit

Permalink
chore: Disable internalVideoChatWindow when on MAS version (#2383)
Browse files Browse the repository at this point in the history
* chore: Disable internalVideoChatWindow when on MAS version

* validate process.mas on jitsi window opening

* add timeout to reset app data

* remove Reset App Data for MAS
  • Loading branch information
jeanfbrito authored Apr 18, 2022
1 parent a1ea334 commit 052afed
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 18 deletions.
2 changes: 1 addition & 1 deletion electron-builder.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"mas"
],
"icon": "build/icon.icns",
"bundleVersion": "85",
"bundleVersion": "88",
"helperBundleId": "chat.rocket.electron.helper",
"type": "distribution",
"artifactName": "rocketchat-${version}-${os}.${ext}",
Expand Down
8 changes: 8 additions & 0 deletions src/app/PersistableValues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ type PersistableValues_3_8_1 = PersistableValues_3_7_9 & {
isReportEnabled: boolean;
};

type PersistableValues_3_8_4 = PersistableValues_3_8_1 & {
isInternalVideoChatWindowEnabled: boolean;
};

export type PersistableValues = Pick<
PersistableValues_3_5_0,
keyof PersistableValues_3_5_0
Expand Down Expand Up @@ -81,4 +85,8 @@ export const migrations = {
...before,
isReportEnabled: !process.mas,
}),
'>=3.8.4': (before: PersistableValues_3_8_1): PersistableValues_3_8_4 => ({
...before,
isInternalVideoChatWindowEnabled: !process.mas,
}),
};
3 changes: 2 additions & 1 deletion src/i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@
},
"internalVideoChatWindow": {
"title": "Open Video Chat using Application Window",
"description": "When set Video Chat will be opened using an application's window, otherwise the default browser will be used."
"description": "When set Video Chat will be opened using an application's window, otherwise the default browser will be used.",
"masDescription" : "This option is disabled when installed from the Mac App Store, for security reasons it will open Video Chat using the browser by default."
},
"minimizeOnClose": {
"title": "Minimize on close",
Expand Down
5 changes: 3 additions & 2 deletions src/i18n/pt-BR.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
"report": {
"title": "Relatar erros aos desenvolvedores",
"description": "Reporte os erros anonimamente aos desenvolvedores. As informações compartilhadas incluem número de versão do aplicativo, tipo de sistema operacional, URL do servidor, idioma do dispositivo e tipo de erro. Nenhum conteúdo ou nome de usuário é compartilhado.",
"masDescription": "Essa opção é desabilitada quando instalada a partir da Mac App Store, os erros serão reportados através do processo de reportação da Mac App Store"
"masDescription" : "Esta opção esta desativada quando for instalado através da Mac App Store, os erros serão reportados através do processo de relatórios de erros da Mac Apple Store."
},
"flashFrame": {
"title": "Piscar janela",
Expand All @@ -160,7 +160,8 @@
},
"internalVideoChatWindow": {
"title": "Abrir chat em video em uma janela da aplicação",
"description": "Quando ativo o chat em video será aberto em uma janela da aplicação, caso contrário será aberto em uma nova janela do navegador."
"description": "Quando ativo o chat em video será aberto em uma janela da aplicação, caso contrário será aberto em uma nova janela do navegador.",
"masDescription" : "Esta opção esta desativada quando for instalado através da Mac App Store, por motivos de segurança o chat em video sera aberto usando o navegador por padrão."
},
"minimizeOnClose": {
"title": "Minimizar ao fechar",
Expand Down
4 changes: 2 additions & 2 deletions src/injected.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ const start = (): void => {
if (
typeof url === 'string' &&
url.includes(jitsiDomain) &&
!process.mas &&
window.RocketChatDesktop.getInternalVideoChatWindowEnabled()
) {
return open(url, 'Jitsi Meet', `scrollbars=true,${features}`);
Expand Down Expand Up @@ -109,8 +110,7 @@ const start = (): void => {

window.Notification = class RocketChatDesktopNotification
extends EventTarget
implements Notification
{
implements Notification {
static readonly permission: NotificationPermission = 'granted';

static readonly maxActions: number =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const InternalVideoChatWindow: FC<Props> = (props) => {
<Field className={props.className}>
<Field.Row>
<ToggleSwitch
disabled={process.mas}
onChange={handleChange}
checked={isInternalVideoChatWindowEnabled}
/>
Expand All @@ -41,9 +42,15 @@ export const InternalVideoChatWindow: FC<Props> = (props) => {
</Field.Label>
</Field.Row>
<Field.Row>
<Field.Hint>
{t('settings.options.internalVideoChatWindow.description')}
</Field.Hint>
{process.mas ? (
<Field.Hint>
{t('settings.options.internalVideoChatWindow.masDescription')}
</Field.Hint>
) : (
<Field.Hint>
{t('settings.options.internalVideoChatWindow.description')}
</Field.Hint>
)}
</Field.Row>
</Field>
);
Expand Down
20 changes: 11 additions & 9 deletions src/ui/main/menuBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -640,17 +640,19 @@ const createHelpMenu = createSelector(
dispatch({ type: CERTIFICATES_CLEARED });
},
},
{
id: 'resetAppData',
label: t('menus.resetAppData'),
click: async () => {
const permitted = await askForAppDataReset();
...on(!process.mas, () => [
{
id: 'resetAppData',
label: t('menus.resetAppData'),
click: async () => {
const permitted = await askForAppDataReset();

if (permitted) {
relaunchApp('--reset-app-data');
}
if (permitted) {
relaunchApp('--reset-app-data');
}
},
},
},
]),
{ type: 'separator' },
{
id: 'learnMore',
Expand Down

0 comments on commit 052afed

Please sign in to comment.