From e3794581573fafb5d1096368ac4dd14e97ecba50 Mon Sep 17 00:00:00 2001 From: Yash Maheshwari Date: Thu, 9 Nov 2023 16:13:04 +0530 Subject: [PATCH 1/6] Added: register-service-worker package for service worker --- package-lock.json | 11 +++++++++++ package.json | 1 + 2 files changed, 12 insertions(+) diff --git a/package-lock.json b/package-lock.json index 54066a4..75729d1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,6 +17,7 @@ "luxon": "^3.3.0", "pinia": "2.0.36", "pinia-plugin-persistedstate": "^3.1.0", + "register-service-worker": "^1.7.2", "vue": "^3.3.4", "vue-barcode-reader": "^1.0.3", "vue-i18n": "^9.2.2" @@ -4055,6 +4056,11 @@ } ] }, + "node_modules/register-service-worker": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/register-service-worker/-/register-service-worker-1.7.2.tgz", + "integrity": "sha512-CiD3ZSanZqcMPRhtfct5K9f7i3OLCcBBWsJjLh1gW9RO/nS94sVzY59iS+fgYBOBqaBpf4EzfqUF3j9IG+xo8A==" + }, "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -7829,6 +7835,11 @@ "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", "dev": true }, + "register-service-worker": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/register-service-worker/-/register-service-worker-1.7.2.tgz", + "integrity": "sha512-CiD3ZSanZqcMPRhtfct5K9f7i3OLCcBBWsJjLh1gW9RO/nS94sVzY59iS+fgYBOBqaBpf4EzfqUF3j9IG+xo8A==" + }, "require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", diff --git a/package.json b/package.json index ea5d30f..bfde7fa 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "luxon": "^3.3.0", "pinia": "2.0.36", "pinia-plugin-persistedstate": "^3.1.0", + "register-service-worker": "^1.7.2", "vue": "^3.3.4", "vue-barcode-reader": "^1.0.3", "vue-i18n": "^9.2.2" From ac5d35a5f4cc826d244e0fc7096b48ebb786bd8e Mon Sep 17 00:00:00 2001 From: Yash Maheshwari Date: Thu, 9 Nov 2023 16:38:05 +0530 Subject: [PATCH 2/6] Implemented: support to notify user about new version and update app from settings page --- src/components/AppVersionInfo.vue | 13 +++++++++++ src/index.ts | 18 ++++++++++++++++ src/service-worker.ts | 36 +++++++++++++++++++++++++++++++ src/utils/index.ts | 24 ++++++++++++++++++++- 4 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 src/service-worker.ts diff --git a/src/components/AppVersionInfo.vue b/src/components/AppVersionInfo.vue index 5aa4793..86846fd 100644 --- a/src/components/AppVersionInfo.vue +++ b/src/components/AppVersionInfo.vue @@ -5,14 +5,27 @@

{{ "Version: " + appVersion }}

{{ "Built: " + getDateTime(appInfo.builtTime) }}

+ {{ $t("Update") }}