Search in sources :

Example 11 with GroupDatabase

use of org.thoughtcrime.securesms.database.GroupDatabase in project Signal-Android by WhisperSystems.

the class GroupManager method updateGroup.

public static GroupActionResult updateGroup(@NonNull Context context, @NonNull MasterSecret masterSecret, @NonNull byte[] groupId, @NonNull Set<Recipient> members, @Nullable Bitmap avatar, @Nullable String name) throws InvalidNumberException {
    final GroupDatabase groupDatabase = DatabaseFactory.getGroupDatabase(context);
    final Set<String> memberE164Numbers = getE164Numbers(context, members);
    final byte[] avatarBytes = BitmapUtil.toByteArray(avatar);
    memberE164Numbers.add(TextSecurePreferences.getLocalNumber(context));
    groupDatabase.updateMembers(groupId, new LinkedList<>(memberE164Numbers));
    groupDatabase.updateTitle(groupId, name);
    groupDatabase.updateAvatar(groupId, avatarBytes);
    return sendGroupUpdate(context, masterSecret, groupId, memberE164Numbers, name, avatarBytes);
}
Also used : GroupDatabase(org.thoughtcrime.securesms.database.GroupDatabase) ByteString(com.google.protobuf.ByteString)

Aggregations

GroupDatabase (org.thoughtcrime.securesms.database.GroupDatabase)11 ByteString (com.google.protobuf.ByteString)4 Nullable (android.support.annotation.Nullable)3 SignalServiceAttachment (org.whispersystems.signalservice.api.messages.SignalServiceAttachment)3 SignalServiceGroup (org.whispersystems.signalservice.api.messages.SignalServiceGroup)3 GroupContext (org.whispersystems.signalservice.internal.push.SignalServiceProtos.GroupContext)3 GroupRecord (org.thoughtcrime.securesms.database.GroupDatabase.GroupRecord)2 InvalidMessageException (org.whispersystems.libsignal.InvalidMessageException)2 SignalServiceDataMessage (org.whispersystems.signalservice.api.messages.SignalServiceDataMessage)2 SignalServiceAddress (org.whispersystems.signalservice.api.push.SignalServiceAddress)2 Bitmap (android.graphics.Bitmap)1 NonNull (android.support.annotation.NonNull)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 File (java.io.File)1 InputStream (java.io.InputStream)1 HashSet (java.util.HashSet)1 SignalProtocolStoreImpl (org.thoughtcrime.securesms.crypto.storage.SignalProtocolStoreImpl)1 SmsDatabase (org.thoughtcrime.securesms.database.SmsDatabase)1 ThreadDatabase (org.thoughtcrime.securesms.database.ThreadDatabase)1 AttachmentModel (org.thoughtcrime.securesms.mms.AttachmentStreamUriLoader.AttachmentModel)1