Don't unnecessarily create threads for groups.

This commit is contained in:
Greyson Parrelli 2021-07-30 12:27:28 -04:00 committed by GitHub
parent fb8f481a87
commit 7c8549bf5e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -287,8 +287,9 @@ public final class SignalCallManager implements CallManager.Observer, GroupCall.
.toList();
callManager.peekGroupCall(SignalStore.internalValues().groupCallingServer(), credential.getTokenBytes().toByteArray(), members, peekInfo -> {
long threadId = DatabaseFactory.getThreadDatabase(context).getOrCreateThreadIdFor(group);
Long threadId = DatabaseFactory.getThreadDatabase(context).getThreadIdFor(group.getId());
if (threadId != null) {
DatabaseFactory.getSmsDatabase(context)
.updatePreviousGroupCall(threadId,
peekInfo.getEraId(),
@ -298,6 +299,7 @@ public final class SignalCallManager implements CallManager.Observer, GroupCall.
ApplicationDependencies.getMessageNotifier().updateNotification(context, threadId, true, 0, BubbleUtil.BubbleState.HIDDEN);
EventBus.getDefault().postSticky(new GroupCallPeekEvent(id, peekInfo.getEraId(), peekInfo.getDeviceCount(), peekInfo.getMaxDevices()));
}
});
} catch (IOException | VerificationFailedException | CallException e) {
Log.e(TAG, "error peeking from active conversation", e);