diff --git a/index.html b/index.html index 0dd070ff40..5937a5768e 100644 --- a/index.html +++ b/index.html @@ -32,6 +32,16 @@
+ + diff --git a/js/libtextsecure.js b/js/libtextsecure.js index 914e511f3f..5c7411683c 100644 --- a/js/libtextsecure.js +++ b/js/libtextsecure.js @@ -8319,6 +8319,34 @@ window.textsecure.messaging = function() { } } + self.updateGroup = function(groupId, name, avatar, numbers) { + var proto = new textsecure.protobuf.PushMessageContent(); + proto.group = new textsecure.protobuf.PushMessageContent.GroupContext(); + + proto.group.id = toArrayBuffer(groupId); + proto.group.type = textsecure.protobuf.PushMessageContent.GroupContext.Type.UPDATE; + proto.group.name = name; + + var numbers = textsecure.storage.groups.addNumbers(groupId, numbers); + if (numbers === undefined) { + return new Promise(function(resolve, reject) { reject(new Error("Unknown Group")); }); + } + proto.group.members = numbers; + + if (avatar !== undefined) { + return makeAttachmentPointer(avatar).then(function(attachment) { + proto.group.avatar = attachment; + return sendGroupProto(numbers, proto).then(function() { + return proto.group.id; + }); + }); + } else { + return sendGroupProto(numbers, proto).then(function() { + return proto.group.id; + }); + } + } + self.addNumberToGroup = function(groupId, number) { var proto = new textsecure.protobuf.PushMessageContent(); proto.group = new textsecure.protobuf.PushMessageContent.GroupContext(); diff --git a/js/views/conversation_view.js b/js/views/conversation_view.js index fff899c0b3..ed07d23777 100644 --- a/js/views/conversation_view.js +++ b/js/views/conversation_view.js @@ -38,13 +38,26 @@ if (this.model.get('type') === 'group') { this.$el.addClass('group'); + this.$el.find('.send-message-area').append($('