[MM-53847] Expose isDev API to allow webapp to check if the app is in dev mode (#2800)
* [MM-53847] Expose isDev API to allow webapp to check if the app is in dev mode * Fix test
This commit is contained in:
@@ -235,7 +235,7 @@ function initializeBeforeAppReady() {
|
||||
AllowProtocolDialog.init();
|
||||
|
||||
if (isDev && process.env.NODE_ENV !== 'test') {
|
||||
log.info('In development mode, deeplinking is disabled');
|
||||
app.setAsDefaultProtocolClient('mattermost-dev');
|
||||
} else if (mainProtocol) {
|
||||
app.setAsDefaultProtocolClient(mainProtocol);
|
||||
}
|
||||
|
@@ -35,6 +35,8 @@ jest.mock('electron', () => ({
|
||||
},
|
||||
}));
|
||||
|
||||
jest.mock('electron-is-dev', () => false);
|
||||
|
||||
jest.mock('common/config', () => ({
|
||||
setServers: jest.fn(),
|
||||
}));
|
||||
|
@@ -6,6 +6,7 @@ import path from 'path';
|
||||
import fs from 'fs-extra';
|
||||
|
||||
import {app, BrowserWindow, Menu, Rectangle, Session, session, dialog, nativeImage, screen} from 'electron';
|
||||
import isDev from 'electron-is-dev';
|
||||
|
||||
import {MigrationInfo} from 'types/config';
|
||||
import {RemoteInfo} from 'types/server';
|
||||
@@ -72,7 +73,8 @@ export function getDeeplinkingURL(args: string[]) {
|
||||
if (Array.isArray(args) && args.length) {
|
||||
// deeplink urls should always be the last argument, but may not be the first (i.e. Windows with the app already running)
|
||||
const url = args[args.length - 1];
|
||||
if (url && mainProtocol && url.startsWith(mainProtocol) && isValidURI(url)) {
|
||||
const protocol = isDev ? 'mattermost-dev' : mainProtocol;
|
||||
if (url && protocol && url.startsWith(protocol) && isValidURI(url)) {
|
||||
return url;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user