Support idle primary device warning alert from server

This commit is contained in:
trevor-signal
2025-03-14 10:23:47 -04:00
committed by GitHub
parent de19bb07fa
commit 7c0cbb58ef
25 changed files with 520 additions and 183 deletions

View File

@@ -58,8 +58,10 @@ import { AbortableProcess } from '../util/AbortableProcess';
import type { WebAPICredentials } from './Types';
import { NORMAL_DISCONNECT_CODE } from './SocketManager';
import { parseUnknown } from '../util/schemas';
import type { ServerAlert } from '../state/ducks/server';
import { parseServerAlertFromHeader } from '../state/ducks/server';
import {
parseServerAlertsFromHeader,
type ServerAlert,
} from '../util/handleServerAlerts';
const THIRTY_SECONDS = 30 * durations.SECOND;
@@ -396,9 +398,7 @@ export function connectAuthenticatedLibsignal({
this.resource = undefined;
},
onReceivedAlerts(alerts: Array<string>): void {
onReceivedAlerts(
alerts.map(parseServerAlertFromHeader).filter(v => v !== undefined)
);
onReceivedAlerts(alerts.map(parseServerAlertsFromHeader).flat());
},
};
return connectLibsignal(