Display info in network status when unlinked

When we can't connect due to being unlinked, network status indicator
will show an appropriate informational message and a button to open the
installer window to relink.

// FREEBIE
This commit is contained in:
lilia 2017-04-12 16:46:51 -07:00
parent 587e5265c5
commit d3492960a6
5 changed files with 45 additions and 1 deletions

View file

@ -519,5 +519,14 @@
"invalidNumberError": { "invalidNumberError": {
"message": "Invalid number", "message": "Invalid number",
"description": "When a person inputs a number that is invalid" "description": "When a person inputs a number that is invalid"
},
"unlinkedWarning": {
"message": "Relink Signal Desktop to your mobile device to continue messaging."
},
"unlinked": {
"message": "Unlinked"
},
"relink": {
"message": "Relink"
} }
} }

View file

@ -501,6 +501,11 @@
{{ attemptingReconnectionMessage }} {{ attemptingReconnectionMessage }}
</div> </div>
{{/reconnectDurationAsSeconds }} {{/reconnectDurationAsSeconds }}
{{ #action }}
<div class="action">
<button class='small blue {{ buttonClass }}'>{{ action }}</button>
</div>
{{/action }}
</script> </script>
<script type='text/javascript' src='js/components.js'></script> <script type='text/javascript' src='js/components.js'></script>

View file

@ -23,6 +23,9 @@
this.model = new Backbone.Model(); this.model = new Backbone.Model();
this.listenTo(this.model, 'change', this.onChange); this.listenTo(this.model, 'change', this.onChange);
}, },
events: {
'click .openInstaller': extension.install
},
finishConnectingGracePeriod: function() { finishConnectingGracePeriod: function() {
this.withinConnectingGracePeriod = false; this.withinConnectingGracePeriod = false;
}, },
@ -36,6 +39,8 @@
var message = ''; var message = '';
var instructions = ''; var instructions = '';
var hasInterruption = false; var hasInterruption = false;
var action = null;
var buttonClass = null;
var socketStatus = this.getSocketStatus(); var socketStatus = this.getSocketStatus();
switch(socketStatus) { switch(socketStatus) {
@ -68,12 +73,20 @@
hasInterruption = true; hasInterruption = true;
message = i18n('offline'); message = i18n('offline');
instructions = i18n('checkNetworkConnection'); instructions = i18n('checkNetworkConnection');
} else if (!Whisper.Registration.isDone()) {
hasInterruption = true;
message = i18n('Unlinked');
instructions = i18n('unlinkedWarning');
action = i18n('relink');
buttonClass = 'openInstaller';
} }
return { return {
message: message, message: message,
instructions: instructions, instructions: instructions,
hasInterruption: hasInterruption hasInterruption: hasInterruption,
action: action,
buttonClass: buttonClass
}; };
}, },
update: function() { update: function() {

View file

@ -49,6 +49,16 @@
padding: 0.5em 0; padding: 0.5em 0;
} }
} }
.action {
button {
border-radius: $border-radius;
border: solid 1px #ccc;
cursor: pointer;
font-family: inherit;
color: white;
background: $blue;
}
}
} }
} }

View file

@ -763,6 +763,13 @@ img.emoji {
display: inline-block; display: inline-block;
font-size: 12px; font-size: 12px;
padding: 0.5em 0; } padding: 0.5em 0; }
.network-status-container .network-status .action button {
border-radius: 5px;
border: solid 1px #ccc;
cursor: pointer;
font-family: inherit;
color: white;
background: #2090ea; }
.conversation-stack { .conversation-stack {
padding-left: 300px; } padding-left: 300px; }