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,
|
||||
setFn: window.setSpellCheck,
|
||||
});
|
||||
if (Settings.isHideMenuBarSupported()) {
|
||||
new CheckboxView({
|
||||
el: this.$('.menu-bar-setting'),
|
||||
name: 'menu-bar-setting',
|
||||
value: window.initialData.hideMenuBar,
|
||||
setFn: window.setHideMenuBar,
|
||||
});
|
||||
}
|
||||
new MediaPermissionsSettingView({
|
||||
el: this.$('.media-permissions'),
|
||||
value: window.initialData.mediaPermissions,
|
||||
|
@ -140,6 +142,7 @@
|
|||
nameOnly: i18n('nameOnly'),
|
||||
audioNotificationDescription: i18n('audioNotificationDescription'),
|
||||
isAudioNotificationSupported: Settings.isAudioNotificationSupported(),
|
||||
isHideMenuBarSupported: Settings.isHideMenuBarSupported(),
|
||||
themeLight: i18n('themeLight'),
|
||||
themeDark: i18n('themeDark'),
|
||||
hideMenuBar: i18n('hideMenuBar'),
|
||||
|
|
|
@ -54,10 +54,12 @@
|
|||
</div>
|
||||
</div>
|
||||
<br />
|
||||
{{ #isHideMenuBarSupported }}
|
||||
<div class='menu-bar-setting'>
|
||||
<input type='checkbox' name='hide-menu-bar' id='hide-menu-bar'/>
|
||||
<label for='hide-menu-bar'>{{ hideMenuBar }}</label>
|
||||
</div>
|
||||
{{ /isHideMenuBarSupported }}
|
||||
<hr>
|
||||
<div class='notification-settings'>
|
||||
<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
|
||||
export const isNotificationGroupingSupported = () =>
|
||||
!OS.isWindows() || OS.isWindows(MIN_WINDOWS_VERSION);
|
||||
|
||||
// the "hide menu bar" option is specific to Windows and Linux
|
||||
export const isHideMenuBarSupported = () => !OS.isMacOS();
|
||||
|
|
Loading…
Reference in a new issue