mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-12 07:20:45 +00:00
fix: preserve ios bg refresh plist key and handle web login retry failures
This commit is contained in:
committed by
Nimrod Gutman
parent
8775d34fba
commit
ac0c1c26b1
@@ -100,6 +100,8 @@ targets:
|
||||
UIBackgroundModes:
|
||||
- audio
|
||||
- remote-notification
|
||||
BGTaskSchedulerPermittedIdentifiers:
|
||||
- ai.openclaw.ios.bgrefresh
|
||||
NSLocalNetworkUsageDescription: OpenClaw discovers and connects to your OpenClaw gateway on the local network.
|
||||
NSAppTransportSecurity:
|
||||
NSAllowsArbitraryLoadsInWebContent: true
|
||||
|
||||
@@ -80,6 +80,22 @@ describe("loginWeb coverage", () => {
|
||||
expect(secondSock.ws.close).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("formats retry failure when restart login also closes", async () => {
|
||||
formatErrorMock.mockReturnValueOnce("status=408 Request Time-out QR refs attempts ended");
|
||||
waitForWaConnectionMock
|
||||
.mockRejectedValueOnce({ output: { statusCode: 515 } })
|
||||
.mockRejectedValueOnce({
|
||||
output: {
|
||||
statusCode: 408,
|
||||
payload: { error: "Request Time-out", message: "QR refs attempts ended" },
|
||||
},
|
||||
});
|
||||
|
||||
await expect(loginWeb(false, waitForWaConnectionMock as never)).rejects.toThrow(
|
||||
/status=408 Request Time-out QR refs attempts ended/i,
|
||||
);
|
||||
});
|
||||
|
||||
it("clears creds and throws when logged out", async () => {
|
||||
waitForWaConnectionMock.mockRejectedValueOnce({
|
||||
output: { statusCode: DisconnectReason.loggedOut },
|
||||
|
||||
@@ -45,6 +45,12 @@ export async function loginWeb(
|
||||
await wait(retry);
|
||||
console.log(success("✅ Linked after restart; web session ready."));
|
||||
return;
|
||||
} catch (retryErr) {
|
||||
const formatted = formatError(retryErr);
|
||||
console.error(
|
||||
danger(`WhatsApp Web connection ended after restart before fully opening. ${formatted}`),
|
||||
);
|
||||
throw new Error(formatted, { cause: retryErr });
|
||||
} finally {
|
||||
setTimeout(() => retry.ws?.close(), 500);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user