flash message
This commit is contained in:
parent
8d874d569c
commit
3b78a63e67
@ -7278,7 +7278,7 @@ InitPromise.addPromise(app => {
|
||||
|
||||
class PersistDialog extends ConfirmDialog{
|
||||
constructor() {
|
||||
super("persist-storage-dialog-message", "persist-storage-dialog-title");
|
||||
super(Helper.isChrome()?"persist-storage-dialog-message":"persist-storage-dialog-message-firefox", "persist-storage-dialog-title");
|
||||
}
|
||||
}
|
||||
|
||||
@ -7366,24 +7366,31 @@ class WordRotatorSettingFragment extends LocalStorageSettingsFragment {
|
||||
storageObject.parentElement.classList.remove("hidden");
|
||||
storageObject.parentElement.addEventListener("click", async () => {
|
||||
if (!isPersisted) {
|
||||
let shouldAskForNotifications = false;
|
||||
try {
|
||||
let shouldAskForNotifications = await (new PersistDialog().show());
|
||||
// Helper.isChrome()
|
||||
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])
|
||||
});
|
||||
if (Helper.isChrome()) {
|
||||
let sub = await res[1]["pushManager"]["subscribe"]({
|
||||
"userVisibleOnly": true,
|
||||
"applicationServerKey": new Uint8Array([4, 148, 221, 15, 14, 122, 35, 21, 93, 74, 222, 174, 235, 216, 129, 40, 51, 187, 105, 151, 5, 96, 178, 155, 61, 201, 78, 209, 176, 187, 145, 94, 98, 96, 95, 27, 59, 90, 162, 0, 12, 225, 59, 105, 99, 135, 208, 210, 69, 29, 148, 141, 4, 178, 66, 114, 80, 207, 22, 90, 0, 115, 60, 150, 217])
|
||||
});
|
||||
}
|
||||
}
|
||||
} 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")]));
|
||||
|
||||
if (Helper.isChrome() || shouldAskForNotifications) {
|
||||
isPersisted = await storageManager.persist();
|
||||
storageObject.removeAllChildren().appendChild(Translator.makePersistentTranslation("storage-info", [
|
||||
((isPersisted) ? "" : "nicht")]));
|
||||
}
|
||||
}
|
||||
else {
|
||||
new Dialog("already-persisted-dialog-message", "already-persisted-dialog-title").show();
|
||||
}
|
||||
// storageManager.persist().then(isPersisted => {
|
||||
// storageObject.removeAllChildren().appendChild(Translator.makePersistentTranslation("storage-info", [
|
||||
@ -7606,9 +7613,25 @@ InitPromise.resolve(app$1).then(async function () {
|
||||
app$1.start(MenuSite);
|
||||
Translator.setLanguage("de");
|
||||
|
||||
|
||||
|
||||
InstallManager.setCanInstallListener(e => {});
|
||||
let storageManager = MyStorageManager.getInstance();
|
||||
if (InstallManager.isInstalled()){
|
||||
MyStorageManager.getInstance().persist();
|
||||
storageManager.persist();
|
||||
}
|
||||
|
||||
let wasOpened = (Helper.nonNull(localStorage.getItem('was-open'), "0") === "1");
|
||||
if (wasOpened){
|
||||
Promise.all([storageManager.isPersistent(), navigator["serviceWorker"]["ready"]]).then(res => {
|
||||
console.log("Init part ", res);
|
||||
if (!res[0]){
|
||||
FlashMessenger.addMessage("warning-data-not-persistent");
|
||||
}
|
||||
});
|
||||
}
|
||||
else{
|
||||
localStorage.setItem("was-open", "1");
|
||||
}
|
||||
|
||||
window["applyAndroidBridge"] = AndroidBridge.applyDefinitions;
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
||||
import {
|
||||
AndroidBridge,
|
||||
App, applyPolyfills,
|
||||
App, applyPolyfills, FlashMessenger, Helper,
|
||||
InitPromise, MenuAction,
|
||||
ShareManager,
|
||||
SmsShareButton, TelegramShareButton,
|
||||
@ -86,9 +86,25 @@ InitPromise.resolve(app).then(async function () {
|
||||
app.start(MenuSite);
|
||||
Translator.setLanguage("de");
|
||||
|
||||
|
||||
|
||||
InstallManager.setCanInstallListener(e => {});
|
||||
let storageManager = MyStorageManager.getInstance()
|
||||
if (InstallManager.isInstalled()){
|
||||
MyStorageManager.getInstance().persist();
|
||||
storageManager.persist();
|
||||
}
|
||||
|
||||
let wasOpened = (Helper.nonNull(localStorage.getItem('was-open'), "0") === "1");
|
||||
if (wasOpened){
|
||||
Promise.all([storageManager.isPersistent(), navigator["serviceWorker"]["ready"]]).then(res => {
|
||||
console.log("Init part ", res);
|
||||
if (!res[0]){
|
||||
FlashMessenger.addMessage("warning-data-not-persistent");
|
||||
}
|
||||
});
|
||||
}
|
||||
else{
|
||||
localStorage.setItem("was-open", "1");
|
||||
}
|
||||
|
||||
window["applyAndroidBridge"] = AndroidBridge.applyDefinitions;
|
||||
|
||||
@ -117,7 +117,7 @@ export class WordRotatorSettingFragment extends LocalStorageSettingsFragment {
|
||||
}
|
||||
}
|
||||
else {
|
||||
new Dialog("already-persited-dialog-message", "already-persited-dialog-title").show();
|
||||
new Dialog("already-persisted-dialog-message", "already-persisted-dialog-title").show();
|
||||
}
|
||||
// storageManager.persist().then(isPersisted => {
|
||||
// storageObject.removeAllChildren().appendChild(Translator.makePersistentTranslation("storage-info", [
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
"credits-sister-text": "Ich danke meiner Lieblingsschwester, denn ohne Sie würde diese App nicht so aussehen, wie sie aussieht (wahrscheinlich eher schlechter :p)",
|
||||
"credits-coin-text": "Sound:<br/>Der Münz-Sound ist von der Webseite <a href = '{0}' target='_blank' rel='noopener' class = 'link'>{0}</a>. Alle Rechte für diesen Münz-Sound gehören <a target='_blank' rel='noopener' href = '{0}' class = 'link'>{0}</a>.",
|
||||
"credits-music-text": "Musik:<br/>Bright And Beautiful - GEMAfreie Musik von <a href = '{0}' target='_blank' rel='noopener' class = 'link'>{0}</a><br/>Licensed under Creative Commons: By Attribution 4.0 International (CC BY 4.0)<br/><a href = '{1}' target='_blank' rel='noopener' class = 'link'>{1}</a><br/>Angepasst (geschnitten) für diese App",
|
||||
"storage-info": "Daten {0} dauerhaft gespeichert",
|
||||
"storage-info": "Fortschritt {0} dauerhaft gespeichert",
|
||||
"storage-permission-not-get": "Der Browser gibt nicht die Erlaubnis zur dauerhaften Speicherung...",
|
||||
"storage-permission-get": "Die Daten sind nun dauerhaft gespeichert",
|
||||
"persist-storage-dialog-title": "Daten dauerhaft speichern?",
|
||||
@ -34,5 +34,6 @@
|
||||
"notification-permission-denied":"Die Berechtigung für Benachrichtigungen wurde verwährt",
|
||||
"already-persisted-dialog-message":"Damit die Daten dauerhaft gespeichert werden, muss eins von drei Kriterien erfüllt sein:<br/>1) Die Seite muss als Lesezeichen gespeichert werden (und maximal 5 Lesezeichen ingsesamt).<br/>2) Die Seite muss mit die meistbenutzte Seite sein. <br/>3) Benachrichtigungen müssen erlaubt werden.<br/> Du erfüllst schon ein Kriterium und daher wird dein Fortschritt dauerhaft gespeichert (außer du löscht sie)",
|
||||
"already-persisted-dialog-title":"Daten werden dauerhaft gespeichert!",
|
||||
"persist-storage-dialog-message-firefox":"Damit dein Fortschritt dauerhaft gespeichert wird, musst du zulassen, dass Daten dauerhaft gespeichert werden."
|
||||
"persist-storage-dialog-message-firefox":"Damit dein Fortschritt dauerhaft gespeichert wird, musst du zulassen, dass Daten dauerhaft gespeichert werden.",
|
||||
"warning-data-not-persistent":"Achtung! Dein Fortschritt kann verloren gehen! Gehe die Einstellungen für mehr Infos."
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user