Hides the "Hide menu bar" option on MacOS (#2903)
The "Hide menu bar" option is only applicable to Windows and some Linux distros, where the menu bar is attached to the Signal window. Therefore, this commit ensures that it doesn't show up on MacOS. It includes a setting, isHideMenuBarSupported(), to control the option's appearance. This commit also includes the tests to make sure isHideMenuBarSupported() works correctly. Fixes #2705
This commit is contained in:
parent
3e16ea7b32
commit
7727dc093e
4 changed files with 75 additions and 6 deletions
|
@ -106,12 +106,14 @@
|
||||||
value: window.initialData.spellCheck,
|
value: window.initialData.spellCheck,
|
||||||
setFn: window.setSpellCheck,
|
setFn: window.setSpellCheck,
|
||||||
});
|
});
|
||||||
new CheckboxView({
|
if (Settings.isHideMenuBarSupported()) {
|
||||||
el: this.$('.menu-bar-setting'),
|
new CheckboxView({
|
||||||
name: 'menu-bar-setting',
|
el: this.$('.menu-bar-setting'),
|
||||||
value: window.initialData.hideMenuBar,
|
name: 'menu-bar-setting',
|
||||||
setFn: window.setHideMenuBar,
|
value: window.initialData.hideMenuBar,
|
||||||
});
|
setFn: window.setHideMenuBar,
|
||||||
|
});
|
||||||
|
}
|
||||||
new MediaPermissionsSettingView({
|
new MediaPermissionsSettingView({
|
||||||
el: this.$('.media-permissions'),
|
el: this.$('.media-permissions'),
|
||||||
value: window.initialData.mediaPermissions,
|
value: window.initialData.mediaPermissions,
|
||||||
|
@ -140,6 +142,7 @@
|
||||||
nameOnly: i18n('nameOnly'),
|
nameOnly: i18n('nameOnly'),
|
||||||
audioNotificationDescription: i18n('audioNotificationDescription'),
|
audioNotificationDescription: i18n('audioNotificationDescription'),
|
||||||
isAudioNotificationSupported: Settings.isAudioNotificationSupported(),
|
isAudioNotificationSupported: Settings.isAudioNotificationSupported(),
|
||||||
|
isHideMenuBarSupported: Settings.isHideMenuBarSupported(),
|
||||||
themeLight: i18n('themeLight'),
|
themeLight: i18n('themeLight'),
|
||||||
themeDark: i18n('themeDark'),
|
themeDark: i18n('themeDark'),
|
||||||
hideMenuBar: i18n('hideMenuBar'),
|
hideMenuBar: i18n('hideMenuBar'),
|
||||||
|
|
|
@ -54,10 +54,12 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
|
{{ #isHideMenuBarSupported }}
|
||||||
<div class='menu-bar-setting'>
|
<div class='menu-bar-setting'>
|
||||||
<input type='checkbox' name='hide-menu-bar' id='hide-menu-bar'/>
|
<input type='checkbox' name='hide-menu-bar' id='hide-menu-bar'/>
|
||||||
<label for='hide-menu-bar'>{{ hideMenuBar }}</label>
|
<label for='hide-menu-bar'>{{ hideMenuBar }}</label>
|
||||||
</div>
|
</div>
|
||||||
|
{{ /isHideMenuBarSupported }}
|
||||||
<hr>
|
<hr>
|
||||||
<div class='notification-settings'>
|
<div class='notification-settings'>
|
||||||
<h3>{{ notifications }}</h3>
|
<h3>{{ notifications }}</h3>
|
||||||
|
|
|
@ -130,4 +130,65 @@ describe('Settings', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
describe('isHideMenuBarSupported', () => {
|
||||||
|
context('on macOS', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
sandbox.stub(process, 'platform').value('darwin');
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
sandbox.restore();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return false', () => {
|
||||||
|
assert.isFalse(Settings.isHideMenuBarSupported());
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
context('on Windows', () => {
|
||||||
|
context('version 7', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
sandbox.stub(process, 'platform').value('win32');
|
||||||
|
sandbox.stub(os, 'release').returns('7.0.0');
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
sandbox.restore();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return true', () => {
|
||||||
|
assert.isTrue(Settings.isHideMenuBarSupported());
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
context('version 8+', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
sandbox.stub(process, 'platform').value('win32');
|
||||||
|
sandbox.stub(os, 'release').returns('8.0.0');
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
sandbox.restore();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return true', () => {
|
||||||
|
assert.isTrue(Settings.isHideMenuBarSupported());
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
context('on Linux', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
sandbox.stub(process, 'platform').value('linux');
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
sandbox.restore();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return true', () => {
|
||||||
|
assert.isTrue(Settings.isHideMenuBarSupported());
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -9,3 +9,6 @@ export const isAudioNotificationSupported = () =>
|
||||||
// https://github.com/electron/electron/issues/11189
|
// https://github.com/electron/electron/issues/11189
|
||||||
export const isNotificationGroupingSupported = () =>
|
export const isNotificationGroupingSupported = () =>
|
||||||
!OS.isWindows() || OS.isWindows(MIN_WINDOWS_VERSION);
|
!OS.isWindows() || OS.isWindows(MIN_WINDOWS_VERSION);
|
||||||
|
|
||||||
|
// the "hide menu bar" option is specific to Windows and Linux
|
||||||
|
export const isHideMenuBarSupported = () => !OS.isMacOS();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue