getting file and all, now just need to sort of hand off to database and write to the right places

This commit is contained in:
Arjun Patel
2022-02-05 14:53:42 -08:00
parent be28e6dc88
commit e92a54623c
5 changed files with 115 additions and 15 deletions
@@ -131,10 +131,10 @@ export default function MainRecoilDataHandler() {
allUsersToCache = [...allUsersToCache, ...currconvo.activeMembers];
});
console.log(
"going to try caching a bunch of users...maybe some duplicates",
allUsersToCache
);
// console.log(
// "going to try caching a bunch of users...maybe some duplicates",
// allUsersToCache
// );
// if this userId is in the contacts map, then cool
// otherwise fetch with userService
@@ -145,12 +145,11 @@ export default function MainRecoilDataHandler() {
relContacts.get(oUser) instanceof User
) {
// do nothing
console.log("user already cached, no need to re-cache");
// console.log("user already cached, no need to re-cache");
} else {
// otherwise, fetch document from firestore and then set the cache
const retrievedUser = await userService.getUser(oUser);
console.log("fetching user to add to cache");
// console.log("fetching user to add to cache");
if (retrievedUser) {
setRelContacts(new Map(relContacts.set(oUser, retrievedUser)));
@@ -165,7 +164,7 @@ export default function MainRecoilDataHandler() {
newMap.set(currconvo.id, currconvo);
});
console.log("updated convos: ", newMap);
// console.log("updated convos: ", newMap);
return newMap;
});
+10 -2
View File
@@ -43,6 +43,9 @@ export enum RecoilActions {
COUNT_DEFAULT_CONVOS_SELECTOR = "COUNT_DEFAULT_CONVOS_SELECTOR",
COUNT_NAVIGATION_ITEMS = "COUNT_NAVIGATION_ITEMS",
IS_RECORDING_ATOM = "IS_RECORDING_ATOM",
HAS_MIC_PERMISSIONS = "HAS_MIC_PERMISSIONS",
}
export const nirvanaUserDataAtom = atom<NirvanaUser | null>({
@@ -378,8 +381,8 @@ export const allRelevantContactsAtom = atom<Map<string, NirvanaUser>>({
// and return their full information...either get from cache if there or fetch from database if not and update cache
// RECORDING, SHORTCUTS, PLAYING, MIC, HEADPHONES, etc.
export const isRecording = atom<boolean>({
key: "haha",
export const isRecordingAtom = atom<boolean>({
key: RecoilActions.IS_RECORDING_ATOM,
default: false,
});
@@ -388,3 +391,8 @@ export const selectedPriorityConvoAtom = atom<string | null>({
key: RecoilActions.SELECTED_CONVERSATION_ATOM,
default: null,
});
export const hasMicPermissionsAtom = atom<boolean>({
key: RecoilActions.HAS_MIC_PERMISSIONS,
default: false,
});