Moves navigateTo to util
This commit is contained in:
@@ -8,6 +8,7 @@ import { ConversationType } from '../state/ducks/conversations';
|
||||
import { Intl } from './Intl';
|
||||
import { ContactName } from './conversation/ContactName';
|
||||
import { GroupDialog } from './GroupDialog';
|
||||
import { openLinkInWebBrowser } from '../util/openLinkInWebBrowser';
|
||||
|
||||
type PropsType = {
|
||||
contacts: Array<ConversationType>;
|
||||
@@ -68,8 +69,9 @@ export const NewlyCreatedGroupInvitedContactsDialog: FunctionComponent<PropsType
|
||||
'NewlyCreatedGroupInvitedContactsDialog--body--learn-more'
|
||||
)}
|
||||
onClickSecondaryButton={() => {
|
||||
window.location.href =
|
||||
'https://support.signal.org/hc/articles/360007319331-Group-chats';
|
||||
openLinkInWebBrowser(
|
||||
'https://support.signal.org/hc/articles/360007319331-Group-chats'
|
||||
);
|
||||
}}
|
||||
onClose={onClose}
|
||||
title={title}
|
||||
|
@@ -12,6 +12,7 @@ import { ConfirmationDialog } from '../ConfirmationDialog';
|
||||
import { Button, ButtonSize, ButtonVariant } from '../Button';
|
||||
import { shouldBlurAvatar } from '../../util/shouldBlurAvatar';
|
||||
import * as log from '../../logging/log';
|
||||
import { openLinkInWebBrowser } from '../../util/openLinkInWebBrowser';
|
||||
|
||||
export type Props = {
|
||||
about?: string;
|
||||
@@ -237,8 +238,9 @@ export const ConversationHero = ({
|
||||
{
|
||||
text: i18n('MessageRequestWarning__dialog__learn-even-more'),
|
||||
action: () => {
|
||||
window.location.href =
|
||||
'https://support.signal.org/hc/articles/360007459591';
|
||||
openLinkInWebBrowser(
|
||||
'https://support.signal.org/hc/articles/360007459591'
|
||||
);
|
||||
closeMessageRequestWarning();
|
||||
},
|
||||
},
|
||||
|
6
ts/util/openLinkInWebBrowser.ts
Normal file
6
ts/util/openLinkInWebBrowser.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
// Copyright 2021 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
export function openLinkInWebBrowser(url: string): void {
|
||||
window.location.href = url;
|
||||
}
|
@@ -84,6 +84,7 @@ import { isNotNil } from '../util/isNotNil';
|
||||
import { dropNull } from '../util/dropNull';
|
||||
import { CompositionAPIType } from '../components/CompositionArea';
|
||||
import * as log from '../logging/log';
|
||||
import { openLinkInWebBrowser } from '../util/openLinkInWebBrowser';
|
||||
|
||||
type AttachmentOptions = {
|
||||
messageId: string;
|
||||
@@ -1046,11 +1047,9 @@ export class ConversationView extends window.Backbone.View<ConversationModel> {
|
||||
const showIdentity = (conversationId: string) => {
|
||||
this.showSafetyNumber(conversationId);
|
||||
};
|
||||
const openLink = (url: string) => {
|
||||
this.navigateTo(url);
|
||||
};
|
||||
const openLink = openLinkInWebBrowser;
|
||||
const downloadNewVersion = () => {
|
||||
this.downloadNewVersion();
|
||||
openLinkInWebBrowser('https://signal.org/download');
|
||||
};
|
||||
const showSafetyNumber = (contactId: string) => {
|
||||
this.showSafetyNumber(contactId);
|
||||
@@ -1102,11 +1101,13 @@ export class ConversationView extends window.Backbone.View<ConversationModel> {
|
||||
const supportLocale = window.Signal.Util.mapToSupportLocale(locale);
|
||||
const url = baseUrl.replace('LOCALE', supportLocale);
|
||||
|
||||
this.navigateTo(url);
|
||||
openLinkInWebBrowser(url);
|
||||
};
|
||||
|
||||
const learnMoreAboutDeliveryIssue = () => {
|
||||
this.navigateTo('https://support.signal.org/hc/articles/4404859745690');
|
||||
openLinkInWebBrowser(
|
||||
'https://support.signal.org/hc/articles/4404859745690'
|
||||
);
|
||||
};
|
||||
|
||||
const scrollToQuotedMessage = async (
|
||||
@@ -1721,15 +1722,6 @@ export class ConversationView extends window.Backbone.View<ConversationModel> {
|
||||
this.remove();
|
||||
}
|
||||
|
||||
// eslint-disable-next-line class-methods-use-this
|
||||
navigateTo(url: string): void {
|
||||
window.location.href = url;
|
||||
}
|
||||
|
||||
downloadNewVersion(): void {
|
||||
this.navigateTo('https://signal.org/download');
|
||||
}
|
||||
|
||||
async onDrop(e: JQuery.TriggeredEvent): Promise<void> {
|
||||
if (!e.originalEvent) {
|
||||
return;
|
||||
|
@@ -2,6 +2,7 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import * as log from '../logging/log';
|
||||
import { openLinkInWebBrowser } from '../util/openLinkInWebBrowser';
|
||||
|
||||
window.Whisper = window.Whisper || {};
|
||||
const { Whisper } = window;
|
||||
@@ -106,7 +107,7 @@ Whisper.InstallView = Whisper.View.extend({
|
||||
this.error.name === 'HTTPError' &&
|
||||
this.error.code === TOO_OLD
|
||||
) {
|
||||
window.location.href = 'https://signal.org/download';
|
||||
openLinkInWebBrowser('https://signal.org/download');
|
||||
return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user