Files
discord-decomp/modules/application_account_linking/native/useStartProviderConnection.tsx
T
2026-11-01 12:12:55 +02:00

71 lines
1.7 KiB
TypeScript

// Metro module 5533 (f5534).
import { useCallback } from "react";
import { useProviderConnection } from "../hooks/useProviderConnection";
import Linking from "../../../lib/native/Linking";
let env3401 = {};
export function useStartProviderConnection(a0) {
let env14905 = {
$parent: env3401
};
const providerConnection = useProviderConnection(a0);
const { loading, hasConnection, canConnect, startConnection } = providerConnection;
env14905[0] = startConnection;
const account = providerConnection.account;
let c14906_0 = async (c29520_0) => {
let c29520_4 = 0;
let c31372_0;
L15: {
L14: {
try {
c31372_0 = void 0;
c31372_0 = await (0, env14905[0])(c29520_0);
if (!c31372_0.success) {
break L15;
}
if (c31372_0.url != null) {
c29520_4 = 1;
await Linking.openURL(c31372_0.url);
c29520_4 = 0;
break L14;
}
break L15;
} catch ($e) {
let r7 = $e;
if (c29520_4 !== 0) {
while (true) {
try {
c29520_4 = 0;
} catch ($e) {
r7 = $e;
if (c29520_4 === 0) {
break;
}
continue;
}
return {
success: false
};
}
}
throw r7;
}
}
return {
success: true
};
}
return {
success: false
};
};
return {
loading,
hasConnection,
canConnect,
startConnection: useCallback(function() {
return c14906_0.apply(this, arguments);
}, [startConnection]),
account
};
}