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