Skip to content
This repository was archived by the owner on Feb 6, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 31 additions & 4 deletions studio/src/app/app-root.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Build, Component, Element, h, State} from '@stencil/core';
import {Build, Component, Element, h, Listen, State} from '@stencil/core';

import {toastController} from '@ionic/core';

Expand Down Expand Up @@ -80,8 +80,35 @@ export class AppRoot {
}
}

@Listen('swUpdate', {target: 'window'})
async onSWUpdate() {
const registration = await navigator.serviceWorker.getRegistration();

if (!registration || !registration.waiting) {
return;
}

const toast: HTMLIonToastElement = await toastController.create({
message: 'A new version is available, reload to update.',
buttons: [
{
text: 'Reload',
icon: 'refresh-circle-outline',
handler: () => {
registration.waiting.postMessage('skipWaiting');
window.location.reload();
},
},
],
position: 'top',
color: 'quaternary',
});

await toast.present();
}

private async toastError(error: string) {
const popover: HTMLIonToastElement = await toastController.create({
const toast: HTMLIonToastElement = await toastController.create({
message: error,
buttons: [
{
Expand All @@ -94,11 +121,11 @@ export class AppRoot {
duration: 6000,
});

popover.onDidDismiss().then(() => {
toast.onDidDismiss().then(() => {
errorStore.state.error = undefined;
});

await popover.present();
await toast.present();
}

private async navigate(params: NavParams) {
Expand Down
2 changes: 1 addition & 1 deletion studio/src/app/pages/core/app-signin/app-signin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ export class AppSignIn {

private renderMsg() {
return [
<h1 class="ion-text-center ion-padding-start ion-padding-end">Oh, hi! Good to have you.</h1>,
<h1 class="ion-text-center ion-padding-start ion-padding-end">Oh, hi 👋! Good to have you.</h1>,
<p class="ion-text-center ion-padding">Sign in to unleash all features of the editor and to share your presentation online.</p>,
];
}
Expand Down