adds update functionality
This commit is contained in:
@@ -1,7 +1,26 @@
|
|||||||
import React from "react";
|
import React, { useEffect } from "react";
|
||||||
|
import { Slot } from "expo-router";
|
||||||
|
import * as Updates from "expo-updates";
|
||||||
|
|
||||||
import {Slot} from "expo-router";
|
|
||||||
export default function App() {
|
export default function App() {
|
||||||
return <Slot/>;
|
const checkForUpdates = async () => {
|
||||||
}
|
try {
|
||||||
|
const update = await Updates.checkForUpdateAsync();
|
||||||
|
if (update.isAvailable) {
|
||||||
|
console.log("Update verfügbar. Wird heruntergeladen...");
|
||||||
|
await Updates.fetchUpdateAsync();
|
||||||
|
await Updates.reloadAsync(); // App neu starten, um Update anzuwenden
|
||||||
|
} else {
|
||||||
|
console.log("Keine Updates verfügbar.");
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error("Fehler beim Prüfen auf Updates:", e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
checkForUpdates(); // Nur einmal beim Laden der App ausführen
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return <Slot />;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user