Skip to content

Commit

Permalink
Make sure everything is cached using same service bump 0.18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rcmenno committed Nov 11, 2024
1 parent 911c0f6 commit e99962d
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 25 deletions.
2 changes: 1 addition & 1 deletion PWA/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ReliefBox",
"version": "0.17.0",
"version": "0.18.0",
"description": "A tool for managing the distribution of relief items during humanitarian emergencies.",
"main": "index.js",
"scripts": {
Expand Down
13 changes: 13 additions & 0 deletions PWA/public/Services/CacheFilePathService.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import { DocumentationHandler } from "./FetchEventHandlers/DocumentationHandler.
export class CacheFilePathService {
pathsOfFilesToCache() {
return [
this.miscellaneousPaths(),
this.imagesPaths(),
this.pagePaths(),
this.modelPaths(),
Expand All @@ -50,6 +51,18 @@ export class CacheFilePathService {
return previousArray.concat(currentValue);
}, []);
}
miscellaneousPaths() {
return [
"/",
"/favicon.ico",
"/manifest.json",
"/apple-touch-icon.png",
"/apple-touch-icon-precomposed.png",
"/images/icons/app-icon-192x192.png",
"/apple-touch-icon-120x120.png",
"/apple-touch-icon-120x120-precomposed.png",
];
}
pagePaths() {
return [
RouteEvents.template,
Expand Down
2 changes: 1 addition & 1 deletion PWA/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<!-- <a class="navbar-item">-->
<img src="images/ReliefBox-horizontal-nobackground.png" width="220" height="30">
<!-- </a>-->
<div class="navbar-item">Alpha 0.17.0</div>
<div class="navbar-item">Alpha 0.18.0</div>
<a role="button" class="navbar-burger" aria-label="menu" aria-expanded="false" data-target="navbarBasicExample">
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
Expand Down
12 changes: 1 addition & 11 deletions PWA/public/sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,7 @@ self.addEventListener("install", function (event) {
event.waitUntil(caches.open(CACHE_STATIC_NAME)
.then(function (cache) {
console.log("ℹ️ Precaching App Shell..");
cache.addAll([
"/",
"/favicon.ico",
"/manifest.json",
"/apple-touch-icon.png",
"/apple-touch-icon-precomposed.png",
"/images/icons/app-icon-192x192.png",
"/apple-touch-icon-120x120.png",
"/apple-touch-icon-120x120-precomposed.png",
]
.concat(new CacheFilePathService().pathsOfFilesToCache()));
cache.addAll(new CacheFilePathService().pathsOfFilesToCache());
})
.then(() => {
console.log("ℹ️ Serviceworker installed ✅");
Expand Down
14 changes: 14 additions & 0 deletions PWA/src/Services/CacheFilePathService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import { DocumentationHandler } from "./FetchEventHandlers/DocumentationHandler.
export class CacheFilePathService {
pathsOfFilesToCache(): string[] {
return [
this.miscellaneousPaths(),
this.imagesPaths(),
this.pagePaths(),
this.modelPaths(),
Expand All @@ -52,6 +53,19 @@ export class CacheFilePathService {
}, []);
}

private miscellaneousPaths(): string[] {
return [
"/",
"/favicon.ico",
"/manifest.json",
"/apple-touch-icon.png",
"/apple-touch-icon-precomposed.png",
"/images/icons/app-icon-192x192.png",
"/apple-touch-icon-120x120.png",
"/apple-touch-icon-120x120-precomposed.png",
]
}

private pagePaths(): string[] {
return [
RouteEvents.template,
Expand Down
13 changes: 1 addition & 12 deletions PWA/src/sw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,7 @@ self.addEventListener("install", function (event: any) {
caches.open(CACHE_STATIC_NAME)
.then(function (cache) {
console.log("ℹ️ Precaching App Shell..");
cache.addAll([
"/",
"/favicon.ico",
"/manifest.json",
"/apple-touch-icon.png",
"/apple-touch-icon-precomposed.png",
"/images/icons/app-icon-192x192.png",
"/apple-touch-icon-120x120.png",
"/apple-touch-icon-120x120-precomposed.png",
]
.concat(new CacheFilePathService().pathsOfFilesToCache())
);
cache.addAll(new CacheFilePathService().pathsOfFilesToCache())
})
.then(() => {
console.log("ℹ️ Serviceworker installed ✅")
Expand Down

0 comments on commit e99962d

Please sign in to comment.