mirror of https://github.com/OCA/web.git
[IMP] web_pwa_oca: black, isort, prettier
parent
fc3ab59acb
commit
7bf6e89d9a
|
@ -68,7 +68,10 @@ class ResConfigSettings(models.TransientModel):
|
|||
resized_image.save(icon_bytes_output, format=extension.lstrip(".").upper())
|
||||
icon = base64.b64encode(icon_bytes_output.getvalue())
|
||||
url = "{}{}x{}{}".format(
|
||||
self._pwa_icon_url_base, str(size[0]), str(size[1]), extension,
|
||||
self._pwa_icon_url_base,
|
||||
str(size[0]),
|
||||
str(size[1]),
|
||||
extension,
|
||||
)
|
||||
# Retreive existing attachment
|
||||
existing_attachment = (
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* Copyright 2020 Tecnativa - Alexandre D. Díaz
|
||||
* License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). */
|
||||
|
||||
odoo.define("web_pwa_oca.PWAManager", function(require) {
|
||||
odoo.define("web_pwa_oca.PWAManager", function (require) {
|
||||
"use strict";
|
||||
|
||||
var core = require("web.core");
|
||||
|
@ -13,7 +13,7 @@ odoo.define("web_pwa_oca.PWAManager", function(require) {
|
|||
/**
|
||||
* @override
|
||||
*/
|
||||
init: function() {
|
||||
init: function () {
|
||||
this._super.apply(this, arguments);
|
||||
if (!("serviceWorker" in navigator)) {
|
||||
console.error(
|
||||
|
@ -31,11 +31,11 @@ odoo.define("web_pwa_oca.PWAManager", function(require) {
|
|||
* @param {String} sw_script
|
||||
* @returns {Promise}
|
||||
*/
|
||||
registerServiceWorker: function(sw_script) {
|
||||
registerServiceWorker: function (sw_script) {
|
||||
return this._service_worker
|
||||
.register(sw_script)
|
||||
.then(this._onRegisterServiceWorker)
|
||||
.catch(function(error) {
|
||||
.catch(function (error) {
|
||||
console.log(_t("[ServiceWorker] Registration failed: "), error);
|
||||
});
|
||||
},
|
||||
|
@ -46,7 +46,7 @@ odoo.define("web_pwa_oca.PWAManager", function(require) {
|
|||
* @private
|
||||
* @param {ServiceWorkerRegistration} registration
|
||||
*/
|
||||
_onRegisterServiceWorker: function(registration) {
|
||||
_onRegisterServiceWorker: function (registration) {
|
||||
console.log(_t("[ServiceWorker] Registered:"), registration);
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* Copyright 2020 Tecnativa - Alexandre D. Díaz
|
||||
* License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). */
|
||||
|
||||
odoo.define("web_pwa_oca.webclient", function(require) {
|
||||
odoo.define("web_pwa_oca.webclient", function (require) {
|
||||
"use strict";
|
||||
|
||||
var WebClient = require("web.WebClient");
|
||||
|
@ -11,7 +11,7 @@ odoo.define("web_pwa_oca.webclient", function(require) {
|
|||
/**
|
||||
* @override
|
||||
*/
|
||||
show_application: function() {
|
||||
show_application: function () {
|
||||
this.pwa_manager = new PWAManager(this);
|
||||
return this._super.apply(this, arguments);
|
||||
},
|
||||
|
|
|
@ -5,20 +5,20 @@
|
|||
// This is a hack, not a complete implementation!
|
||||
// only expected to be used by boot.js
|
||||
|
||||
(function() {
|
||||
(function () {
|
||||
"use strict";
|
||||
function JQuery(selector, context) {
|
||||
return new JQuery.prototype.init(selector, context);
|
||||
}
|
||||
|
||||
JQuery.prototype = {
|
||||
init: function(selector) {
|
||||
init: function (selector) {
|
||||
if (typeof selector === "function") {
|
||||
selector();
|
||||
}
|
||||
},
|
||||
|
||||
deparam: function(data) {
|
||||
deparam: function (data) {
|
||||
const params = data.split(",");
|
||||
const res = [];
|
||||
for (const param of params) {
|
||||
|
@ -28,14 +28,14 @@
|
|||
},
|
||||
|
||||
param: {
|
||||
querystring: function() {
|
||||
querystring: function () {
|
||||
return "debug=1";
|
||||
},
|
||||
},
|
||||
|
||||
when: function(tasks) {
|
||||
when: function (tasks) {
|
||||
return Promise.all(tasks instanceof Array ? tasks : [tasks]).then(
|
||||
results => {
|
||||
(results) => {
|
||||
return results.length === 1 ? results[0] : results;
|
||||
}
|
||||
);
|
||||
|
|
|
@ -8,21 +8,21 @@
|
|||
* this class is instantiated.
|
||||
*/
|
||||
|
||||
odoo.define("web_pwa_oca.PWA", function(require) {
|
||||
odoo.define("web_pwa_oca.PWA", function (require) {
|
||||
"use strict";
|
||||
|
||||
const OdooClass = require("web.Class");
|
||||
|
||||
const PWA = OdooClass.extend({
|
||||
// eslint-disable-next-line
|
||||
init: function(params) {
|
||||
init: function (params) {
|
||||
// To be overridden
|
||||
},
|
||||
|
||||
/**
|
||||
* @returns {Promise}
|
||||
*/
|
||||
installWorker: function() {
|
||||
installWorker: function () {
|
||||
// To be overridden
|
||||
return Promise.resolve();
|
||||
},
|
||||
|
@ -30,7 +30,7 @@ odoo.define("web_pwa_oca.PWA", function(require) {
|
|||
/**
|
||||
* @returns {Promise}
|
||||
*/
|
||||
activateWorker: function() {
|
||||
activateWorker: function () {
|
||||
// To be overridden
|
||||
return Promise.resolve();
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue