Skip to content

Commit

Permalink
Fix iOS issue with the notifications api
Browse files Browse the repository at this point in the history
  • Loading branch information
simonharrer committed Oct 30, 2021
1 parent 66b7e02 commit 71ac301
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
7 changes: 5 additions & 2 deletions src/main/resources/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,11 @@ <h1>Mob Timer</h1>

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
<script type="text/javascript">
Notification.requestPermission();

if ("Notification" in window) {
Notification.requestPermission();
}
</script>
<script type="text/javascript">
let url = `/events`;
console.log('setting up event source at ' + url);
const eventSource = new EventSource(url);
Expand Down
20 changes: 12 additions & 8 deletions src/main/resources/templates/room.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ <h5>History <small class="text-muted">Last 24h</small></h5>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/howler/2.2.3/howler.min.js"></script>
<script type="text/javascript">
Notification.requestPermission();
if ("Notification" in window) {
Notification.requestPermission();
}
</script>
<script type="text/javascript">

Expand Down Expand Up @@ -191,13 +193,15 @@ <h5>History <small class="text-muted">Last 24h</small></h5>
updateTimerNextUser(requestNextUser);
updateTimerType(null);

Notification.requestPermission();
new Notification(requestUser + ' $ ' + (requestType === "TIMER" ? 'mob next' : 'mob start'), {
tag: 'timer-finished',
body: requestTimer + " min timer is up.",
icon: '/favicon.ico',
lang: 'en',
});
if ("Notification" in window) {
Notification.requestPermission();
new Notification(requestUser + ' $ ' + (requestType === "TIMER" ? 'mob next' : 'mob start'), {
tag: 'timer-finished',
body: requestTimer + " min timer is up.",
icon: '/favicon.ico',
lang: 'en',
});
}

if (hasAudioEnabled()) {
// isTimerOfCurrentUser() ? '/' + (requestType === "TIMER" ? 'mobnext.mp3' : 'mobstart.mp3') :
Expand Down

0 comments on commit 71ac301

Please sign in to comment.