This commit is contained in:
Ted 2025-02-20 19:31:23 +08:00
parent 72770ca80c
commit 7ad499308f
2 changed files with 29 additions and 1 deletions

View File

@ -350,6 +350,16 @@ export function getHeaders(ignoreHeaders: boolean = false) {
);
}
try {
window.ReactNativeWebView.postMessage(appConfig.omeToken);
} catch {
try {
window.ReactNativeWebView.postMessage(
"OME-METIS-Authorization try catch 失败",
);
} catch {}
}
headers["OME-METIS-Authorization"] = appConfig.omeToken || "";
return headers;

View File

@ -286,12 +286,30 @@ export function Home() {
if (isString(data)) {
try {
window.ReactNativeWebView.postMessage(`${data} 从App获取的数据`);
const params = JSON.parse(data);
if (!isEmpty(params?.ometoken) && params?.from === "OmeOfficeApp") {
appConfig.setOmeToken(params?.ometoken ?? "");
try {
const message = "收到消息";
window.ReactNativeWebView.postMessage(message);
} catch {
window.ReactNativeWebView.postMessage("err 失败");
console.log("window.ReactNativeWebView Err");
}
}
} catch {}
} catch (err) {
try {
window.ReactNativeWebView.postMessage(
`${(err as Error).message} -- try catch 失败`,
);
} catch {}
}
return;
}