Add a prompt to launch Element X on mobile

This shows a bottom sheet on mobile asking the user whether they want to open the call in Element X, as soon as the page is loaded.
This commit is contained in:
Robin
2023-09-17 17:48:03 -04:00
parent f609ec3f4c
commit 0f97d655d2
5 changed files with 161 additions and 22 deletions

View File

@@ -94,6 +94,22 @@ interface UrlParams {
password: string | null;
}
export function editFragmentQuery(
hash: string,
edit: (params: URLSearchParams) => URLSearchParams
): string {
const fragmentQueryStart = hash.indexOf("?");
const fragmentParams = edit(
new URLSearchParams(
fragmentQueryStart === -1 ? "" : hash.substring(fragmentQueryStart)
)
);
return `${hash.substring(
0,
fragmentQueryStart
)}?${fragmentParams.toString()}`;
}
/**
* Gets the app parameters for the current URL.
* @param ignoreRoomAlias If true, does not try to parse a room alias from the URL