import { open } from '@op-engineering/op-sqlite' ;
import AsyncStorage from '@react-native-async-storage/async-storage' ;
import { useNavigationContainerRef } from '@react-navigation/native' ;
import { QueryClient } from '@tanstack/query-core' ;
} from '@xerlock/client' ;
import * as Notifications from 'expo-notifications' ;
import * as SecureStore from 'expo-secure-store' ;
import * as SQLite from 'expo-sqlite' ;
import { useEffect } from 'react' ;
import { MMKV } from 'react-native-mmkv' ;
import { showNotification } from '../notifications/show-notification' ;
import { caseSlice, store, suspectsSlice } from '../redux/store' ;
import { useCaseStore, useSuspectStore } from '../zustand/stores' ;
const queryClient = new QueryClient ();
const userPrefs = new MMKV ({ id: 'user-prefs' });
export const useXerlock = () => {
const navigationRef = useNavigationContainerRef ();
ignoreUrls: [ '/health' , /analytics/ ],
suspects: useSuspectStore,
actions: [ callableAction (useSuspectStore, 'addSuspect' , [ 'Irene Adler' ])],
dispatchable (suspectsSlice.actions.added, { payload: 'Irene Adler' }),
asyncStorage: AsyncStorage,
secureStore: SecureStore,
tanstackQuery: queryClient,
main: expoSqliteAdapter (SQLite. openDatabaseAsync ( 'app.db' )),
cache: opSqliteAdapter ( open ({ name: 'cache.db' })),
navigation: { ref: navigationRef },
expoNotifications: Notifications,
// Used instead of `expoNotifications` when both are set.
onRemoteMessage : ( message ) => showNotification (message.notification),