From 96af7291ea5b2c5ed6372e7b6f7725e67c69f1ba Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Fri, 10 Jun 2022 04:33:42 +0800 Subject: [PATCH 1/3] fix(PWA): sometimes update notification is not triggered --- assets/js/pwa/app.js | 57 +++++++++++++++++--------------------------- 1 file changed, 22 insertions(+), 35 deletions(-) diff --git a/assets/js/pwa/app.js b/assets/js/pwa/app.js index 9eb1a03..ab4b174 100644 --- a/assets/js/pwa/app.js +++ b/assets/js/pwa/app.js @@ -3,50 +3,37 @@ layout: compress permalink: '/app.js' --- -const keyWaiting = 'sw-waiting'; const $notification = $('#notification'); const $btnRefresh = $('#notification .toast-body>button'); -function skipWating(registration) { - registration.waiting.postMessage('SKIP_WAITING'); - localStorage.removeItem(keyWaiting); -} - if ('serviceWorker' in navigator) { /* Registering Service Worker */ navigator.serviceWorker.register('{{ "/sw.js" | relative_url }}') .then(registration => { - if (registration) { - registration.addEventListener('updatefound', () => { - let serviceWorker = registration.installing; - serviceWorker.addEventListener('statechange', () => { - if (serviceWorker.state === 'installed') { - if (navigator.serviceWorker.controller) { - $notification.toast('show'); - /* in case the user ignores the notification */ - localStorage.setItem(keyWaiting, true); - } - } - }); - }); - - $btnRefresh.click(() => { - skipWating(registration); - $notification.toast('hide'); - }); - - if (localStorage.getItem(keyWaiting)) { - if (registration.waiting) { - /* there's a new Service Worker waiting to be activated */ - $notification.toast('show'); - } else { - /* closed all open pages after receiving notification */ - localStorage.removeItem(keyWaiting); - } - } + /* in case the user ignores the notification */ + if (registration.waiting) { + $notification.toast('show'); } - }); + + registration.addEventListener('updatefound', () => { + registration.installing.addEventListener('statechange', () => { + if (registration.waiting) { + if (navigator.serviceWorker.controller) { + $notification.toast('show'); + } + } + }); + }); + + $btnRefresh.click(() => { + if (registration.waiting) { + registration.waiting.postMessage('SKIP_WAITING'); + } + $notification.toast('hide'); + }); + } + ); let refreshing = false; From 971fe03ec329ae49e7d60fe3af6101cfbd1acd6c Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Fri, 10 Jun 2022 23:27:23 +0800 Subject: [PATCH 2/3] fix: exclude CHANGELOG from output --- _config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/_config.yml b/_config.yml index ad085a8..640180d 100644 --- a/_config.yml +++ b/_config.yml @@ -185,6 +185,7 @@ exclude: - '*.gemspec' - tools - README.md + - CHANGELOG.md - LICENSE - gulpfile.js - node_modules From 856ef1148711096b54392862edf61a0fbe67adf8 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Sat, 18 Jun 2022 00:09:22 +0800 Subject: [PATCH 3/3] chore(release): 5.2.1 --- CHANGELOG.md | 8 ++++++++ _javascript/copyright | 2 +- _sass/jekyll-theme-chirpy.scss | 2 +- assets/js/dist/categories.min.js | 2 +- assets/js/dist/commons.min.js | 2 +- assets/js/dist/home.min.js | 2 +- assets/js/dist/misc.min.js | 2 +- assets/js/dist/page.min.js | 2 +- assets/js/dist/post.min.js | 2 +- assets/js/dist/pvreport.min.js | 2 +- jekyll-theme-chirpy.gemspec | 2 +- package.json | 2 +- 12 files changed, 19 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 98c1909..68c48eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,14 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [5.2.1](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v5.2.0...v5.2.1) (2022-06-17) + + +### Bug Fixes + +* exclude CHANGELOG from output ([971fe03](https://github.com/cotes2020/jekyll-theme-chirpy/commit/971fe03ec329ae49e7d60fe3af6101cfbd1acd6c)) +* **PWA:** sometimes update notification is not triggered ([96af729](https://github.com/cotes2020/jekyll-theme-chirpy/commit/96af7291ea5b2c5ed6372e7b6f7725e67c69f1ba)) + ## [5.2.0](https://github.com/cotes2020/jekyll-theme-chirpy/compare/v5.1.0...v5.2.0) (2022-06-09) diff --git a/_javascript/copyright b/_javascript/copyright index fb4de71..2241015 100644 --- a/_javascript/copyright +++ b/_javascript/copyright @@ -1,5 +1,5 @@ /*! - * Chirpy v5.2.0 (https://github.com/cotes2020/jekyll-theme-chirpy/) + * Chirpy v5.2.1 (https://github.com/cotes2020/jekyll-theme-chirpy/) * © 2019 Cotes Chung * MIT Licensed */ diff --git a/_sass/jekyll-theme-chirpy.scss b/_sass/jekyll-theme-chirpy.scss index 29b6e44..85cbf28 100644 --- a/_sass/jekyll-theme-chirpy.scss +++ b/_sass/jekyll-theme-chirpy.scss @@ -1,7 +1,7 @@ /*! * The styles for Jekyll theme Chirpy * - * Chirpy v5.2.0 (https://github.com/cotes2020/jekyll-theme-chirpy) + * Chirpy v5.2.1 (https://github.com/cotes2020/jekyll-theme-chirpy) * © 2019 Cotes Chung * MIT Licensed */ diff --git a/assets/js/dist/categories.min.js b/assets/js/dist/categories.min.js index 8bed3a9..34f42f5 100644 --- a/assets/js/dist/categories.min.js +++ b/assets/js/dist/categories.min.js @@ -1,5 +1,5 @@ /*! - * Chirpy v5.2.0 (https://github.com/cotes2020/jekyll-theme-chirpy/) + * Chirpy v5.2.1 (https://github.com/cotes2020/jekyll-theme-chirpy/) * © 2019 Cotes Chung * MIT Licensed */ diff --git a/assets/js/dist/commons.min.js b/assets/js/dist/commons.min.js index bd78fa3..249d2c7 100644 --- a/assets/js/dist/commons.min.js +++ b/assets/js/dist/commons.min.js @@ -1,5 +1,5 @@ /*! - * Chirpy v5.2.0 (https://github.com/cotes2020/jekyll-theme-chirpy/) + * Chirpy v5.2.1 (https://github.com/cotes2020/jekyll-theme-chirpy/) * © 2019 Cotes Chung * MIT Licensed */ diff --git a/assets/js/dist/home.min.js b/assets/js/dist/home.min.js index cb2516c..0fa7b91 100644 --- a/assets/js/dist/home.min.js +++ b/assets/js/dist/home.min.js @@ -1,5 +1,5 @@ /*! - * Chirpy v5.2.0 (https://github.com/cotes2020/jekyll-theme-chirpy/) + * Chirpy v5.2.1 (https://github.com/cotes2020/jekyll-theme-chirpy/) * © 2019 Cotes Chung * MIT Licensed */ diff --git a/assets/js/dist/misc.min.js b/assets/js/dist/misc.min.js index cb2516c..0fa7b91 100644 --- a/assets/js/dist/misc.min.js +++ b/assets/js/dist/misc.min.js @@ -1,5 +1,5 @@ /*! - * Chirpy v5.2.0 (https://github.com/cotes2020/jekyll-theme-chirpy/) + * Chirpy v5.2.1 (https://github.com/cotes2020/jekyll-theme-chirpy/) * © 2019 Cotes Chung * MIT Licensed */ diff --git a/assets/js/dist/page.min.js b/assets/js/dist/page.min.js index 2e817ac..54a9e55 100644 --- a/assets/js/dist/page.min.js +++ b/assets/js/dist/page.min.js @@ -1,5 +1,5 @@ /*! - * Chirpy v5.2.0 (https://github.com/cotes2020/jekyll-theme-chirpy/) + * Chirpy v5.2.1 (https://github.com/cotes2020/jekyll-theme-chirpy/) * © 2019 Cotes Chung * MIT Licensed */ diff --git a/assets/js/dist/post.min.js b/assets/js/dist/post.min.js index edd7514..332b0fc 100644 --- a/assets/js/dist/post.min.js +++ b/assets/js/dist/post.min.js @@ -1,5 +1,5 @@ /*! - * Chirpy v5.2.0 (https://github.com/cotes2020/jekyll-theme-chirpy/) + * Chirpy v5.2.1 (https://github.com/cotes2020/jekyll-theme-chirpy/) * © 2019 Cotes Chung * MIT Licensed */ diff --git a/assets/js/dist/pvreport.min.js b/assets/js/dist/pvreport.min.js index 157ef40..2506259 100644 --- a/assets/js/dist/pvreport.min.js +++ b/assets/js/dist/pvreport.min.js @@ -1,5 +1,5 @@ /*! - * Chirpy v5.2.0 (https://github.com/cotes2020/jekyll-theme-chirpy/) + * Chirpy v5.2.1 (https://github.com/cotes2020/jekyll-theme-chirpy/) * © 2019 Cotes Chung * MIT Licensed */ diff --git a/jekyll-theme-chirpy.gemspec b/jekyll-theme-chirpy.gemspec index 8d972e3..5cfade7 100644 --- a/jekyll-theme-chirpy.gemspec +++ b/jekyll-theme-chirpy.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |spec| spec.name = "jekyll-theme-chirpy" - spec.version = "5.2.0" + spec.version = "5.2.1" spec.authors = ["Cotes Chung"] spec.email = ["cotes.chung@gmail.com"] diff --git a/package.json b/package.json index 5a47ed9..ffcb38f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jekyll-theme-chirpy", - "version": "5.2.0", + "version": "5.2.1", "description": "A minimal, responsive, and powerful Jekyll theme for presenting professional writing.", "repository": { "type": "git",