INNER CODE UNIT · TypeScript
checkFullCapacity
rgommezz/react-native-chatgpt · src/api/index.ts:312
export function checkFullCapacity() {
const script = `
(() => {
const xpath = "//div[contains(text(),'ChatGPT is at capacity right now')]";
const element = document.evaluate(xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
if (element) {
window.removeThemeSwitcher();
window.ReactNativeWebView.postMessage(JSON.stringify({ type: 'CHAT_GPT_FULL_CAPACITY' }));
}
})();
true;
`;
webview?.injectJavaScript(script);
}
/**
* Refreshes the webview and checks again if the login page is available