system messages
This commit is contained in:
20
app/hooks/useUpdateMessage.ts
Normal file
20
app/hooks/useUpdateMessage.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { useEffect } from "react";
|
||||
import { usePublicKey } from "../providers/AccountProvider/usePublicKey";
|
||||
import { APP_VERSION, RELEASE_NOTICE } from "../version";
|
||||
import { useSendSystemMessage } from "../providers/SystemAccountsProvider/useSendSystemMessage";
|
||||
|
||||
export function useUpdateMessage() {
|
||||
const publicKey = usePublicKey();
|
||||
const lastNoticeVersion = localStorage.getItem("lastNoticeVersion") || "0.0.0";
|
||||
const send = useSendSystemMessage("updates");
|
||||
|
||||
useEffect(() => {
|
||||
if(publicKey == ""){
|
||||
return;
|
||||
}
|
||||
if(lastNoticeVersion !== APP_VERSION){
|
||||
send(RELEASE_NOTICE);
|
||||
localStorage.setItem("lastNoticeVersion", APP_VERSION);
|
||||
}
|
||||
}, [lastNoticeVersion, publicKey]);
|
||||
}
|
||||
Reference in New Issue
Block a user