1
0
mirror of https://github.com/moparisthebest/mail synced 2024-11-23 01:12:19 -05:00

Fix development mode for ui work

This commit is contained in:
Tankred Hase 2014-05-08 16:25:20 +02:00
parent f903fb2291
commit 4fc4b02c26

View File

@ -17,57 +17,6 @@ define(function(require) {
outboxBo = appController._outboxBo; outboxBo = appController._outboxBo;
emailSync = appController._emailSync; emailSync = appController._emailSync;
emailDao.onNeedsSync = function(error, folder) {
if (error) {
$scope.onError(error);
return;
}
$scope.synchronize({
folder: folder
});
};
emailSync.onIncomingMessage = function(msgs) {
var popupId, popupTitle, popupMessage, unreadMsgs;
unreadMsgs = msgs.filter(function(msg) {
return msg.unread;
});
if (unreadMsgs.length === 0) {
return;
}
popupId = '' + unreadMsgs[0].uid;
if (unreadMsgs.length > 1) {
popupTitle = unreadMsgs.length + ' new messages';
popupMessage = _.pluck(unreadMsgs, 'subject').join('\n');
} else {
popupTitle = unreadMsgs[0].from[0].name || unreadMsgs[0].from[0].address;
popupMessage = unreadMsgs[0].subject;
}
notification.create({
id: popupId,
title: popupTitle,
message: popupMessage
});
};
notification.setOnClickedListener(function(uidString) {
var uid = parseInt(uidString, 10);
if (isNaN(uid)) {
return;
}
$scope.select(_.findWhere(currentFolder().messages, {
uid: uid
}));
});
// //
// scope functions // scope functions
// //
@ -294,6 +243,60 @@ define(function(require) {
function currentFolder() { function currentFolder() {
return $scope.state.nav.currentFolder; return $scope.state.nav.currentFolder;
} }
if (!emailDao || !emailSync) {
return; // development mode
}
emailDao.onNeedsSync = function(error, folder) {
if (error) {
$scope.onError(error);
return;
}
$scope.synchronize({
folder: folder
});
};
emailSync.onIncomingMessage = function(msgs) {
var popupId, popupTitle, popupMessage, unreadMsgs;
unreadMsgs = msgs.filter(function(msg) {
return msg.unread;
});
if (unreadMsgs.length === 0) {
return;
}
popupId = '' + unreadMsgs[0].uid;
if (unreadMsgs.length > 1) {
popupTitle = unreadMsgs.length + ' new messages';
popupMessage = _.pluck(unreadMsgs, 'subject').join('\n');
} else {
popupTitle = unreadMsgs[0].from[0].name || unreadMsgs[0].from[0].address;
popupMessage = unreadMsgs[0].subject;
}
notification.create({
id: popupId,
title: popupTitle,
message: popupMessage
});
};
notification.setOnClickedListener(function(uidString) {
var uid = parseInt(uidString, 10);
if (isNaN(uid)) {
return;
}
$scope.select(_.findWhere(currentFolder().messages, {
uid: uid
}));
});
}; };
function createDummyMails() { function createDummyMails() {
@ -415,6 +418,7 @@ define(function(require) {
'>> from 0.7.0.1\n' + '>> from 0.7.0.1\n' +
'>>\n' + '>>\n' +
'>> God speed!'; // plaintext body '>> God speed!'; // plaintext body
this.html = '<h1>HTML content</h1>';
this.encrypted = true; this.encrypted = true;
this.decrypted = true; this.decrypted = true;
}; };