Review invite sending and release to TEST channel

This commit is contained in:
Tankred Hase 2013-11-21 15:36:16 +01:00
parent ab43098fe5
commit e13268625f
5 changed files with 78 additions and 77 deletions

View File

@ -1,22 +1,30 @@
define([], function() {
define(function(require) {
'use strict';
/**
* Create the application namespace
*/
var app = {};
var _ = require('underscore'),
app = {},
cloudUrl, clientId;
// parse manifest to get configurations for current runtime
try {
var manifest = chrome.runtime.getManifest();
cloudUrl = _.find(manifest.permissions, function(permission) {
return typeof permission === 'string' && permission.indexOf('http') === 0;
});
clientId = manifest.oauth2.client_id;
} catch (e) {}
/**
* Global app configurations
*/
app.config = {
cloudUrl: 'https://keys.whiteout.io',
cloudUrl: cloudUrl || 'https://keys.whiteout.io',
symKeySize: 128,
symIvSize: 128,
asymKeySize: 2048,
workerPath: 'js',
gmail: {
clientId: '440907777130.apps.googleusercontent.com',
clientId: clientId || '440907777130.apps.googleusercontent.com',
imap: {
secure: true,
port: 993,
@ -28,7 +36,7 @@ define([], function() {
host: 'smtp.gmail.com'
}
},
checkOutboxInterval: 30000,
checkOutboxInterval: 5000,
iconPath: '/img/icon.png',
verificationUrl: '/verify/'
};

View File

@ -36,6 +36,19 @@ define(function(require) {
$scope.state.nav.toggle(false);
};
$scope.onOutboxUpdate = function(err, count) {
if (err) {
$scope.onError(err);
return;
}
var outbox = _.findWhere($scope.folders, {
type: 'Outbox'
});
outbox.count = count;
$scope.$apply();
};
//
// Start
//
@ -64,7 +77,9 @@ define(function(require) {
});
// start checking outbox periodically
outboxBo.startChecking(onOutboxUpdate);
outboxBo.startChecking($scope.onOutboxUpdate);
// make function available globally for write controller
$scope.emptyOutbox = outboxBo._processOutbox;
callback(folders);
$scope.$apply();
@ -94,22 +109,6 @@ define(function(require) {
path: 'TRASH'
}]);
}
// update outbox count
function onOutboxUpdate(err, count) {
if (err) {
$scope.onError(err);
return;
}
var outbox = _.findWhere($scope.folders, {
type: 'Outbox'
});
outbox.count = count;
$scope.$apply();
}
};
//

View File

@ -146,15 +146,6 @@ define(function(require) {
return;
}
// only allow secure recipients until invitation is implemented
if (!$scope.toKey) {
$scope.onError({
errMsg: 'Invitations not yet supported!',
sync: true
});
return;
}
// remove generated html from body
body = parseBody($scope.body);
@ -184,7 +175,7 @@ define(function(require) {
$scope.state.writer.close();
$scope.$apply();
$scope.emptyOutbox();
$scope.emptyOutbox($scope.onOutboxUpdate);
markAnwsered();
});

View File

@ -35,7 +35,7 @@ define(function() {
return;
}
this._restDao.put(null, uri(options.recipient, options.sender), completed);
this._restDao.put({}, uri(options.recipient, options.sender), completed);
function completed(error, res, status) {
if (error) {
@ -71,7 +71,10 @@ define(function() {
return;
}
this._restDao.get(null, uri(options.recipient, options.sender), completed);
this._restDao.get({
uri: uri(options.recipient, options.sender),
type: 'text'
}, completed);
function completed(error, res, status) {
// 404 is a meaningful return value from the web service

View File

@ -12,7 +12,7 @@
"fileSystem": ["write"]
},
"notifications",
"https://keys.whiteout.io/",
"https://keys-test.whiteout.io",
"identity", {
"socket": [
"tcp-connect:imap.gmail.com:993",