INNER CODE UNIT · TypeScript
removeThemeSwitcher
rgommezz/react-native-chatgpt · src/api/index.ts:290
export async function removeThemeSwitcher() {
// Apparently the button is not there yet after the page loads, so we wait a bit
await wait(200);
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();
}
})();
true;
`;
webview?.injectJavaScript(script);
}