Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
...nextFirebaseAuthData,
};
const updates = {};
for (const key of Object.keys(combinedUserData)) {
if (
combinedUserData[key] !== undefined &&
combinedUserData[key] !== nextLocalUserData[key]
) {
updates[key] = combinedUserData[key];
}
}
if (Object.keys(updates).length > 0) {
dispatch.user.update(updates);
}
// dispatch.dailyStreak.compareDaily();
dispatch.users.update({
uid: combinedUserData.uid,
user: combinedUserData,
});
console.log('Main:userdata:', combinedUserData);
if (Settings.isCacheProfileUpdateActive) {
const shouldUpdateKey = '@Bute/shouldUpdateProfile';
const something = await PantryStorage.getItemWithExpiration(shouldUpdateKey);
if (!something) {
const some = await PantryStorage.setItemWithExpiration(
shouldUpdateKey,
{ update: true },
Settings.shouldDelayFirebaseProfileSyncInMinutes,
);
dispatch.user.syncLocalToFirebase();
} else {
console.log('Prevent: syncLocalToFirebase');
updateWithUID = async (uid, update) => {
if (!uid) return;
const {
image, name, about, likes, rating, relationship,
} = this.props;
if (!image || update) {
dispatch.users.getProfileImage({ uid });
}
if (!name || update) {
dispatch.users.getPropertyForUser({ uid, property: 'first_name' });
}
if (!about || update) {
dispatch.users.getPropertyForUser({ uid, property: 'about' });
}
if (!likes || update) {
dispatch.users.getPropertyForUser({ uid, property: 'likes' });
}
if (!rating || update) {
dispatch.users.getPropertyForUser({ uid, property: 'rating' });
}
if (!relationship || update) {
dispatch.relationships.getAsync({ uid });
}
const isMatched = await new Promise(res =>
dispatch.relationships.isMatched({ uid, callback: res }));
// this.props.navigation.setParams({ isMatched, name, uid });
LayoutAnimation.easeInEaseOut();
const user = await new Promise(res =>
dispatch.users.ensureUserIsLoadedAsync({ uid, callback: res }));
console.log('_parseMessage: has user', !!user, uid);
const userData = snapshot.data();
if (userData) {
const nextUser = {
...filterUser(userData),
ensured: Date.now(),
};
console.log('ensureUserIsLoadedAsync: C: userData', nextUser);
dispatch.users.update({
uid,
user: nextUser,
});
return { isUpdated: true, user: nextUser };
}
console.log('REMOVED USER', uid);
dispatch.users.remove({ uid });
return { isUpdated: true, isRemoved: true };
} catch ({ message }) {
throw new Error(`getPropForUser ${message}`);
}
}
return { isUpdated: false, user: storedUser };
}
function uploadEntryInLocalDatabase(updates) {
dispatch.users.update({ uid: Fire.shared.uid, user: updates });
}
const user = {
handleLoadMore = () => {
dispatch.users.getPaged({ size: 5 });
};
render() {
function navigateToUserSpecificScreen(routeName, uid, params = {}) {
dispatch.users.ensureUserIsLoadedAsync({ uid });
let groupId;
if (IdManager.isInteractable(uid)) groupId = IdManager.getGroupId(uid);
navigate(routeName, { groupId, ...params, uid });
}
onImageUpdated={async () => dispatch.users.getProfileImage({ uid })}
onRatingPressed={dispatch.user.changeRating}
const user = await (new Promise(res => dispatch.users.ensureUserIsLoadedAsync({ uid: sender, callback: res }) ));
const previewMessage = this.formatMessageForPreview(message, groupId, user, group);
clearUser: ({ uid }) => dispatch.users.set({ uid, user: null }),
getProfileImage: ({ uid, forceUpdate }) => {