Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
compareDaily: async (props, { user }) => {
const dailyVisits = await incrementDailyReward();
if (dailyVisits !== user.dailyVisits) {
// console.log('Yay! You came back, your streak is now at: ' + dailyVisits);
dispatch.dailyStreak.set(dailyVisits);
if (dailyVisits > user.dailyVisits) {
dispatch.dailyStreak.rewardUser(dailyVisits);
}
dispatch.user.update({ dailyVisits });
// / Give reward!
} else {
// console.log('ummmm', dailyVisits);
}
},
},
authorized: (user) => {
let _user = user;
if (_user.toJSON) {
_user = user.toJSON();
}
// console.log('True User', _user);
dispatch.user.update(_user);
},
logoutAsync: async () => {
firebase.auth().onAuthStateChanged((auth) => {
if (!auth) {
// TODO: Evan: Y tho...
dispatch.user.clear();
// dispatch.user.signInAnonymously();
NavigationService.navigate('Auth');
} else {
dispatch.user.getAsync();
dispatch.popular.getAsync();
Fire.shared.getMessageList();
NavigationService.navigate('App');
// dispatch.leaders.getAsync({ uid: user.uid });
}
});
},
if (Settings.isCacheProfileUpdateActive) {
const shouldUpdateKey = '@PillarValley/shouldUpdateProfile';
const something = await getItemWithExpiration(shouldUpdateKey);
if (!something) {
const some = await setItemWithExpiration(
shouldUpdateKey,
{ update: true },
Settings.shouldDelayFirebaseProfileSyncInMinutes,
);
dispatch.user.syncLocalToFirebase();
} else {
console.log('Prevent: syncLocalToFirebase');
}
} else {
dispatch.user.syncLocalToFirebase();
}
},
mergeDataWithFirebase: async (props) => {
onSelectIndex={(index, searchRange) =>
dispatch.user.updateUserProfile({ searchRange })
}
rating,
isMatched,
image,
});
if (!uid) return null;
if (this.isBlocked) {
return ;
}
return (
);
};
render() {
return (
);
}
}
render() {
return (
);
}
}
this.setState({ notificationsEnabled }, _ =>
dispatch.user.updateUserProfile({ notificationsEnabled }));
}}
_onLogout = () => {
dispatch.user.logoutAsync();
};
}