handleVisibility-Bug für Safari behoben
This commit is contained in:
parent
dde9ae8223
commit
f2290a8ff2
@ -5293,13 +5293,10 @@ class SoundManager {
|
||||
|
||||
constructor() {
|
||||
this.channels = {};
|
||||
console.log("SoundManager construction");
|
||||
if ('AudioContext' in window){
|
||||
console.log("SoundManager construction 2");
|
||||
this.context = new AudioContext();
|
||||
}
|
||||
else if ('webkitAudioContext' in window){
|
||||
console.log("SoundManager construction 3");
|
||||
this.context = new webkitAudioContext();
|
||||
}
|
||||
else {
|
||||
@ -5312,9 +5309,16 @@ class SoundManager {
|
||||
console.log("onComplete from context", arguments);
|
||||
};
|
||||
|
||||
window.addEventListener("visibilitychange", () => {
|
||||
window.addEventListener("visibilitychange", (e) => {
|
||||
console.log("visibility Change event", e);
|
||||
this.handleVisibilityChange();
|
||||
});
|
||||
//For safari
|
||||
let checkVisibility = ()=>{
|
||||
this.handleVisibilityChange();
|
||||
setTimeout(checkVisibility, 500);
|
||||
};
|
||||
checkVisibility();
|
||||
}
|
||||
|
||||
isNotSuspended(){
|
||||
@ -5431,6 +5435,7 @@ class SoundManager {
|
||||
}
|
||||
|
||||
handleVisibilityChange() {
|
||||
console.log("handling visibillity change...");
|
||||
if (document.hidden) {
|
||||
this.stopAll();
|
||||
}
|
||||
@ -7555,6 +7560,7 @@ class WordRotatorSettingFragment extends LocalStorageSettingsFragment {
|
||||
localStorage.removeItem("levelCounter");
|
||||
localStorage.removeItem("tutorial-step");
|
||||
(await WordRotatorDb.getInstance()).removeAll(WordRotatorDb.OBJECT_STORE.LEVEL);
|
||||
(await WordRotatorDb.getInstance()).removeAll(WordRotatorDb.OBJECT_STORE.SYSTEM_VARS);
|
||||
});
|
||||
|
||||
if (location.hostname.includes("beta") || location.hostname.includes("127.0.0.1")) {
|
||||
@ -7860,8 +7866,6 @@ InitPromise.resolve(app$1).then(async function () {
|
||||
app$1.start(MenuSite);
|
||||
Translator.setLanguage("de");
|
||||
|
||||
|
||||
|
||||
InstallManager.setCanInstallListener(e => {});
|
||||
let storageManager = MyStorageManager.getInstance();
|
||||
if (InstallManager.isInstalled()){
|
||||
@ -7871,7 +7875,7 @@ InitPromise.resolve(app$1).then(async function () {
|
||||
window["applyAndroidBridge"] = AndroidBridge.applyDefinitions;
|
||||
|
||||
let wasOpened = (Helper.nonNull(localStorage.getItem('was-open'), "0") === "1");
|
||||
if (wasOpened){
|
||||
if (wasOpened && storageManager.canPersist()){
|
||||
Promise.all([storageManager.isPersistent(), navigator["serviceWorker"]["ready"]]).then(res => {
|
||||
if (!res[0]){
|
||||
FlashMessenger.addMessage("warning-data-not-persistent");
|
||||
|
||||
@ -440,13 +440,10 @@ class SoundManager {
|
||||
|
||||
constructor() {
|
||||
this.channels = {};
|
||||
console.log("SoundManager construction");
|
||||
if ('AudioContext' in window){
|
||||
console.log("SoundManager construction 2");
|
||||
this.context = new AudioContext();
|
||||
}
|
||||
else if ('webkitAudioContext' in window){
|
||||
console.log("SoundManager construction 3");
|
||||
this.context = new webkitAudioContext();
|
||||
}
|
||||
else {
|
||||
@ -459,9 +456,16 @@ class SoundManager {
|
||||
console.log("onComplete from context", arguments);
|
||||
};
|
||||
|
||||
window.addEventListener("visibilitychange", () => {
|
||||
window.addEventListener("visibilitychange", (e) => {
|
||||
console.log("visibility Change event", e);
|
||||
this.handleVisibilityChange();
|
||||
});
|
||||
//For safari
|
||||
let checkVisibility = ()=>{
|
||||
this.handleVisibilityChange();
|
||||
setTimeout(checkVisibility, 500);
|
||||
};
|
||||
checkVisibility();
|
||||
}
|
||||
|
||||
isNotSuspended(){
|
||||
@ -578,6 +582,7 @@ class SoundManager {
|
||||
}
|
||||
|
||||
handleVisibilityChange() {
|
||||
console.log("handling visibillity change...");
|
||||
if (document.hidden) {
|
||||
this.stopAll();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user