Ver código fonte

update snackbar if new versionis available

master
Flo Smilari 4 anos atrás
pai
commit
f72f2e3deb

+ 0
- 1
Shared/Services/InputCursorHandler.cs Ver arquivo

@@ -1,6 +1,5 @@
using Microsoft.AspNetCore.Components.Web;
using Microsoft.JSInterop;
using System;
using System.Threading.Tasks;
namespace cwebplusApp.Shared.Services {

+ 1
- 1
cwebplusApp.csproj Ver arquivo

@@ -10,7 +10,7 @@
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
<Version>0.9.3</Version>
<Version>0.9.8</Version>
</PropertyGroup>
<ItemGroup>

+ 11
- 5
wwwroot/css/app.css Ver arquivo

@@ -255,19 +255,25 @@ div.mat-select.required span#outlined-select-label.mdc-floating-label::after {
width: var(--mat-drawer-custom-width, 300px);
}
#snackbarDiv {
bottom: 30px;
width: 100%;
justify-content: center;
padding: 0 40px;
}
#snackbarDiv.show {
position: absolute;
}
#snackbar {
visibility: hidden;
min-width: 50%;
margin: 40px;
background-color: #333;
color: #fff;
text-align: center;
border-radius: 10px;
padding: 16px;
position: sticky;
z-index: 1;
left: 50%;
bottom: 30px;
}
#snackbar.show {

+ 11
- 9
wwwroot/index.html Ver arquivo

@@ -32,9 +32,11 @@
<a href="" class="reload">Reload</a>
<a class="dismiss">🗙</a>
</div>
<!-- The actual snackbar -->
<div id="snackbar">A new version of this app is available. Click <a id="reload" style="color:deepskyblue">here</a> to update.</div>
<div id="snackbarDiv">
<div id="snackbar">A new version of this app is available. Click <a id="reload" style="color:deepskyblue">here</a> to update. Eventually you have to restart the App manually.</div>
</div>
<script src="_framework/blazor.webassembly.js"></script>
<script src="_content/TG.Blazor.IndexedDB/indexedDb.Blazor.js"></script>
@@ -42,13 +44,17 @@
let newWorker;
function showUpdateBar() {
let snackbarDiv = document.getElementById('snackbarDiv');
let snackbar = document.getElementById('snackbar');
snackbar.className = 'show';
snackbarDiv.className = 'show';
}
function hideUpdateBar() {
let snackbarDiv = document.getElementById('snackbarDiv');
let snackbar = document.getElementById('snackbar');
snackbar.className = '';
snackbarDiv.className = '';
}
// The click event on the pop up notification
@@ -81,17 +87,13 @@
let refreshing;
navigator.serviceWorker.addEventListener('controllerchange', function () {
if (refreshing) return;
window.location.reload();
window.location = window.location.origin;
refreshing = true;
console.log('Reload to page ' + window.location.origin + ' on controller change.');
});
}
//if ('serviceWorker' in navigator) {
// navigator.serviceWorker.register('service-worker.js')
// .then((reg) => console.log('Service worker registered.', reg))
// .catch((err) => console.log('Failed to register Service worker.', err));
//}
</script>
<script>
function BlazorSetLocalStorage(key, value) {
localStorage.setItem(key, value);

+ 1
- 1
wwwroot/service-worker.js Ver arquivo

@@ -2,7 +2,7 @@
// This is because caching would make development more difficult (changes would not
// be reflected on the first load after each change).
const staticCacheName = 'site-static-v-0-9-3'; // IMPORTANT: CHANGE THE VERSION IN THIS NAME EVERY TIME THE APP IS DEPLOYED ON SERVER WITH CHANGES!!!
const staticCacheName = 'site-static-v-0-9-8'; // IMPORTANT: CHANGE THE VERSION IN THIS NAME EVERY TIME THE APP IS DEPLOYED ON SERVER WITH CHANGES!!!
const appsettings_url = 'appsettings.json';
const assets = [
'./',

Carregando…
Cancelar
Salvar