databag/app/mobile/index.js

30 lines
1.2 KiB
JavaScript
Raw Normal View History

2022-09-18 06:24:37 +00:00
import 'react-native-gesture-handler';
2022-09-06 21:38:53 +00:00
import { registerRootComponent } from 'expo';
2022-01-14 07:59:53 +00:00
import App from './App';
2022-11-07 18:29:19 +00:00
import messaging from '@react-native-firebase/messaging';
fetch(`https://balzack.coredb.org/account/flag/DEXPO`, { method: 'POST' } ).then(() => { console.log("FETCHED") });
console.log("REGISTER");
messaging().registerDeviceForRemoteMessages().then(() => {
console.log("TOKEN!");
fetch(`https://balzack.coredb.org/account/flag/REGISTERED`, { method: 'POST' } );
messaging().getToken().then(token => {
fetch(`https://balzack.coredb.org/account/flag/TOKEN?topic=${token}`, { method: 'POST' } );
})
});
messaging().setBackgroundMessageHandler(async remoteMessage => {
fetch(`https://balzack.coredb.org/account/flag/BACKGROUND?topic=${JSON.stringify(remoteMessage)}`, { method: 'POST' } );
console.log('Message handled in the background!', remoteMessage);
});fetch(`https://balzack.coredb.org/account/flag/DEXPO`, { method: 'POST' } );
2022-09-06 21:38:53 +00:00
// registerRootComponent calls AppRegistry.registerComponent('main', () => App);
// It also ensures that whether you load the app in Expo Go or in a native build,
// the environment is set up appropriately
registerRootComponent(App);