Files
carry-your-live/carry-your-live/src/components/UpdateNotifier.tsx
T
tech08mag ecb7fbefb1
Build APK / build (push) Canceled after 0s
fixxed big ui cavia
2026-08-07 01:06:03 +02:00

30 lines
863 B
TypeScript

import { useEffect } from 'react';
import { Alert, Linking } from 'react-native';
import { checkForUpdates, wasPromptedFor, markPrompted } from '@/services/updates';
export function UpdateNotifier() {
useEffect(() => {
const run = async () => {
const update = await checkForUpdates();
if (!update || (await wasPromptedFor(update.tagName))) return;
await markPrompted(update.tagName);
const url = update.apkUrl ?? update.releaseUrl;
Alert.alert(
'Update available',
`A new version (${update.version}) is available for download.`,
[
{ text: 'Later', style: 'cancel' },
{
text: 'Download',
onPress: () => {
if (url) Linking.openURL(url).catch(() => {});
},
},
],
);
};
run();
}, []);
return null;
}