GroupsV2: Register GV2 capabilities properly

This commit is contained in:
Scott Nonnenberg 2020-09-10 15:03:17 -07:00 committed by GitHub
parent cad9803d38
commit 9fae795e8f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View file

@ -1895,9 +1895,9 @@
}
}
const hasRegisteredGroupV2SupportKey = 'hasRegisteredGroupV2Support';
const hasRegisteredGV2Support = 'hasRegisteredGV2Support';
if (
!storage.get(hasRegisteredGroupV2SupportKey) &&
!storage.get(hasRegisteredGV2Support) &&
textsecure.storage.user.getUuid()
) {
const server = WebAPI.connect({
@ -1906,10 +1906,10 @@
});
try {
await server.registerCapabilities({ gv2: true });
storage.put(hasRegisteredGroupV2SupportKey, true);
storage.put(hasRegisteredGV2Support, true);
} catch (error) {
window.log.error(
'Error: Unable to register support for GroupV2.',
'Error: Unable to register support for GV2.',
error && error.stack ? error.stack : error
);
}

View file

@ -775,7 +775,7 @@ export type WebAPIType = {
) => Promise<GroupChangeClass>;
modifyStorageRecords: MessageSender['modifyStorageRecords'];
putAttachment: (encryptedBin: ArrayBuffer) => Promise<any>;
registerCapabilities: (capabilities: any) => Promise<void>;
registerCapabilities: (capabilities: Dictionary<boolean>) => Promise<void>;
putStickers: (
encryptedManifest: ArrayBuffer,
encryptedStickers: Array<ArrayBuffer>,
@ -1128,11 +1128,11 @@ export function initialize({
});
}
async function registerCapabilities(capabilities: any) {
async function registerCapabilities(capabilities: Dictionary<boolean>) {
return _ajax({
call: 'registerCapabilities',
httpType: 'PUT',
jsonData: { capabilities },
jsonData: capabilities,
});
}