feat(mobile): update notifications and more error handling added
All checks were successful
Build and Push LST Docker Image / docker (push) Successful in 1m24s
All checks were successful
Build and Push LST Docker Image / docker (push) Successful in 1m24s
This commit is contained in:
40
lstMobile/src/components/UpdateFooter.tsx
Normal file
40
lstMobile/src/components/UpdateFooter.tsx
Normal file
@@ -0,0 +1,40 @@
|
||||
import Constants from "expo-constants";
|
||||
import { Link } from "expo-router";
|
||||
import { Text, View } from "react-native";
|
||||
import { useServerStore } from "../hooks/useServerCheck";
|
||||
|
||||
export function GlobalFooter() {
|
||||
const build = Constants.expoConfig?.android?.versionCode ?? 1;
|
||||
const serverVersion = useServerStore((s) => s.serverVersion);
|
||||
const hasUpdate =
|
||||
serverVersion && serverVersion?.minSupportedVersionCode > build;
|
||||
const shouldUpdate = serverVersion && serverVersion?.versionCode > build;
|
||||
|
||||
if (serverVersion && serverVersion?.versionCode <= build) return;
|
||||
return (
|
||||
<View>
|
||||
<View>
|
||||
{hasUpdate && (
|
||||
<View className="items-center h-[75px] bg-[#EB091A]">
|
||||
<Link href={"/updateScreen"}>
|
||||
<Text className="h-[75px] font-medium text-base text-wrap text-center">
|
||||
Critical updates pending, once you are completed with your task
|
||||
please click me for instructions to update
|
||||
</Text>
|
||||
</Link>
|
||||
</View>
|
||||
)}
|
||||
|
||||
{!hasUpdate && shouldUpdate && (
|
||||
<View className="bg-[#FDBA74]">
|
||||
<Link href={"/updateScreen"}>
|
||||
<Text className="h-[32] font-medium text-lg text-wrap text-center">
|
||||
There is an update click me for instructions
|
||||
</Text>
|
||||
</Link>
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user