Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Allow OFXPlayer to use the same download mechanism as Player.

  • Loading branch information...
commit d9b08340bc9439daa69d5109e4788f2d4c5181d9 1 parent f23469b
Brian Donovan authored eventualbuddha committed
View
5 application/chrome/content/main.js
@@ -73,9 +73,8 @@ function init() {
var contentListener = wesabe.io.ContentListener.sharedInstance;
contentListener.init(window, "application/x-wes-ofx");
- wesabe.bind(contentListener, 'after-receive', function() {
- wesabe.trigger('downloadSuccess');
- s.onStatementReceived.apply(s, arguments);
+ wesabe.bind(contentListener, 'after-receive', function(event, data) {
+ wesabe.trigger('downloadSuccess', [data]);
});
});
}
View
6 application/chrome/content/wesabe/download/Controller.js
@@ -369,8 +369,8 @@ wesabe.download.Controller = function() {
return {response: {status: 'ok'}};
};
- this.onStatementReceived = function(event, data) {
- wesabe.tryThrow('Controller#onStatementReceived', function(log) {
+ wesabe.bind('downloadSuccess', function(event, data) {
+ wesabe.tryThrow('Controller#downloadSuccess', function(log) {
var folder = wesabe.io.dir.profile;
folder.append('statements');
if (!folder.exists())
@@ -381,5 +381,5 @@ wesabe.download.Controller = function() {
wesabe.io.file.write(statement, data);
});
- }
+ });
};
View
31 application/chrome/content/wesabe/download/OFXPlayer.js
@@ -202,22 +202,16 @@ wesabe.download.OFXPlayer.prototype.onOFXError = function(response, callback) {
};
/**
- * Handles an OFX response containing a statement to be uploaded to PFC.
+ * Handles an OFX response containing a statement to be imported.
*/
wesabe.download.OFXPlayer.prototype.onDownloadComplete = function(response) {
- var statement = response.statement, self = this;
- var uploader = new wesabe.api.Uploader(statement, this.fid, null, this.job);
+ wesabe.trigger('downloadSuccess', [response.statement]);
- // get notified when the upload is done
- wesabe.bind(uploader, 'uploadComplete', function() {
- self.job.timer.end('Upload');
- self.onUploadComplete();
- });
- // tell anyone who cares that we're uploading accounts
- this.job.update('account.upload');
- this.job.timer.start('Upload');
- // actually start uploading
- uploader.upload();
+ // done with this account
+ this.account.completed = true;
+ delete this.account;
+ // now do the rest
+ this.processAccounts();
};
/**
@@ -243,17 +237,6 @@ wesabe.download.OFXPlayer.prototype.onDownloadFailure = function(response) {
};
/**
- * Called when the upload to PFC finishes, successful or otherwise.
- */
-wesabe.download.OFXPlayer.prototype.onUploadComplete = function() {
- // done with this account
- this.account.completed = true;
- delete this.account;
- // now do the rest
- this.processAccounts();
-};
-
-/**
* Returns a new Request instance ready to be used.
*/
wesabe.download.OFXPlayer.prototype.buildRequest = function() {
Please sign in to comment.
Something went wrong with that request. Please try again.