feat(mtp): move useful stuff over to mtp directly
All checks were successful
Dependency builds / Build web (pull_request) Has been skipped
Dependency builds / Build desktop (pull_request) Has been skipped
Dependency builds / Test native MTP (pull_request) Has been skipped
Dependency builds / Build mobile (pull_request) Has been skipped
/ build-web (push) Successful in 6m14s
/ build-desktop (linux) (push) Successful in 11m36s
/ build-mobile (push) Successful in 24m26s
/ release (push) Successful in 1m39s

This commit is contained in:
Alois 2026-08-27 23:30:33 +02:00
commit 0a304e44f2
Signed by: alois
SSH key fingerprint: SHA256:GBzT2DXvAuGV9XIV5W3WrzVpjU54FThmxHXdbz95J24
22 changed files with 1217 additions and 1870 deletions

View file

@ -1223,7 +1223,7 @@ export const useCall = create<{
export function useInitializeCall() {
const navigate = useNavigate();
const location = useLocation();
const { send, subscribePush } = useMTP();
const { send, subscribe } = useMTP();
const { load } = useStorage();
const { insertCall } = useSession();
const { get } = useUser();
@ -1313,14 +1313,9 @@ export function useInitializeCall() {
// listen to call invites
useEffect(() => {
return subscribePush(async (message) => {
if (message.type !== "CallInvite") return;
const { CallId, CallSecret, SenderId } = message.data as {
CallId: string;
CallSecret: ProtocolCallSecret;
SenderId: number;
};
return subscribe("CallInvite", async ({ data }) => {
const { CallId, CallSecret, SenderId } = data;
if (!CallId || !CallSecret || !SenderId) return;
if (SenderId === Number(await load("user_id"))) {
return;
@ -1337,7 +1332,7 @@ export function useInitializeCall() {
SenderId,
);
});
}, [load, subscribePush, showCallingScreen]);
}, [load, subscribe, showCallingScreen]);
// get callId from url
useEffect(() => {