Skip to content
This repository has been archived by the owner on Nov 14, 2022. It is now read-only.

Commit

Permalink
Improving pwa support, adding link for android app, styling
Browse files Browse the repository at this point in the history
  • Loading branch information
norkator committed Oct 19, 2020
1 parent cc84abe commit ed75389
Show file tree
Hide file tree
Showing 10 changed files with 476 additions and 31 deletions.
389 changes: 387 additions & 2 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@
},
"dependencies": {
"core-js": "^3.6.5",
"vue": "^2.6.11"
"register-service-worker": "^1.7.1",
"vue": "^2.6.11",
"workbox-window": "^5.1.4"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-plugin-pwa": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"babel-eslint": "^10.1.0",
"eslint": "^6.7.2",
Expand Down
File renamed without changes
File renamed without changes
21 changes: 0 additions & 21 deletions public/manifest.json

This file was deleted.

3 changes: 2 additions & 1 deletion public/robots.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
User-agent: * Disallow:
User-agent: *
Disallow:
65 changes: 59 additions & 6 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
<template>
<div id="app-container">
<the-header app-name="Noiser"/>
<section class="mainContentLayout magictime slideDownReturn">

<div class="update-dialog" v-if="showUpdateUI">
<div class="update-dialog__content">
A new version is available. Refresh now to activate?
</div>
<div class="update-dialog__actions">
<button class="button" @click="update">Update</button>
<button class="button" @click="showUpdateUI = false">Cancel</button>
</div>
</div>

<section class="mainContentLayout magictime slideDownReturn">
<div>
<h2 class="packName">{{audioSources.summerPack.name}}</h2>
<div v-if="audioSources.summerPack.audioSources.length > 0" class="flexLayout">
Expand Down Expand Up @@ -63,7 +73,12 @@
<h4 v-else class="packNoSounds">Sounds coming</h4>
</div>
<hr>
<h4 class="packNoSounds"><a style="color: white;" href="http://www.nitramite.com/noiser.html">Click here</a> for asset attribution notes</h4>
<h2 class="packName">Links</h2>
<h4 class="packNoSounds">Download <a style="color: white;"
href="https://play.google.com/store/apps/details?id=com.nitramite.noiser">Android
App</a> here</h4>
<h4 class="packNoSounds"><a style="color: white;" href="http://www.nitramite.com/noiser.html">Click here</a> for
asset attribution notes</h4>
<hr>

</section>
Expand All @@ -75,10 +90,8 @@
import TheHeader from "./components/TheHeader.vue";
import AudioElement from "./components/AudioElement.vue";
import TheFooter from "./components/TheFooter.vue";
import AudioPack from './assets/AudioPack';
export default {
name: 'App',
components: {
Expand All @@ -88,12 +101,25 @@
},
data() {
return {
audioSources: AudioPack.audioPacks
audioSources: AudioPack.audioPacks,
showUpdateUI: false,
}
},
mounted() {
},
methods: {},
methods: {
async update() {
this.showUpdateUI = false;
await this.$workbox.messageSW({type: "SKIP_WAITING"});
},
},
created() {
if (this.$workbox) {
this.$workbox.addEventListener("waiting", () => {
this.showUpdateUI = true;
});
}
},
}
</script>

Expand Down Expand Up @@ -153,4 +179,31 @@
border-radius: 5px;
}
.update-dialog {
text-align: center;
border-radius: 20px;
margin: 10px 20px 10px 20px;
padding-top: 10px;
padding-bottom: 10px;
color: white;
background-color: rgba(255, 255, 255, 0.15);
box-shadow: 0 4px 25px 0 rgba(255, 255, 255, 0.1);
}
.button {
min-width: 100px;
height: 40px;
background: #2d3436;
border-radius: 40px;
overflow: hidden;
cursor: pointer;
transition: .1s linear;
margin: 5px 5px 0 5px;
color: white;
}
.button:hover {
transform: scale(1.1);
}
</style>
3 changes: 3 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import Vue from 'vue'
import App from './App.vue'
import wb from "./registerServiceWorker";

Vue.prototype.$workbox = wb;

Vue.config.productionTip = false;

Expand Down
13 changes: 13 additions & 0 deletions src/registerServiceWorker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import {Workbox} from "workbox-window";

let wb;
if ("serviceWorker" in navigator) {
wb = new Workbox(`${process.env.BASE_URL}service-worker.js`);
wb.addEventListener("controlling", () => {
window.location.reload();
});
wb.register();
} else {
wb = null;
}
export default wb;
8 changes: 8 additions & 0 deletions vue.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,13 @@ module.exports = {
args[0].title = 'Noiser - Free white noise generator';
return args
})
},
pwa: {
themeColor: "#DE6262",
msTileColor: "#DE6262",
appleMobileWebAppCache: "yes",
manifestOptions: {
background_color: "#DE6262"
}
}
};

0 comments on commit ed75389

Please sign in to comment.