GroupsV2: Register GV2 capabilities properly
This commit is contained in:
parent
cad9803d38
commit
9fae795e8f
2 changed files with 7 additions and 7 deletions
|
@ -1895,9 +1895,9 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const hasRegisteredGroupV2SupportKey = 'hasRegisteredGroupV2Support';
|
const hasRegisteredGV2Support = 'hasRegisteredGV2Support';
|
||||||
if (
|
if (
|
||||||
!storage.get(hasRegisteredGroupV2SupportKey) &&
|
!storage.get(hasRegisteredGV2Support) &&
|
||||||
textsecure.storage.user.getUuid()
|
textsecure.storage.user.getUuid()
|
||||||
) {
|
) {
|
||||||
const server = WebAPI.connect({
|
const server = WebAPI.connect({
|
||||||
|
@ -1906,10 +1906,10 @@
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await server.registerCapabilities({ gv2: true });
|
await server.registerCapabilities({ gv2: true });
|
||||||
storage.put(hasRegisteredGroupV2SupportKey, true);
|
storage.put(hasRegisteredGV2Support, true);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
window.log.error(
|
window.log.error(
|
||||||
'Error: Unable to register support for GroupV2.',
|
'Error: Unable to register support for GV2.',
|
||||||
error && error.stack ? error.stack : error
|
error && error.stack ? error.stack : error
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -775,7 +775,7 @@ export type WebAPIType = {
|
||||||
) => Promise<GroupChangeClass>;
|
) => Promise<GroupChangeClass>;
|
||||||
modifyStorageRecords: MessageSender['modifyStorageRecords'];
|
modifyStorageRecords: MessageSender['modifyStorageRecords'];
|
||||||
putAttachment: (encryptedBin: ArrayBuffer) => Promise<any>;
|
putAttachment: (encryptedBin: ArrayBuffer) => Promise<any>;
|
||||||
registerCapabilities: (capabilities: any) => Promise<void>;
|
registerCapabilities: (capabilities: Dictionary<boolean>) => Promise<void>;
|
||||||
putStickers: (
|
putStickers: (
|
||||||
encryptedManifest: ArrayBuffer,
|
encryptedManifest: ArrayBuffer,
|
||||||
encryptedStickers: Array<ArrayBuffer>,
|
encryptedStickers: Array<ArrayBuffer>,
|
||||||
|
@ -1128,11 +1128,11 @@ export function initialize({
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function registerCapabilities(capabilities: any) {
|
async function registerCapabilities(capabilities: Dictionary<boolean>) {
|
||||||
return _ajax({
|
return _ajax({
|
||||||
call: 'registerCapabilities',
|
call: 'registerCapabilities',
|
||||||
httpType: 'PUT',
|
httpType: 'PUT',
|
||||||
jsonData: { capabilities },
|
jsonData: capabilities,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue