In-App Links in Channel's Bookmarks (#3454)
* Enhance mattermost:// protocol handling for in-app links - Add isMattermostProtocol() helper function to identify mattermost:// URLs - Update webContentEvents to handle mattermost:// links through internal deep linking - Ensure mattermost:// links in bookmarks open within the app instead of external dialog - Maintain existing custom protocol dialog for other non-http/https protocols This improves the user experience by allowing mattermost:// bookmarks to navigate directly within the desktop app without prompting external application dialogs. * Fix trailing spaces linting error --------- Co-authored-by: Dmitry Spasskiy <dmitry.spassky@raiffeisen.ru>
This commit is contained in:
@@ -28,7 +28,7 @@ import ViewManager from 'main/views/viewManager';
|
||||
import CallsWidgetWindow from 'main/windows/callsWidgetWindow';
|
||||
import MainWindow from 'main/windows/mainWindow';
|
||||
|
||||
import {generateHandleConsoleMessage, isCustomProtocol} from './webContentEventsCommon';
|
||||
import {generateHandleConsoleMessage, isCustomProtocol, isMattermostProtocol} from './webContentEventsCommon';
|
||||
|
||||
import allowProtocolDialog from '../allowProtocolDialog';
|
||||
import {composeUserAgent} from '../utils';
|
||||
@@ -131,7 +131,13 @@ export class WebContentsEventManager {
|
||||
return PluginsPopUpsManager.handleNewWindow(webContentsId, details);
|
||||
}
|
||||
|
||||
// Check for custom protocol
|
||||
// Check for mattermost protocol - handle internally
|
||||
if (isMattermostProtocol(parsedURL)) {
|
||||
ViewManager.handleDeepLink(parsedURL);
|
||||
return {action: 'deny'};
|
||||
}
|
||||
|
||||
// Check for other custom protocols
|
||||
if (isCustomProtocol(parsedURL)) {
|
||||
allowProtocolDialog.handleDialogEvent(parsedURL.protocol, details.url);
|
||||
return {action: 'deny'};
|
||||
|
@@ -34,3 +34,8 @@ export function isCustomProtocol(url: URL) {
|
||||
const scheme = protocols && protocols[0] && protocols[0].schemes && protocols[0].schemes[0];
|
||||
return url.protocol !== 'http:' && url.protocol !== 'https:' && url.protocol !== `${scheme}:`;
|
||||
}
|
||||
|
||||
export function isMattermostProtocol(url: URL) {
|
||||
const scheme = protocols && protocols[0] && protocols[0].schemes && protocols[0].schemes[0];
|
||||
return url.protocol === `${scheme}:`;
|
||||
}
|
||||
|
Reference in New Issue
Block a user