Skip to content

Commit

Permalink
fix(offline-interface): improve SW update message & actions
Browse files Browse the repository at this point in the history
  • Loading branch information
KaiVandivier committed Sep 24, 2021
1 parent f30dd88 commit 1335ce1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
11 changes: 7 additions & 4 deletions pwa/i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"POT-Creation-Date: 2021-06-08T14:38:45.083Z\n"
"PO-Revision-Date: 2021-06-08T14:38:45.083Z\n"
"POT-Creation-Date: 2021-09-24T15:38:52.938Z\n"
"PO-Revision-Date: 2021-09-24T15:38:52.938Z\n"

msgid ""
"App updates are ready and will be activated after all tabs of this app are "
Expand All @@ -15,5 +15,8 @@ msgstr ""
"App updates are ready and will be activated after all tabs of this app are "
"closed. Skip waiting and reload to update now?"

msgid "Update"
msgstr "Update"
msgid "Update and reload"
msgstr "Update and reload"

msgid "Not now"
msgstr "Not now"
14 changes: 8 additions & 6 deletions pwa/src/offline-interface/offline-interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,19 @@ export class OfflineInterface {
if (!promptUpdate) {
return
}
const reloadMessage = i18n.t(
'App updates are ready and will be activated after all tabs of this app are closed. Skip waiting and reload to update now?'
)

const message = i18n.t("There's an update available for this app.")
const onConfirm = () =>
registration.waiting.postMessage({
type: swMsgs.skipWaiting,
})
const actions = [
{ label: i18n.t('Update and reload'), onClick: onConfirm },
{ label: i18n.t('Not now'), onClick: () => {} },
]
promptUpdate({
message: reloadMessage,
action: i18n.t('Update'),
onConfirm: onConfirm,
message,
actions,
})
}

Expand Down

0 comments on commit 1335ce1

Please sign in to comment.