mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 12:05:22 +00:00
fix group encoded id
This commit is contained in:
parent
d4781e64a3
commit
2e3f50f8aa
@ -34,6 +34,7 @@ import java.util.Collections;
|
|||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class GroupManager {
|
public class GroupManager {
|
||||||
@ -103,7 +104,7 @@ public class GroupManager {
|
|||||||
final Recipient groupRecipient = Recipient.from(context, Address.Companion.fromSerialized(groupId), false);
|
final Recipient groupRecipient = Recipient.from(context, Address.Companion.fromSerialized(groupId), false);
|
||||||
final Set<Address> memberAddresses = new HashSet<>();
|
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.create(groupId, name, new LinkedList<>(memberAddresses), null, null, new LinkedList<>());
|
||||||
|
|
||||||
groupDatabase.updateProfilePicture(groupId, avatarBytes);
|
groupDatabase.updateProfilePicture(groupId, avatarBytes);
|
||||||
|
@ -1267,7 +1267,7 @@ public class PushDecryptJob extends BaseJob implements InjectableType {
|
|||||||
|
|
||||||
private Recipient getMessageDestination(SignalServiceContent content, SignalServiceDataMessage message) {
|
private Recipient getMessageDestination(SignalServiceContent content, SignalServiceDataMessage message) {
|
||||||
if (message.getGroupInfo().isPresent()) {
|
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 {
|
} else {
|
||||||
return Recipient.from(context, Address.Companion.fromExternal(context, content.getSender()), false);
|
return Recipient.from(context, Address.Companion.fromExternal(context, content.getSender()), false);
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,7 @@ class Address private constructor(address: String) : Parcelable, Comparable<Addr
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
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 {
|
override fun createFromParcel(`in`: Parcel): Address {
|
||||||
return Address(`in`)
|
return Address(`in`)
|
||||||
}
|
}
|
||||||
|
@ -6,9 +6,10 @@ import java.io.IOException
|
|||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
class GroupRecord(
|
class GroupRecord(
|
||||||
val encodedId: String, val title: String, members: String?, val avatar: ByteArray,
|
val encodedId: String, val title: String, members: String?, val avatar: ByteArray?,
|
||||||
val avatarId: Long, val avatarKey: ByteArray, val avatarContentType: String,
|
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 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 members: List<Address> = LinkedList<Address>()
|
||||||
var admins: List<Address> = LinkedList<Address>()
|
var admins: List<Address> = LinkedList<Address>()
|
||||||
|
@ -55,7 +55,7 @@ object GroupUtil {
|
|||||||
fun getEncodedId(group: SignalServiceGroup): String {
|
fun getEncodedId(group: SignalServiceGroup): String {
|
||||||
val groupId = group.groupId
|
val groupId = group.groupId
|
||||||
if (group.groupType == SignalServiceGroup.GroupType.PUBLIC_CHAT) {
|
if (group.groupType == SignalServiceGroup.GroupType.PUBLIC_CHAT) {
|
||||||
return getEncodedOpenGroupID(groupId.toString())
|
return getEncodedOpenGroupID(String(groupId))
|
||||||
}
|
}
|
||||||
return getEncodedClosedGroupID(Hex.toStringCondensed(groupId))
|
return getEncodedClosedGroupID(Hex.toStringCondensed(groupId))
|
||||||
}
|
}
|
||||||
|
@ -916,7 +916,7 @@ object TextSecurePreferences {
|
|||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun hasSeenWelcomeScreen(context: Context): Boolean {
|
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) {
|
fun setHasSeenWelcomeScreen(context: Context, value: Boolean) {
|
||||||
|
Loading…
Reference in New Issue
Block a user