mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-24 20:26:24 +00:00
Support device name change sync message
This commit is contained in:
@@ -862,6 +862,19 @@ export type GetAccountForUsernameResultType = z.infer<
|
||||
typeof getAccountForUsernameResultZod
|
||||
>;
|
||||
|
||||
const getDevicesResultZod = z.object({
|
||||
devices: z.array(
|
||||
z.object({
|
||||
id: z.number(),
|
||||
name: z.string().nullish(), // primary devices may not have a name
|
||||
lastSeen: z.number().nullish(),
|
||||
created: z.number().nullish(),
|
||||
})
|
||||
),
|
||||
});
|
||||
|
||||
export type GetDevicesResultType = z.infer<typeof getDevicesResultZod>;
|
||||
|
||||
export type GetIceServersResultType = Readonly<{
|
||||
relays?: ReadonlyArray<IceServerGroupType>;
|
||||
}>;
|
||||
@@ -874,15 +887,6 @@ export type IceServerGroupType = Readonly<{
|
||||
hostname?: string;
|
||||
}>;
|
||||
|
||||
export type GetDevicesResultType = ReadonlyArray<
|
||||
Readonly<{
|
||||
id: number;
|
||||
name: string;
|
||||
lastSeen: number;
|
||||
created: number;
|
||||
}>
|
||||
>;
|
||||
|
||||
export type GetSenderCertificateResultType = Readonly<{ certificate: string }>;
|
||||
|
||||
export type MakeProxiedRequestResultType =
|
||||
@@ -1376,6 +1380,7 @@ export type WebAPIType = {
|
||||
getAccountForUsername: (
|
||||
options: GetAccountForUsernameOptionsType
|
||||
) => Promise<GetAccountForUsernameResultType>;
|
||||
getDevices: () => Promise<GetDevicesResultType>;
|
||||
getProfileUnauth: (
|
||||
serviceId: ServiceIdString,
|
||||
options: ProfileFetchUnauthRequestOptions
|
||||
@@ -1847,6 +1852,7 @@ export function initialize({
|
||||
getBackupUploadForm,
|
||||
getBadgeImageFile,
|
||||
getConfig,
|
||||
getDevices,
|
||||
getGroup,
|
||||
getGroupAvatar,
|
||||
getGroupCredentials,
|
||||
@@ -2935,6 +2941,15 @@ export function initialize({
|
||||
});
|
||||
}
|
||||
|
||||
async function getDevices() {
|
||||
const result = await _ajax({
|
||||
call: 'devices',
|
||||
httpType: 'GET',
|
||||
responseType: 'json',
|
||||
});
|
||||
return parseUnknown(getDevicesResultZod, result);
|
||||
}
|
||||
|
||||
async function updateDeviceName(deviceName: string) {
|
||||
await _ajax({
|
||||
call: 'updateDeviceName',
|
||||
|
||||
Reference in New Issue
Block a user