Add frontend support for expiring releases

When a release expires, it gets a persistent banner notification to
upgrade, and an ephemeral toast warning when trying to send a message.

// FREEBIE
This commit is contained in:
lilia 2016-04-03 20:06:27 -07:00
parent c442a02cb6
commit 9aa429e18a
9 changed files with 104 additions and 8 deletions

View file

@ -6,6 +6,15 @@
window.Whisper = window.Whisper || {};
emoji.init_colons();
Whisper.ExpiredToast = Whisper.ToastView.extend({
templateName: 'expired_toast',
render_attributes: function() {
return {
expiredWarning: i18n('expiredWarning')
};
}
});
Whisper.ConversationView = Whisper.View.extend({
className: function() {
return [ 'conversation', this.model.get('type') ].join(' ');
@ -232,6 +241,12 @@
},
sendMessage: function(e) {
if (extension.expired()) {
var toast = new Whisper.ExpiredToast();
toast.$el.insertAfter(this.$el);
toast.render();
return;
}
e.preventDefault();
var input = this.$messageField;
var message = this.replace_colons(input.val()).trim();

View file

@ -94,14 +94,20 @@
extension.windows.onClosed(function() {
this.inboxListView.stopListening();
}.bind(this));
if (extension.expired()) {
var banner = new Whisper.ExpiredAlertBanner().render();
banner.$el.prependTo(this.$el);
this.$el.addClass('expired');
}
},
render_attributes: {
welcomeToSignal: i18n('welcomeToSignal'),
selectAContact: i18n('selectAContact'),
searchForPeopleOrGroups: i18n('searchForPeopleOrGroups'),
submitDebugLog: i18n('submitDebugLog'),
settings: i18n('settings'),
restartSignal: i18n('restartSignal')
welcomeToSignal : i18n('welcomeToSignal'),
selectAContact : i18n('selectAContact'),
searchForPeopleOrGroups : i18n('searchForPeopleOrGroups'),
submitDebugLog : i18n('submitDebugLog'),
settings : i18n('settings'),
restartSignal : i18n('restartSignal'),
},
events: {
'click': 'closeMenu',
@ -166,4 +172,15 @@
}
});
Whisper.ExpiredAlertBanner = Whisper.View.extend({
templateName: 'expired_alert',
className: 'expiredAlert clearfix',
render_attributes: function() {
return {
expiredWarning: i18n('expiredWarning'),
upgrade: i18n('upgrade'),
};
}
});
})();