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,187 @@
define(function(require) {
'use strict';
var DialogService = require('modules/dialog_service');
var SettingsService = require('modules/settings_service');
var SettingsCache = require('modules/settings_cache');
require('shared/async_storage');
var SendFeedback = function(){};
SendFeedback.prototype = {
_SettingsCache: SettingsCache,
_SettingsService: SettingsService,
init: function(elements) {
this.elements = elements;
this.options = {};
this._sendData = {
product: 'Firefox OS',
platform: 'Firefox OS'
};
this._showEmail = false;
},
_isHappy: function() {
var happy = this.options && this.options.feel;
return happy === 'feedback-happy';
},
updateTitle: function() {
var id = 'feedback_whyfeel_' + (this._isHappy() ? 'happy' : 'sad');
this.elements.title.setAttribute('data-l10n-id', id);
},
/**
* Get previous inputs from asyncStorage.
*/
getPreviousInputs: function() {
window.asyncStorage.getItem('feedback', function(value) {
this._inputData = value || {};
}.bind(this));
},
keepAllInputs: function() {
window.asyncStorage.setItem('feedback', this._inputData);
},
get _inputData() {
return {
description: this.elements.description.value,
email: this.elements.emailInput.value,
emailEnable: this._showEmail
};
},
set _inputData(data) {
this.elements.description.value = data.description || '';
this.elements.emailInput.value = data.email || '';
this._showEmail = !data.emailEnable;
this.enableEmail();
},
send: function() {
this.elements.sendBtn.disabled = true;
if (!navigator.onLine) {
this._messageHandler('connect-error');
return;
}
var emailBar = this.elements.emailColumn;
var emailInput = this.elements.emailInput;
var contextInput = this.elements.description;
if (contextInput.textLength === 0) {
this._messageHandler('empty-comment');
return;
} else {
this._sendData.description = contextInput.value;
}
if (!emailBar.hidden) {
this._sendData.email = emailInput.value;
} else {
delete this._sendData.email;
}
if (!emailBar.hidden &&
(!emailInput.value.length ||
!emailInput.validity.valid)) {
this._messageHandler('wrong-email');
return;
}
var currentSetting = this._SettingsCache.cache;
var feedbackUrl = currentSetting['feedback.url'];
this._sendData.version =
currentSetting['deviceinfo.os'];
this._sendData.device =
currentSetting['deviceinfo.hardware'];
this._sendData.locale =
currentSetting['language.current'];
this._sendData.happy = this._isHappy();
this._xhr = new XMLHttpRequest({mozSystem: true});
this._xhr.open('POST', feedbackUrl, true);
this._xhr.setRequestHeader(
'Content-type', 'application/json');
this._xhr.timeout = 5000;
this._xhr.onload =
this._responseHandler.bind(this);
this._xhr.ontimeout = function() {
this._messageHandler('timeout');
}.bind(this);
this._xhr.send(JSON.stringify(this._sendData));
},
/**
* Show email input column if use click the checkbox.
*/
enableEmail: function() {
var original = this._showEmail;
this._showEmail = !original;
this.elements.emailEnable.checked = !original;
this.elements.emailColumn.hidden = original;
},
back: function() {
this.keepAllInputs();
this._SettingsService.navigate('improveBrowserOS-chooseFeedback');
},
_responseHandler: function() {
switch (this._xhr.status) {
case 201:
this._messageHandler('success');
break;
case 429:
// this status is trying to prevent users keep sending the same
// message, but from server aspect, it means success.
this._messageHandler('success');
break;
case 404:
this._messageHandler('server-off');
break;
case 400:
this._messageHandler('unknown-error');
break;
default:
this._messageHandler('unknown-error');
break;
}
},
_messageHandler: function(type) {
if (type === 'success') {
this._openDoneDialog();
} else {
this.keepAllInputs();
this._openAlertDialog(type);
}
this.elements.sendBtn.disabled = false;
},
_openAlertDialog: function(type) {
DialogService.alert({
id: 'feedback-errormessage-' + type
}, {
submitButton: { id: 'ok', style: 'full' }
});
},
/**
* Once the data is sent successfully and user click 'done' button,
* we'll go back to improveBrowserOS panel.
*/
_openDoneDialog: function() {
DialogService.alert({
id: 'feedback-complete-msg'
}, {
title: 'sendFeedbackTitle',
submitButton: { id: 'done', style: 'full' }
}).then(function() {
this._SettingsService.navigate('improveBrowserOS');
}.bind(this));
}
};
return function ctor_send_feedback() {
return new SendFeedback();
};
});

View file

@ -0,0 +1,62 @@
define(function(require) {
'use strict';
var SettingsPanel = require('modules/settings_panel');
var SendFeedback = require('panels/feedback_send/feedback_send');
return function ctor_sendFeedbackPanel() {
var elements = {};
var sendFeedback = SendFeedback();
var eventMapping = [
{ elementName: 'sendBtn', eventType: 'click', methodName: 'send' },
{ elementName: 'emailEnable', eventType: 'change',
methodName: 'enableEmail' },
{ elementName: 'header', eventType: 'action', methodName: 'back' }
];
function bindEvents(elements) {
eventMapping.forEach(function(map) {
map.method = sendFeedback[map.methodName].bind(sendFeedback);
elements[map.elementName].addEventListener(map.eventType,
map.method);
});
}
function unbindEvents(elements) {
eventMapping.forEach(function(map) {
if (!map.method) {
return;
}
elements[map.elementName].removeEventListener(map.eventType,
map.method);
});
}
return SettingsPanel({
onInit: function(panel) {
elements = {
title: panel.querySelector('#feedback-title'),
description: panel.querySelector('#feedback-description'),
emailInput: panel.querySelector('#feedback-email'),
emailColumn: panel.querySelector('#feedback-emailbar'),
emailEnable: panel.querySelector('#email-enable'),
sendBtn: panel.querySelector('#feedback-send-btn'),
header: panel.querySelector('#feedback-header')
};
sendFeedback.init(elements);
},
onBeforeShow: function(panel, options) {
bindEvents(elements);
sendFeedback.options = options;
sendFeedback.updateTitle();
sendFeedback.getPreviousInputs();
},
onBeforeHide: function() {
unbindEvents(elements);
if (document.hidden) {
sendFeedback.keepAllInputs();
}
}
});
};
});