mirror of
https://github.com/danog/telegram-tt.git
synced 2024-11-27 04:45:08 +01:00
Fix deeplinks in Safari (#1573)
This commit is contained in:
parent
e705375a3f
commit
7d829f8479
@ -1,10 +1,13 @@
|
||||
import { getDispatch } from '../lib/teact/teactn';
|
||||
import { IS_SAFARI } from './environment';
|
||||
|
||||
type DeepLinkMethod = 'resolve' | 'login' | 'passport' | 'settings' | 'join' | 'addstickers' | 'setlanguage' |
|
||||
'addtheme' | 'confirmphone' | 'socks' | 'proxy' | 'privatepost' | 'bg' | 'share' | 'msg' | 'msg_url';
|
||||
|
||||
export const processDeepLink = (url: string) => {
|
||||
const { protocol, searchParams, pathname } = new URL(url);
|
||||
const {
|
||||
protocol, searchParams, pathname, hostname,
|
||||
} = new URL(url);
|
||||
|
||||
if (protocol !== 'tg:') return;
|
||||
|
||||
@ -16,7 +19,8 @@ export const processDeepLink = (url: string) => {
|
||||
joinVoiceChatByLink,
|
||||
} = getDispatch();
|
||||
|
||||
const method = pathname.replace(/^\/\//, '') as DeepLinkMethod;
|
||||
// Safari thinks the path in tg://path links is hostname for some reason
|
||||
const method = (IS_SAFARI ? hostname : pathname).replace(/^\/\//, '') as DeepLinkMethod;
|
||||
const params: Record<string, string> = {};
|
||||
searchParams.forEach((value, key) => {
|
||||
params[key] = value;
|
||||
|
Loading…
Reference in New Issue
Block a user