signal-desktop/js/views/key_conflict_dialogue_view.js
lilia 645e05c2b9 Add support for new fingerprint format
This will be ready to roll whenever Android/iOS is.

// FREEBIE
2016-08-24 01:50:46 -07:00

61 lines
2.1 KiB
JavaScript

/*
* vim: ts=4:sw=4:expandtab
*/
(function () {
'use strict';
window.Whisper = window.Whisper || {};
Whisper.KeyConflictDialogueView = Whisper.View.extend({
templateName: 'key-conflict-dialogue',
className: 'key-conflict-dialogue clearfix',
initialize: function(options) {
this.contact = options.contact;
this.conversation = options.conversation;
var our_number = textsecure.storage.user.getNumber();
textsecure.storage.protocol.loadIdentityKey(our_number).then(function(our_key) {
this.your_key = our_key;
this.render();
var view = new Whisper.KeyVerificationView({
model: {
your_number: our_number,
their_number: this.model.number,
their_key : this.model.identityKey,
your_key : our_key
}
});
view.$el.appendTo(this.$('.keys'));
}.bind(this));
},
events: {
'click .showKeys': 'showKeys',
'click .hideKeys': 'hideKeys',
'click .resolve' : 'resolve'
},
hideKeys: function() {
this.$('.keys, .hideKeys').hide();
this.$('.showKeys').show();
},
showKeys: function() {
this.$('.keys, .hideKeys').show();
this.$('.showKeys').hide();
},
resolve: function() {
this.remove();
this.conversation.resolveConflicts(this.model);
},
render_attributes: function() {
return {
name : this.contact.getTitle(),
avatar : this.contact.getAvatar(),
conflict : this.model,
newIdentity : i18n('newIdentity'),
message : i18n('identityChanged'),
resolve : i18n('acceptNewKey'),
showKeys : i18n('showMore'),
hideKeys : i18n('showLess'),
learnMore : i18n('learnMore')
};
}
});
})();