flash message
This commit is contained in:
@@ -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
Reference in New Issue
Block a user