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:
29
lstMobile/src/hooks/useServerCheck.ts
Normal file
29
lstMobile/src/hooks/useServerCheck.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { create } from "zustand";
|
||||
|
||||
type ServerVersion = {
|
||||
packageName: string;
|
||||
versionName: string;
|
||||
versionCode: number;
|
||||
minSupportedVersionCode: number;
|
||||
downloadUrl: string;
|
||||
};
|
||||
|
||||
type AppState = {
|
||||
serverVersion: ServerVersion | null;
|
||||
|
||||
setServerVersion: (data: ServerVersion) => void;
|
||||
};
|
||||
|
||||
export const useServerStore = create<AppState>((set, get) => ({
|
||||
serverVersion: null,
|
||||
hasUpdate: () => {
|
||||
const v = get().serverVersion;
|
||||
if (!v) return false;
|
||||
|
||||
return v.versionCode < v.minSupportedVersionCode;
|
||||
},
|
||||
setServerVersion: (data) =>
|
||||
set(() => ({
|
||||
serverVersion: data,
|
||||
})),
|
||||
}));
|
||||
Reference in New Issue
Block a user