Smoother group create experience
Previously there was a long pause between confirming the group details and opening the conversation. Fix by first saving/opening the conversation, rather than waiting for the initial group update to finish transmitting.
This commit is contained in:
parent
74e01c2a95
commit
caddb8dc09
1 changed files with 16 additions and 11 deletions
|
@ -112,22 +112,27 @@
|
|||
return;
|
||||
}
|
||||
|
||||
return this.avatarInput.getFiles().then(function(avatarFiles) {
|
||||
return this.avatarInput.getFile().then(function(avatarFile) {
|
||||
var members = this.getRecipients().pluck('id');
|
||||
var groupId = textsecure.storage.groups.createNewGroup(members).id;
|
||||
var attributes = {
|
||||
id: groupId,
|
||||
groupId: groupId,
|
||||
type: 'group',
|
||||
name: name,
|
||||
avatar: avatarFiles[0],
|
||||
members: this.getRecipients().pluck('id')
|
||||
avatar: avatarFile,
|
||||
members: members
|
||||
};
|
||||
return textsecure.messaging.createGroup(
|
||||
attributes.members, attributes.name, attributes.avatar
|
||||
).then(function(groupId) {
|
||||
var id = getString(groupId);
|
||||
var group = new Whisper.Conversation(attributes);
|
||||
group.save({ id: id, groupId: id }).then(function() {
|
||||
this.trigger('open', {modelId: id});
|
||||
}.bind(this));
|
||||
group.save().then(function() {
|
||||
this.trigger('open', {modelId: groupId});
|
||||
}.bind(this));
|
||||
textsecure.messaging.updateGroup(
|
||||
group.id,
|
||||
group.get('name'),
|
||||
group.get('avatar'),
|
||||
group.get('members')
|
||||
);
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in a new issue