From 1b21191c3c2d856a8193a45d49d2b20e5aa25129 Mon Sep 17 00:00:00 2001 From: Vincent Date: Mon, 13 Jul 2020 10:37:43 +1000 Subject: [PATCH] multideviceprotocol-usage --- ts/receiver/receiver.ts | 1 - ts/session/types/ClosedGroup.ts | 8 +++++++- ts/util/user.ts | 9 --------- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/ts/receiver/receiver.ts b/ts/receiver/receiver.ts index 911b78516..9cea77c21 100644 --- a/ts/receiver/receiver.ts +++ b/ts/receiver/receiver.ts @@ -14,7 +14,6 @@ import { onError } from './errors'; import { handleContentMessage, innerHandleContentMessage, - isBlocked, onDeliveryReceipt, } from './contentMessage'; import _ from 'lodash'; diff --git a/ts/session/types/ClosedGroup.ts b/ts/session/types/ClosedGroup.ts index 0eddf992b..711cca5af 100644 --- a/ts/session/types/ClosedGroup.ts +++ b/ts/session/types/ClosedGroup.ts @@ -4,6 +4,7 @@ import { PubKey } from '.'; import { UserUtil } from '../../util'; +import { MultiDeviceProtocol } from '../protocols'; enum ClosedGroupType { SMALL, @@ -44,7 +45,12 @@ class ClosedGroup { console.warn(`ClosedGroup create: Cannot create a small group with more than ${window.CONSTANTS.SMALL_GROUP_SIZE_LIMIT} members`); } - const primaryDevice = UserUtil.getCurrentPrimaryDevicePubKey(); + const user = await UserUtil.getCurrentDevicePubKey(); + if (!user) { + return; + } + + const primaryDevice = await MultiDeviceProtocol.getPrimaryDevice(user); const allMembers = [primaryDevice, ...members]; // Create Group Identity diff --git a/ts/util/user.ts b/ts/util/user.ts index bacaefb69..cea991b17 100644 --- a/ts/util/user.ts +++ b/ts/util/user.ts @@ -10,15 +10,6 @@ export async function getCurrentDevicePubKey(): Promise { return item.value.split('.')[0]; } -export async function getCurrentPrimaryDevicePubKey(): Promise { - const item = await getItemById('primaryDevicePubKey'); - if (!item || !item.value) { - return undefined; - } - - return item.value; -} - export async function getIdentityKeyPair(): Promise { const item = await getItemById('identityKey');