Refactor Signal app routing

This commit is contained in:
Jamie Kyle 2023-11-02 12:42:31 -07:00 committed by GitHub
parent 86e6c2499c
commit 3ef0d221d1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 1347 additions and 1044 deletions

View file

@ -9,6 +9,7 @@ import { maybeParseUrl } from '../util/url';
import { replaceEmojiWithSpaces } from '../util/emoji';
import type { AttachmentWithHydratedData } from './Attachment';
import { artAddStickersRoute, groupInvitesRoute } from '../util/signalRoutes';
export type LinkPreviewImage = AttachmentWithHydratedData;
@ -95,11 +96,13 @@ export function shouldLinkifyMessage(
}
export function isStickerPack(link = ''): boolean {
return link.startsWith('https://signal.art/addstickers/');
const url = maybeParseUrl(link);
return url?.protocol === 'https:' && artAddStickersRoute.isMatch(url);
}
export function isGroupLink(link = ''): boolean {
return link.startsWith('https://signal.group/');
const url = maybeParseUrl(link);
return url?.protocol === 'https:' && groupInvitesRoute.isMatch(url);
}
export function findLinks(text: string, caretLocation?: number): Array<string> {