Add an update link for android
This commit is contained in:
parent
677ac02835
commit
06daffbd1c
|
@ -0,0 +1,3 @@
|
||||||
|
.mobile {
|
||||||
|
padding-top: 20px;
|
||||||
|
}
|
|
@ -1,5 +1,7 @@
|
||||||
import { Alert } from '@suid/material';
|
import { Alert, Button } from '@suid/material';
|
||||||
import { Component, createSignal, onCleanup, Show } from 'solid-js';
|
import { Component, createSignal, onCleanup, Show } from 'solid-js';
|
||||||
|
import { Browser } from '@capacitor/browser';
|
||||||
|
import style from './Updater.module.css';
|
||||||
|
|
||||||
interface Props {}
|
interface Props {}
|
||||||
|
|
||||||
|
@ -21,18 +23,41 @@ const Updater: Component<Props> = (props) => {
|
||||||
setUpdateNeeded(latestRelease !== currentRelease);
|
setUpdateNeeded(latestRelease !== currentRelease);
|
||||||
};
|
};
|
||||||
|
|
||||||
const intervalId = setInterval(checkUpdate, 30 * 1000);
|
const intervalId = setInterval(checkUpdate, 60 * 60 * 1000);
|
||||||
|
|
||||||
|
checkUpdate();
|
||||||
|
|
||||||
onCleanup(() => {
|
onCleanup(() => {
|
||||||
clearInterval(intervalId);
|
clearInterval(intervalId);
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Show when={updateNeeded()}>
|
<>
|
||||||
<Alert severity='warning'>
|
<Show when={updateNeeded()}>
|
||||||
Please reload this page to update the application.
|
<Show when={window.Capacitor.platform === 'android'}>
|
||||||
</Alert>
|
<div class={style.mobile}>
|
||||||
</Show>
|
<Alert severity='warning'>
|
||||||
|
The app needs to be updated
|
||||||
|
<Button
|
||||||
|
variant='outlined'
|
||||||
|
onclick={() => {
|
||||||
|
Browser.open({
|
||||||
|
url: 'https://dyomedea.app/assets/release/dyomedea.apk',
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Update
|
||||||
|
</Button>
|
||||||
|
</Alert>
|
||||||
|
</div>
|
||||||
|
</Show>
|
||||||
|
<Show when={window.Capacitor.platform === 'web'}>
|
||||||
|
<Alert severity='warning' class={style.mobile}>
|
||||||
|
Please reload this page to update the application.
|
||||||
|
</Alert>
|
||||||
|
</Show>
|
||||||
|
</Show>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue