test
This commit is contained in:
@@ -1 +1 @@
|
||||
<div class="max-height fill-me"><div class="row max-width grow flex-center"><div class="columns small-centered small-12 smedium-11 medium-9 large-7"><div class="row setting-row hidden" id=install-button><span class="columns small-6" data-translation=install></span> <span class="columns small-6 text-right" data-translation=">"></span></div><div class="row setting-row" id=theme-chooser><span class="columns small-6" data-translation=theme></span> <span class="columns small-6 text-right"><div id=theme-name></div></span></div><label class="switch row setting-row"><span class="columns small-6" data-translation=sound></span> <span class="columns small-6 text-right"><input type=checkbox class=setting id=play-sound name=play-sound value=1 data-default=1> <span class=slider></span></span></label> <label class="switch row setting-row"><span class="columns small-6" data-translation=music></span> <span class="columns small-6 text-right"><input type=checkbox class=setting id=play-music name=play-music value=1 data-default=1> <span class=slider></span></span></label><div class="row setting-row" id=credits-button><span class="columns small-6" data-translation=credits></span> <span class="columns small-6 text-right" data-translation=">"></span></div><div class="row setting-row" id=privacy-policy-button><span class="columns small-6" data-translation=privacy-policy></span> <span class="columns small-6 text-right" data-translation=">"></span></div><div class="row setting-row" id=impressum-button><span class="columns small-6" data-translation=impressum></span> <span class="columns small-6 text-right" data-translation=">"></span></div><div class="row setting-row" id=contact-button><span class="columns small-6" data-translation=contact></span> <span class="columns small-6 text-right" data-translation=">"></span></div><label class="switch row setting-row"><span class="columns small-6" data-translation=track></span> <span class="columns small-6 text-right"><input type=checkbox class=setting id=track-switch name=matomoShouldTrack value=1 data-default=1 data-raw=1> <span class=slider></span></span></label><div class="row setting-row hidden"><span class="column small-12" id=storage-info></span></div><button id=reset-levels class="button hidden" data-translation=reset-levels></button></div></div></div>
|
||||
<div class="max-height fill-me"><div class="row max-width grow flex-center"><div class="columns small-centered small-12 smedium-11 medium-9 large-7"><div class="row setting-row hidden" id=install-button><span class="columns small-6" data-translation=install></span> <span class="columns small-6 text-right" data-translation=">"></span></div><div class="row setting-row" id=theme-chooser><span class="columns small-6" data-translation=theme></span> <span class="columns small-6 text-right"><div id=theme-name></div></span></div><label class="switch row setting-row"><span class="columns small-6" data-translation=sound></span> <span class="columns small-6 text-right"><input type=checkbox class=setting id=play-sound name=play-sound value=1 data-default=1> <span class=slider></span></span></label> <label class="switch row setting-row"><span class="columns small-6" data-translation=music></span> <span class="columns small-6 text-right"><input type=checkbox class=setting id=play-music name=play-music value=1 data-default=1> <span class=slider></span></span></label><div class="row setting-row" id=credits-button><span class="columns small-6" data-translation=credits></span> <span class="columns small-6 text-right" data-translation=">"></span></div><div class="row setting-row" id=privacy-policy-button><span class="columns small-6" data-translation=privacy-policy></span> <span class="columns small-6 text-right" data-translation=">"></span></div><div class="row setting-row" id=impressum-button><span class="columns small-6" data-translation=impressum></span> <span class="columns small-6 text-right" data-translation=">"></span></div><div class="row setting-row" id=contact-button><span class="columns small-6" data-translation=contact></span> <span class="columns small-6 text-right" data-translation=">"></span></div><label class="switch row setting-row"><span class="columns small-6" data-translation=track></span> <span class="columns small-6 text-right"><input type=checkbox class=setting id=track-switch name=matomoShouldTrack value=1 data-default=1 data-raw=1> <span class=slider></span></span></label><div class="row setting-row hidden"><span class="column small-10" id=storage-info></span> <span class="columns small-6 text-right" data-translation=">"></span></div><button id=reset-levels class="button hidden" data-translation=reset-levels></button></div></div></div>
|
||||
143
public/js/app.js
143
public/js/app.js
@@ -2682,6 +2682,28 @@ class Dialog {
|
||||
}
|
||||
}
|
||||
|
||||
class ConfirmDialog extends Dialog {
|
||||
constructor(content, title) {
|
||||
super(content, title);
|
||||
}
|
||||
|
||||
async show() {
|
||||
this.addButton("confirm-button", true);
|
||||
this.addButton("cancel-button", false);
|
||||
|
||||
return super.show();
|
||||
}
|
||||
|
||||
|
||||
close() {
|
||||
if (Helper.isNull(this.result))
|
||||
{
|
||||
this.result = false;
|
||||
}
|
||||
return super.close();
|
||||
}
|
||||
}
|
||||
|
||||
class FlashMessenger {
|
||||
static deleteMessage(_idNumber, _delayInMilliSeconds) {
|
||||
_delayInMilliSeconds = Helper.nonNull(_delayInMilliSeconds, 0);
|
||||
@@ -7254,6 +7276,12 @@ InitPromise.addPromise(app => {
|
||||
app.addDeepLink("impressum", ImpressumSite);
|
||||
});
|
||||
|
||||
class PersistDialog extends ConfirmDialog{
|
||||
constructor() {
|
||||
super("persist-storage-dialog-message", "persist-storage-dialog-title");
|
||||
}
|
||||
}
|
||||
|
||||
class WordRotatorSettingFragment extends LocalStorageSettingsFragment {
|
||||
constructor(site) {
|
||||
super(site, "html/application/fragment/settings.html");
|
||||
@@ -7328,39 +7356,53 @@ class WordRotatorSettingFragment extends LocalStorageSettingsFragment {
|
||||
installButton.classList.remove("hidden");
|
||||
});
|
||||
|
||||
// let storageManager = MyStorageManager.getInstance();
|
||||
// if (storageManager.canEstimateStorage()) {
|
||||
// console.log("can estimate storage!");
|
||||
// Promise.all([storageManager.estimate(), storageManager.isPersistent()]).then(res => {
|
||||
// let storage = res[0];
|
||||
// let isPersisted = res[1];
|
||||
// let storageObject = this.findBy("#storage-info");
|
||||
// console.log(isPersisted);
|
||||
// storageObject.appendChild(Translator.makePersistentTranslation("storage-info", [
|
||||
// Math.round(storage.usage / (1024 * 1024) * 100) / 100,
|
||||
// Math.round(storage.quota / (1024 * 1024) * 100) / 100,
|
||||
// Math.round(storage.usage / storage.quota * 10000) / 100,
|
||||
// ((isPersisted) ? "" : "nicht")]));
|
||||
// storageObject.parentElement.classList.remove("hidden");
|
||||
// storageObject.parentElement.addEventListener("click", () => {
|
||||
// storageManager.persist().then(isPersisted => {
|
||||
// storageObject.removeAllChildren().appendChild(Translator.makePersistentTranslation("storage-info", [
|
||||
// Math.round(storage.usage / (1024 * 1024) * 100) / 100,
|
||||
// Math.round(storage.quota / (1024 * 1024) * 100) / 100,
|
||||
// Math.round(storage.usage / storage.quota * 10000) / 100,
|
||||
// ((isPersisted) ? "" : "nicht")]));
|
||||
//
|
||||
// console.log("p", isPersisted);
|
||||
// if (!isPersisted){
|
||||
// FlashMessenger.addMessage("storage-permission-not-get");
|
||||
// }
|
||||
// else {
|
||||
// FlashMessenger.addMessage("storage-permission-get");
|
||||
// }
|
||||
// });
|
||||
// })
|
||||
// });
|
||||
// }
|
||||
let storageManager = MyStorageManager.getInstance();
|
||||
if (storageManager.canPersist()) {
|
||||
Promise.all([storageManager.isPersistent(), navigator.serviceWorker["ready"]]).then(res => {
|
||||
let isPersisted = res[0];
|
||||
let storageObject = this.findBy("#storage-info");
|
||||
storageObject.appendChild(Translator.makePersistentTranslation("storage-info", [
|
||||
((isPersisted) ? "" : "nicht")]));
|
||||
storageObject.parentElement.classList.remove("hidden");
|
||||
storageObject.parentElement.addEventListener("click", async () => {
|
||||
if (!isPersisted) {
|
||||
try {
|
||||
let shouldAskForNotifications = await (new PersistDialog().show());
|
||||
if (shouldAskForNotifications) {
|
||||
let sub = await res[1]["pushManager"]["subscribe"]({
|
||||
"userVisibleOnly": true,
|
||||
"applicationServerKey": new Uint8Array([0x4, 0x53, 0xb7, 0x8d, 0xc6, 0xd1, 0x1a, 0xd4, 0x8b, 0xb2, 0xeb, 0x82, 0xf0, 0x9e, 0x12, 0xf6, 0xd, 0x32, 0x18, 0xa, 0x35, 0xf, 0x2d, 0x4c, 0x5, 0x29, 0x15, 0x95, 0x23, 0xb1, 0xd3, 0xab, 0x87, 0x88, 0x85, 0x1d, 0xc0, 0x98, 0x6e, 0x65, 0xe3, 0xcb, 0xa2, 0x28, 0x63, 0x7, 0x34, 0x9b, 0xfa, 0x46, 0x9a, 0x49, 0xcc, 0x70, 0x7a, 0xdd, 0xbe, 0x1e, 0xfc, 0xde, 0xcc, 0xb3, 0x5b, 0xcb, 0xf4])
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
if ('Notification' in window && Notification.permission === 'denied') {
|
||||
FlashMessenger.addMessage('notification-permission-denied');
|
||||
}
|
||||
}
|
||||
|
||||
isPersisted = await storageManager.isPersistent();
|
||||
storageObject.removeAllChildren().appendChild(Translator.makePersistentTranslation("storage-info", [
|
||||
((isPersisted) ? "" : "nicht")]));
|
||||
|
||||
}
|
||||
// storageManager.persist().then(isPersisted => {
|
||||
// storageObject.removeAllChildren().appendChild(Translator.makePersistentTranslation("storage-info", [
|
||||
// Math.round(storage.usage / (1024 * 1024) * 100) / 100,
|
||||
// Math.round(storage.quota / (1024 * 1024) * 100) / 100,
|
||||
// Math.round(storage.usage / storage.quota * 10000) / 100,
|
||||
// ((isPersisted) ? "" : "nicht")]));
|
||||
//
|
||||
// console.log("p", isPersisted);
|
||||
// if (!isPersisted){
|
||||
// FlashMessenger.addMessage("storage-permission-not-get");
|
||||
// }
|
||||
// else {
|
||||
// FlashMessenger.addMessage("storage-permission-get");
|
||||
// }
|
||||
// });
|
||||
});
|
||||
});
|
||||
}
|
||||
return super.onFirstStart();
|
||||
}
|
||||
|
||||
@@ -7569,24 +7611,23 @@ InitPromise.resolve(app$1).then(async function () {
|
||||
MyStorageManager.getInstance().persist();
|
||||
}
|
||||
|
||||
|
||||
window["applyAndroidBridge"] = AndroidBridge.applyDefinitions;
|
||||
});
|
||||
|
||||
console.log("trying push... 1");
|
||||
navigator.serviceWorker["ready"].then(function (registration) {
|
||||
console.log("trying push... 2");
|
||||
registration["pushManager"]["subscribe"]({
|
||||
"userVisibleOnly": false,
|
||||
"applicationServerKey": new Uint8Array([0x4, 0x53, 0xb7, 0x8d, 0xc6, 0xd1, 0x1a, 0xd4, 0x8b, 0xb2, 0xeb, 0x82, 0xf0, 0x9e, 0x12, 0xf6, 0xd, 0x32, 0x18, 0xa, 0x35, 0xf, 0x2d, 0x4c, 0x5, 0x29, 0x15, 0x95, 0x23, 0xb1, 0xd3, 0xab, 0x87, 0x88, 0x85, 0x1d, 0xc0, 0x98, 0x6e, 0x65, 0xe3, 0xcb, 0xa2, 0x28, 0x63, 0x7, 0x34, 0x9b, 0xfa, 0x46, 0x9a, 0x49, 0xcc, 0x70, 0x7a, 0xdd, 0xbe, 0x1e, 0xfc, 0xde, 0xcc, 0xb3, 0x5b, 0xcb, 0xf4])
|
||||
}).then(function (sub) {
|
||||
console.log("trying push... 3");
|
||||
console.log("Subscription", sub);
|
||||
}).catch(function (e) {
|
||||
// if ('Notification' in window && Notification.permission === 'denied') {
|
||||
// console.warn('Permission for notifications was denied');
|
||||
// } else {
|
||||
// console.error('Unable to subscribe to push', e);
|
||||
// }
|
||||
});
|
||||
});
|
||||
// console.log("trying push... 1");
|
||||
// navigator.serviceWorker["ready"].then(function (registration) {
|
||||
// console.log("trying push... 2");
|
||||
// registration["pushManager"]["subscribe"]({
|
||||
// "userVisibleOnly": true,
|
||||
// "applicationServerKey": new Uint8Array([0x4, 0x53, 0xb7, 0x8d, 0xc6, 0xd1, 0x1a, 0xd4, 0x8b, 0xb2, 0xeb, 0x82, 0xf0, 0x9e, 0x12, 0xf6, 0xd, 0x32, 0x18, 0xa, 0x35, 0xf, 0x2d, 0x4c, 0x5, 0x29, 0x15, 0x95, 0x23, 0xb1, 0xd3, 0xab, 0x87, 0x88, 0x85, 0x1d, 0xc0, 0x98, 0x6e, 0x65, 0xe3, 0xcb, 0xa2, 0x28, 0x63, 0x7, 0x34, 0x9b, 0xfa, 0x46, 0x9a, 0x49, 0xcc, 0x70, 0x7a, 0xdd, 0xbe, 0x1e, 0xfc, 0xde, 0xcc, 0xb3, 0x5b, 0xcb, 0xf4])
|
||||
// }).then(function (sub) {
|
||||
// console.log("trying push... 3");
|
||||
// console.log("Subscription", sub);
|
||||
// }).catch(function (e) {
|
||||
// // if ('Notification' in window && Notification.permission === 'denied') {
|
||||
// // console.warn('Permission for notifications was denied');
|
||||
// // } else {
|
||||
// // console.error('Unable to subscribe to push', e);
|
||||
// // }
|
||||
// });
|
||||
// });
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user