Skip to content

Commit

Permalink
Updater
Browse files Browse the repository at this point in the history
  • Loading branch information
Adán Sánchez de Pedro Crespo committed Feb 16, 2014
1 parent 2d6fae0 commit d40bfc2
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 2 deletions.
1 change: 1 addition & 0 deletions l10n/en.ini
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ CodeNotValid=Could not validate
CodeReason_stale=Code is out of date
CodeReason_bad_param=Code format is not correct
ReConfirmCode=I have a code
Upgrading=Upgrading

# CONNECTION STATUSES
Connecting=Connecting
Expand Down
1 change: 1 addition & 0 deletions l10n/es.ini
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ CodeNotValid=No se pudo comprobar
CodeReason_stale=El código ha caducado
CodeReason_bad_param=El formato del código no es correcto
ReConfirmCode=Tengo un codigo
Upgrading=Actualizando

# CONNECTION STATUSES=
Connecting=Conectando
Expand Down
1 change: 0 additions & 1 deletion scripts/loqui/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,6 @@ var Account = function (core) {
rcb();
}
});
Lungo.Notification.show('download', _('Synchronizing'), 10);
};
searchForm.bind('keyup', searchFormOnKeyUp);
clear.bind('click', clearOnClick);
Expand Down
20 changes: 20 additions & 0 deletions scripts/loqui/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ var App = {
// Load settings and data from storage
App.load(function () {
// Log in or show wizard
App.upgrade();
App.start();
});
},
Expand Down Expand Up @@ -112,6 +113,25 @@ var App = {
});
},

// Perform special processes if upgrading from older version
upgrade: function () {
var last = localStorage.getItem('version') || 'v0.2.5';
var from = {
'v0.2.5': function () {
for (var key in App.accounts) {
var account = App.accounts[key];
account.core.roster = [];
account.save();
}
}
};
if (last < App.version) {
Lungo.Notification.show('forward', _('Upgrading'), 10);
from[last]();
localStorage.setItem('version', App.version);
}
},

// Bootstrap logins and so on
start: function () {
// If there is already a configured account
Expand Down
3 changes: 2 additions & 1 deletion scripts/loqui/connectors/coseme.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 comment on commit d40bfc2

@aesedepece
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This allow us to run specific code for upgrading variables and stores from an old version to a newer one.

Please sign in to comment.