Publish Vulpes Preview 15 sources for desktop, Android and Tundra

Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
OverSu 2026-09-30 23:13:03 +02:00
commit b38dea0597
25901 changed files with 9982925 additions and 369 deletions

View file

@ -0,0 +1,72 @@
define(function(require, exports, module) {
'use strict';
var Authentication = require('common/error').Authentication;
var InvalidServer = require('common/error').InvalidServer;
var Responder = require('common/responder');
var nextTick = require('common/next_tick');
var notification = require('notification');
/**
* Global error handler / default handling for errors.
*/
function ErrorController() {
Responder.call(this);
this._handlers = Object.create(null);
}
module.exports = ErrorController;
ErrorController.prototype = {
__proto__: Responder.prototype,
/**
* URL in which account errors are dispatched to.
*/
accountErrorUrl: '/update-account/',
/**
* Dispatch an error event.
*
* If this type of event has been captured will be dispatched directly to
* the callback provided. Otherwise the default behaviour will be triggered.
*
* @param {Calendar.Error} error to dispatch.
*/
dispatch: function(error) {
if (error instanceof Authentication || error instanceof InvalidServer) {
this.handleAuthenticate(error.detail.account);
}
this.emit('error', error);
},
/**
* Default handler for authentication errors.
*
* @param {Object} account to notify user about.
* @param {Function} [callback] optional callback.
*/
handleAuthenticate: function(account, callback) {
if (!account) {
return console.error('attempting to trigger reauth without an account');
}
// only trigger notification the first time there is an error.
if (!account.error || account.error.count !== 1) {
return nextTick(callback);
}
var lock = navigator.requestWakeLock('cpu');
var titleL10n = 'notification-error-sync-title';
var bodyL10n = 'notification-error-sync-description';
var url = this.accountErrorUrl + account._id;
notification.sendNotification(titleL10n, bodyL10n, url).then(() => {
callback && callback();
lock.unlock();
});
}
};
});