[MM-36326][MM-45669] Added Native Node Module support - incl demo to fix DND issue (#2195)
* [MM-36326] Added Native Node Module support - incl demo to fix DND issue * Fix OS per build * Fix to include priority alarms on Windows * Update node command * Fixes for mac (only work on non-MAS build) * Attempt to rebuild properly since electron-builder is having issues with a module * Show me more logs maybe idk * Try with ignore-scripts * Force async to work asyncly * PR feedback and ESLint fixes * Add comment for node-gyp * Revert me: test msi and mac installer * Revert me too * Try reverting back to the old system cause the new one miraculously broke... * Add ignore scripts to makefile * Ignore non-macho files :P * Revert "Revert me too" This reverts commit 074dc9551a2d8ce34a23a3abaeed937d957e8b76. * Revert "Revert me: test msi and mac installer" This reverts commit 0ac998c26a824e7136bdfdc825280a407bb1aa7f.
This commit is contained in:
@@ -5,6 +5,9 @@
|
||||
|
||||
import {Notification, shell} from 'electron';
|
||||
|
||||
import {getFocusAssist} from 'windows-focus-assist';
|
||||
import {getDoNotDisturb as getDarwinDoNotDisturb} from 'macos-notification-state';
|
||||
|
||||
import {PLAY_SOUND} from 'common/communication';
|
||||
import {TAB_MESSAGING} from 'common/tabs/TabView';
|
||||
|
||||
@@ -53,6 +56,14 @@ jest.mock('electron', () => {
|
||||
};
|
||||
});
|
||||
|
||||
jest.mock('windows-focus-assist', () => ({
|
||||
getFocusAssist: jest.fn(),
|
||||
}));
|
||||
|
||||
jest.mock('macos-notification-state', () => ({
|
||||
getDoNotDisturb: jest.fn(),
|
||||
}));
|
||||
|
||||
jest.mock('../windows/windowManager', () => ({
|
||||
getServerNameByWebContentsId: () => 'server_name',
|
||||
sendToRenderer: jest.fn(),
|
||||
@@ -68,6 +79,7 @@ describe('main/notifications', () => {
|
||||
describe('displayMention', () => {
|
||||
beforeEach(() => {
|
||||
Notification.isSupported.mockImplementation(() => true);
|
||||
getFocusAssist.mockReturnValue({value: false});
|
||||
});
|
||||
|
||||
it('should do nothing when Notification is not supported', () => {
|
||||
@@ -85,6 +97,54 @@ describe('main/notifications', () => {
|
||||
expect(Notification.didConstruct).not.toBeCalled();
|
||||
});
|
||||
|
||||
it('should do nothing when alarms only is enabled on windows', () => {
|
||||
const originalPlatform = process.platform;
|
||||
Object.defineProperty(process, 'platform', {
|
||||
value: 'win32',
|
||||
});
|
||||
|
||||
getFocusAssist.mockReturnValue({value: 2});
|
||||
displayMention(
|
||||
'test',
|
||||
'test body',
|
||||
{id: 'channel_id'},
|
||||
'team_id',
|
||||
'http://server-1.com/team_id/channel_id',
|
||||
false,
|
||||
{id: 1},
|
||||
{},
|
||||
);
|
||||
expect(Notification.didConstruct).not.toBeCalled();
|
||||
|
||||
Object.defineProperty(process, 'platform', {
|
||||
value: originalPlatform,
|
||||
});
|
||||
});
|
||||
|
||||
it('should do nothing when dnd is enabled on mac', () => {
|
||||
const originalPlatform = process.platform;
|
||||
Object.defineProperty(process, 'platform', {
|
||||
value: 'darwin',
|
||||
});
|
||||
|
||||
getDarwinDoNotDisturb.mockReturnValue(true);
|
||||
displayMention(
|
||||
'test',
|
||||
'test body',
|
||||
{id: 'channel_id'},
|
||||
'team_id',
|
||||
'http://server-1.com/team_id/channel_id',
|
||||
false,
|
||||
{id: 1},
|
||||
{},
|
||||
);
|
||||
expect(Notification.didConstruct).not.toBeCalled();
|
||||
|
||||
Object.defineProperty(process, 'platform', {
|
||||
value: originalPlatform,
|
||||
});
|
||||
});
|
||||
|
||||
it('should play notification sound when custom sound is provided', () => {
|
||||
displayMention(
|
||||
'test',
|
||||
|
Reference in New Issue
Block a user