diff --git a/src/js/controller/mail-list.js b/src/js/controller/mail-list.js index f4ccfdd..b090553 100644 --- a/src/js/controller/mail-list.js +++ b/src/js/controller/mail-list.js @@ -67,7 +67,22 @@ define(function(require) { emailDao.getBody({ folder: getFolder().path, message: email - }, $scope.onError); + }, function(err) { + if (err) { + $scope.onError(err); + return; + } + + // display fetched body + $scope.$apply(); + + // automatically decrypt if it's the selected email + if (email === $scope.state.mailList.selected) { + emailDao.decryptMessageContent({ + message: email + }, $scope.onError); + } + }); }; /** @@ -115,7 +130,7 @@ define(function(require) { // if we're in the outbox, don't do an imap sync if (getFolder().type === 'Outbox') { updateStatus('Last update: ', new Date()); - displayEmails(outboxBo.pendingEmails); + selectFirstMessage(outboxBo.pendingEmails); return; } @@ -144,7 +159,7 @@ define(function(require) { } // sort emails - displayEmails(getFolder().messages); + selectFirstMessage(getFolder().messages); // display last update updateStatus('Last update: ', new Date()); $scope.$apply(); @@ -221,7 +236,7 @@ define(function(require) { if (!window.chrome || !chrome.identity) { updateStatus('Last update: ', new Date()); getFolder().messages = createDummyMails(); - displayEmails(getFolder().messages); + selectFirstMessage(getFolder().messages); return; } @@ -230,11 +245,14 @@ define(function(require) { // if we're in the outbox, read directly from there. if (getFolder().type === 'Outbox') { updateStatus('Last update: ', new Date()); - displayEmails(outboxBo.pendingEmails); + selectFirstMessage(outboxBo.pendingEmails); return; } - displayEmails(getFolder().messages); + // unselect selection from old folder + $scope.select(); + // display and select first + selectFirstMessage(getFolder().messages); $scope.synchronize(); }); @@ -268,7 +286,7 @@ define(function(require) { $scope.lastUpdate = (time) ? time : ''; } - function displayEmails(emails) { + function selectFirstMessage(emails) { if (!emails || emails.length < 1) { $scope.select(); return; @@ -390,6 +408,7 @@ define(function(require) { this.subject = 'Getting started'; // Subject line this.body = 'Here are a few pointers to help you get started with Whiteout Mail.\n\n# Write encrypted message\n- You can compose a message by clicking on the compose button on the upper right (keyboard shortcut is "n" for a new message or "r" to reply).\n- When typing the recipient\'s email address, secure recipients are marked with a blue label and insecure recipients are red.\n- When sending an email to insecure recipients, the default behavior for Whiteout Mail is to invite them to the service and only send the message content in an encrypted form, once they have joined.\n\n# Advanced features\n- To verify a recipient\'s PGP key, you can hover over the blue label containing their email address and their key fingerprint will be displayed.\n- To view your own key fingerprint, open the account view in the navigation bar on the left. You can compare these with your correspondants over a second channel such as a phonecall.\n\nWe hope this helped you to get started with Whiteout Mail.\n\nYour Whiteout Networks team'; // plaintext body this.encrypted = true; + this.decrypted = true; }; var dummys = [new Email(true, true), new Email(true, false, true, true), new Email(false, true, true), new Email(false, true), new Email(false), new Email(false), new Email(false), new Email(false), new Email(false), new Email(false), new Email(false), new Email(false), new Email(false), new Email(false), new Email(false), new Email(false), new Email(false), new Email(false)]; diff --git a/src/js/util/error.js b/src/js/util/error.js index 71c3e7f..025c4e3 100644 --- a/src/js/util/error.js +++ b/src/js/util/error.js @@ -6,6 +6,7 @@ define(function() { er.attachHandler = function(scope) { scope.$root.onError = function(options) { if (!options) { + scope.$apply(); return; } diff --git a/src/sass/views/_read.scss b/src/sass/views/_read.scss index 6b11241..00c5e12 100644 --- a/src/sass/views/_read.scss +++ b/src/sass/views/_read.scss @@ -85,6 +85,43 @@ height: 100%; overflow-y: scroll; + .working { + margin: 0 auto; + height: 100%; + width: 230px; + display: table; + + .container { + display: table-cell; + vertical-align: middle; + + .spinner { + position: relative; + + div { + position: absolute; + top: 0; + left: 0; + height: 30px; + width: 30px; + animation: rotation .6s linear infinite; + border-left: 5px solid $color-grey-light; + border-right: 5px solid $color-grey-light; + border-bottom: 5px solid $color-grey-light; + border-top: 5px solid $color-grey; + border-radius: 100%; + } + } + + h1 { + margin: 0; + padding-left: 40px; + line-height: 30px; + color: $color-grey-input; + } + } + } + .line { word-wrap: break-word; diff --git a/src/tpl/read.html b/src/tpl/read.html index dd4e40a..d672a45 100644 --- a/src/tpl/read.html +++ b/src/tpl/read.html @@ -35,14 +35,19 @@ - -
-
-
This message contains encrypted content.
-
- -
{{line}}
-
+
+
+ +
{{line}}
+
+
+
+
+ +

Loading...

+

Decrypting...

+
+