2015-09-07 21:53:43 +00:00
|
|
|
/*
|
|
|
|
* vim: ts=4:sw=4:expandtab
|
2015-02-18 02:03:05 +00:00
|
|
|
*/
|
|
|
|
(function () {
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
window.Whisper = window.Whisper || {};
|
|
|
|
|
2015-12-08 23:01:29 +00:00
|
|
|
Whisper.KeyConflictDialogueView = Whisper.View.extend({
|
|
|
|
templateName: 'key-conflict-dialogue',
|
2016-02-17 19:59:20 +00:00
|
|
|
className: 'key-conflict-dialogue clearfix',
|
2015-02-18 02:03:05 +00:00
|
|
|
initialize: function(options) {
|
2016-02-17 19:59:20 +00:00
|
|
|
this.contact = options.contact;
|
2015-02-18 02:03:05 +00:00
|
|
|
this.conversation = options.conversation;
|
2016-03-23 19:33:50 +00:00
|
|
|
textsecure.storage.axolotl.getIdentityKey(textsecure.storage.user.getNumber()).then(function(our_key) {
|
|
|
|
this.your_key = our_key;
|
|
|
|
this.render();
|
|
|
|
}.bind(this));
|
|
|
|
textsecure.storage.axolotl.getIdentityKey(textsecure.storage.user.getNumber()).then(function(our_key) {
|
|
|
|
var view = new Whisper.KeyVerificationView({
|
|
|
|
model: {
|
|
|
|
their_key : this.model.identityKey,
|
|
|
|
your_key : our_key
|
|
|
|
}
|
|
|
|
});
|
|
|
|
view.render().$el.appendTo(this.$('.keys'));
|
|
|
|
}.bind(this));
|
2015-02-18 02:03:05 +00:00
|
|
|
},
|
|
|
|
events: {
|
2016-03-23 19:33:50 +00:00
|
|
|
'click .showKeys': 'showKeys',
|
|
|
|
'click .hideKeys': 'hideKeys',
|
2016-02-17 19:59:20 +00:00
|
|
|
'click .resolve' : 'resolve'
|
2015-02-18 02:03:05 +00:00
|
|
|
},
|
2016-03-23 19:33:50 +00:00
|
|
|
hideKeys: function() {
|
|
|
|
this.$('.keys, .hideKeys').hide();
|
|
|
|
this.$('.showKeys').show();
|
|
|
|
},
|
|
|
|
showKeys: function() {
|
|
|
|
this.$('.keys, .hideKeys').show();
|
|
|
|
this.$('.showKeys').hide();
|
2015-02-18 02:03:05 +00:00
|
|
|
},
|
|
|
|
resolve: function() {
|
|
|
|
this.remove();
|
2015-09-15 18:02:17 +00:00
|
|
|
this.conversation.resolveConflicts(this.model);
|
2015-02-18 02:03:05 +00:00
|
|
|
},
|
2015-12-08 23:01:29 +00:00
|
|
|
render_attributes: function() {
|
2015-12-26 06:47:09 +00:00
|
|
|
return {
|
2016-02-17 19:59:20 +00:00
|
|
|
name : this.contact.getTitle(),
|
|
|
|
avatar : this.contact.getAvatar(),
|
2016-03-23 19:33:50 +00:00
|
|
|
conflict : this.model,
|
2016-02-17 19:59:20 +00:00
|
|
|
newIdentity : i18n('newIdentity'),
|
|
|
|
message : i18n('identityChanged'),
|
|
|
|
resolve : i18n('acceptNewKey'),
|
2016-03-23 19:33:50 +00:00
|
|
|
showKeys : i18n('showMore'),
|
|
|
|
hideKeys : i18n('showLess')
|
2015-12-26 06:47:09 +00:00
|
|
|
};
|
2015-02-18 02:03:05 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
})();
|