Refresh own GV2 capability on group create.
This commit is contained in:
parent
a5ad27b5f2
commit
b1fdbc0151
1 changed files with 7 additions and 3 deletions
|
@ -31,6 +31,7 @@ import org.thoughtcrime.securesms.util.views.SimpleProgressDialog;
|
||||||
import org.whispersystems.libsignal.util.guava.Optional;
|
import org.whispersystems.libsignal.util.guava.Optional;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -152,9 +153,12 @@ public class CreateGroupActivity extends ContactSelectionActivity {
|
||||||
|
|
||||||
stopwatch.split("registered");
|
stopwatch.split("registered");
|
||||||
|
|
||||||
|
List<Recipient> recipientsAndSelf = new ArrayList<>(resolved);
|
||||||
|
recipientsAndSelf.add(Recipient.self().resolve());
|
||||||
|
|
||||||
if (FeatureFlags.groupsV2create()) {
|
if (FeatureFlags.groupsV2create()) {
|
||||||
try {
|
try {
|
||||||
GroupsV2CapabilityChecker.refreshCapabilitiesIfNecessary(resolved);
|
GroupsV2CapabilityChecker.refreshCapabilitiesIfNecessary(recipientsAndSelf);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.w(TAG, "Failed to refresh all recipient capabilities.", e);
|
Log.w(TAG, "Failed to refresh all recipient capabilities.", e);
|
||||||
}
|
}
|
||||||
|
@ -164,8 +168,8 @@ public class CreateGroupActivity extends ContactSelectionActivity {
|
||||||
|
|
||||||
resolved = Recipient.resolvedList(ids);
|
resolved = Recipient.resolvedList(ids);
|
||||||
|
|
||||||
if (Stream.of(resolved).anyMatch(r -> r.getGroupsV2Capability() != Recipient.Capability.SUPPORTED) &&
|
boolean gv2 = Stream.of(recipientsAndSelf).allMatch(r -> r.getGroupsV2Capability() == Recipient.Capability.SUPPORTED);
|
||||||
Stream.of(resolved).anyMatch(r -> !r.hasE164()))
|
if (!gv2 && Stream.of(resolved).anyMatch(r -> !r.hasE164()))
|
||||||
{
|
{
|
||||||
Log.w(TAG, "Invalid GV1 group...");
|
Log.w(TAG, "Invalid GV1 group...");
|
||||||
ids = Collections.emptyList();
|
ids = Collections.emptyList();
|
||||||
|
|
Loading…
Add table
Reference in a new issue