URL: Use corrent method field (#5267)
This commit is contained in:
parent
81386ba911
commit
87840629da
@ -6,7 +6,6 @@ import type { DeepLinkMethod, PrivateMessageLink } from './deepLinkParser';
|
|||||||
import { API_CHAT_TYPES, RE_TG_LINK } from '../config';
|
import { API_CHAT_TYPES, RE_TG_LINK } from '../config';
|
||||||
import { toChannelId } from '../global/helpers';
|
import { toChannelId } from '../global/helpers';
|
||||||
import { tryParseDeepLink } from './deepLinkParser';
|
import { tryParseDeepLink } from './deepLinkParser';
|
||||||
import { IS_SAFARI } from './windowEnvironment';
|
|
||||||
|
|
||||||
export const processDeepLink = (url: string): boolean => {
|
export const processDeepLink = (url: string): boolean => {
|
||||||
const actions = getActions();
|
const actions = getActions();
|
||||||
@ -54,13 +53,12 @@ export const processDeepLink = (url: string): boolean => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const {
|
const {
|
||||||
protocol, searchParams, pathname, hostname,
|
protocol, searchParams, hostname,
|
||||||
} = new URL(url);
|
} = new URL(url);
|
||||||
|
|
||||||
if (protocol !== 'tg:') return false;
|
if (protocol !== 'tg:') return false;
|
||||||
|
|
||||||
// Safari thinks the path in tg://path links is hostname for some reason
|
const method = hostname as DeepLinkMethod;
|
||||||
const method = (IS_SAFARI ? hostname : pathname).replace(/^\/\//, '') as DeepLinkMethod;
|
|
||||||
const params = Object.fromEntries(searchParams);
|
const params = Object.fromEntries(searchParams);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user