Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
onItemDelete = (thought: SavedThought) => {
// Ignore the typescript error here, Expo's v31 has a bug
// Upgrade to 32 when it's released to fix
universalHaptic.notification(Haptic.NotificationFeedbackType.Success);
deleteThought(thought.uuid).then(() => this.loadExercises());
};
onNext = () => {
haptic.impact(Haptic.ImpactFeedbackStyle.Light);
// Title screen => Article Screen
if (this.state.index === -1) {
setTimeout(() => this.setState({ articleTopBarPose: "visible" }), 100);
}
// Article screen => Finish
if (this.state.index >= this.props.pages.length - 1) {
haptic.notification(Haptic.NotificationFeedbackType.Success);
this.props.onFinish();
return;
}
this.setState(prevState => {
if (prevState.index + 1 >= this.props.pages.length) {
return prevState;
}
return {
...prevState,
rightFlasherPose: "hidden",
index: prevState.index + 1,
};
});
clearInterval(this._rightFlicker);
this.setState(prevState => {
return {
...prevState,
feelingGoodFolks: prevState.feelingGoodFolks + 1,
};
});
await scheduleHappyFolksNotification(
dayjs()
.add(1, "day")
.toISOString()
);
stats.userSharedSuccess();
haptic.notification(Haptic.NotificationFeedbackType.Success);
setTimeout(() => {
this.props.navigation.navigate(FINISHED_SCREEN, {
thought: this.state.thought,
});
}, 100);
};
onFinish = async () => {
haptic.notification(Haptic.NotificationFeedbackType.Success);
resetNavigationTo(this.props.navigation, THOUGHT_SCREEN);
};
onNext = async () => {
if (followUpState(this.state.thought) === "ready") {
const oldThought = this.state.thought;
oldThought.followUpCompleted = true;
await saveThought(oldThought);
}
if (await this.shouldSendToAndroidReview()) {
this.props.navigation.navigate(FEEDBACK_SCREEN);
return;
}
resetNavigationTo(this.props.navigation, THOUGHT_SCREEN);
haptic.notification(Haptic.NotificationFeedbackType.Success);
};
import Button from '../components/Button';
import Colors from '../constants/Colors';
import MonoText from '../components/MonoText';
const sections = [
{
methodName: 'notificationAsync',
method: Haptics.notificationAsync,
data: [
{
accessor: 'Haptics.NotificationFeedbackType.Success',
value: Haptics.NotificationFeedbackType.Success,
},
{
accessor: 'Haptics.NotificationFeedbackType.Warning',
value: Haptics.NotificationFeedbackType.Warning,
},
{
accessor: 'Haptics.NotificationFeedbackType.Error',
value: Haptics.NotificationFeedbackType.Error,
},
],
},
{
methodName: 'impactAsync',
method: Haptics.impactAsync,
data: [
{
accessor: 'Haptics.ImpactFeedbackStyle.Light',
value: Haptics.ImpactFeedbackStyle.Light,
},
{
onNext = async () => {
if (this.state.checkup.currentMood === "unselected") {
return;
}
haptic.notification(Haptic.NotificationFeedbackType.Success);
await saveCheckup(this.state.checkup);
await scheduleBoost(COMPLETE_CHECKUP);
if (this.state.checkup.currentMood === "good") {
await scheduleBoost(FELT_BETTER);
}
const nextCheckupDate = dayjs()
.add(1, "week")
.toISOString();
await saveNextCheckupDate(nextCheckupDate);
scheduleNotification(nextCheckupDate, CHECKUP_ONESIGNAL_TEMPLATE);
userFinishedCheckup(this.state.checkup.currentMood);
if (this.state.checkup.currentMood === "bad") {
this.props.navigation.navigate(CHECKUP_REDIRECT_SCREEN);
setTimeout(() => {
this.setState({ view: "peak" });
universalHaptic.notification(Haptic.NotificationFeedbackType.Success);
}, 350);
}