That fuck shit the fascists are using
at master 58 lines 1.8 kB view raw
1package org.tm.archive.groups; 2 3import androidx.annotation.NonNull; 4import androidx.annotation.Nullable; 5 6import org.tm.archive.recipients.RecipientId; 7import org.tm.archive.util.Util; 8 9import java.util.Collections; 10import java.util.List; 11 12/** 13 * Describes a change in membership that results from a GV1->GV2 migration. 14 */ 15public final class GroupMigrationMembershipChange { 16 private final List<RecipientId> pending; 17 private final List<RecipientId> dropped; 18 19 public GroupMigrationMembershipChange(@NonNull List<RecipientId> pending, @NonNull List<RecipientId> dropped) { 20 this.pending = pending; 21 this.dropped = dropped; 22 } 23 24 public static GroupMigrationMembershipChange empty() { 25 return new GroupMigrationMembershipChange(Collections.emptyList(), Collections.emptyList()); 26 } 27 28 public static @NonNull GroupMigrationMembershipChange deserialize(@Nullable String serialized) { 29 if (Util.isEmpty(serialized)) { 30 return empty(); 31 } else { 32 String[] parts = serialized.split("\\|"); 33 if (parts.length == 1) { 34 return new GroupMigrationMembershipChange(RecipientId.fromSerializedList(parts[0]), Collections.emptyList()); 35 } else if (parts.length == 2) { 36 return new GroupMigrationMembershipChange(RecipientId.fromSerializedList(parts[0]), RecipientId.fromSerializedList(parts[1])); 37 } else { 38 return GroupMigrationMembershipChange.empty(); 39 } 40 } 41 } 42 43 public @NonNull List<RecipientId> getPending() { 44 return pending; 45 } 46 47 public @NonNull List<RecipientId> getDropped() { 48 return dropped; 49 } 50 51 public @NonNull String serialize() { 52 return RecipientId.toSerializedList(pending) + "|" + RecipientId.toSerializedList(dropped); 53 } 54 55 public boolean isEmpty() { 56 return pending.isEmpty() && dropped.isEmpty(); 57 } 58}