fix group encoded id

This commit is contained in:
Ryan ZHAO 2021-01-22 16:15:13 +11:00
parent d4781e64a3
commit 2e3f50f8aa
6 changed files with 10 additions and 8 deletions

View File

@ -34,6 +34,7 @@ import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Objects;
import java.util.Set;
public class GroupManager {
@ -103,7 +104,7 @@ public class GroupManager {
final Recipient groupRecipient = Recipient.from(context, Address.Companion.fromSerialized(groupId), false);
final Set<Address> memberAddresses = new HashSet<>();
memberAddresses.add(Address.Companion.fromSerialized(TextSecurePreferences.getLocalNumber(context)));
memberAddresses.add(Address.Companion.fromSerialized(Objects.requireNonNull(TextSecurePreferences.getLocalNumber(context))));
groupDatabase.create(groupId, name, new LinkedList<>(memberAddresses), null, null, new LinkedList<>());
groupDatabase.updateProfilePicture(groupId, avatarBytes);

View File

@ -1267,7 +1267,7 @@ public class PushDecryptJob extends BaseJob implements InjectableType {
private Recipient getMessageDestination(SignalServiceContent content, SignalServiceDataMessage message) {
if (message.getGroupInfo().isPresent()) {
return Recipient.from(context, Address.Companion.fromExternal(context, GroupUtil.getEncodedClosedGroupID(message.getGroupInfo().get().getGroupId())), false);
return Recipient.from(context, Address.Companion.fromExternal(context, GroupUtil.getEncodedId(message.getGroupInfo().get())), false);
} else {
return Recipient.from(context, Address.Companion.fromExternal(context, content.getSender()), false);
}

View File

@ -142,7 +142,7 @@ class Address private constructor(address: String) : Parcelable, Comparable<Addr
}
companion object {
val CREATOR: Parcelable.Creator<Address?> = object : Parcelable.Creator<Address?> {
@JvmField val CREATOR: Parcelable.Creator<Address?> = object : Parcelable.Creator<Address?> {
override fun createFromParcel(`in`: Parcel): Address {
return Address(`in`)
}

View File

@ -6,9 +6,10 @@ import java.io.IOException
import java.util.*
class GroupRecord(
val encodedId: String, val title: String, members: String?, val avatar: ByteArray,
val avatarId: Long, val avatarKey: ByteArray, val avatarContentType: String,
val relay: String, val isActive: Boolean, val avatarDigest: ByteArray, val isMms: Boolean, val url: String, admins: String?, val createAt: Long
val encodedId: String, val title: String, members: String?, val avatar: ByteArray?,
val avatarId: Long?, val avatarKey: ByteArray?, val avatarContentType: String?,
val relay: String?, val isActive: Boolean, val avatarDigest: ByteArray?, val isMms: Boolean,
val url: String?, admins: String?, val createAt: Long
) {
var members: List<Address> = LinkedList<Address>()
var admins: List<Address> = LinkedList<Address>()

View File

@ -55,7 +55,7 @@ object GroupUtil {
fun getEncodedId(group: SignalServiceGroup): String {
val groupId = group.groupId
if (group.groupType == SignalServiceGroup.GroupType.PUBLIC_CHAT) {
return getEncodedOpenGroupID(groupId.toString())
return getEncodedOpenGroupID(String(groupId))
}
return getEncodedClosedGroupID(Hex.toStringCondensed(groupId))
}

View File

@ -916,7 +916,7 @@ object TextSecurePreferences {
@JvmStatic
fun hasSeenWelcomeScreen(context: Context): Boolean {
return getBooleanPreference(context, SEEN_WELCOME_SCREEN_PREF, true)
return getBooleanPreference(context, SEEN_WELCOME_SCREEN_PREF, false)
}
fun setHasSeenWelcomeScreen(context: Context, value: Boolean) {