Fix newpost and ready for new version
This commit is contained in:
16
App.js
16
App.js
@@ -23,6 +23,7 @@ import MenuView from './Views/Menu.js';
|
||||
import ProfileSettings from './Views/ProfileSettings.js';
|
||||
import InviteView from './Views/Invite.js';
|
||||
import MediaView from './components/MediaView.js';
|
||||
import { useSnapshot } from 'valtio';
|
||||
import GlobalState from './contexts/GlobalState.js';
|
||||
|
||||
|
||||
@@ -83,6 +84,8 @@ async function registerForPushNotificationsAsync() {
|
||||
|
||||
|
||||
const MainNavigation = () => {
|
||||
const gState = useSnapshot(GlobalState);
|
||||
const viewer = gState.me;
|
||||
const [expoPushToken, setExpoPushToken] = useState('');
|
||||
const [notification, setNotification] = useState(false);
|
||||
const notificationListener = useRef();
|
||||
@@ -109,10 +112,15 @@ const MainNavigation = () => {
|
||||
});
|
||||
|
||||
const interval = setInterval(async () => {
|
||||
if(await API.isLoggedIn())
|
||||
console.log("Updating me")
|
||||
GlobalState.me = await API.getMe();
|
||||
}, 10000);
|
||||
if(await API.isLoggedIn()){
|
||||
let me = await API.getMe();
|
||||
//console.log(JSON.stringify(viewer), JSON.stringify(me))
|
||||
if(JSON.stringify(viewer) !== JSON.stringify(me)){
|
||||
console.log("Updating me")
|
||||
GlobalState.me = me;
|
||||
}
|
||||
}
|
||||
}, 30000);
|
||||
|
||||
return () => {
|
||||
Notifications.removeNotificationSubscription(notificationListener.current);
|
||||
|
||||
Reference in New Issue
Block a user