-
-
Notifications
You must be signed in to change notification settings - Fork 122
Feature/in app notifications #149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| > Why do I have a folder named ".expo" in my project? | ||
| The ".expo" folder is created when an Expo project is started using "expo start" command. | ||
| > What do the files contain? | ||
| - "devices.json": contains information about devices that have recently opened this project. This is used to populate the "Development sessions" list in your development builds. | ||
| - "settings.json": contains the server configuration that is used to serve the application manifest. | ||
| > Should I commit the ".expo" folder? | ||
| No, you should not share the ".expo" folder. It does not contain any information that is relevant for other developers working on the project, it is specific to your machine. | ||
| Upon project creation, the ".expo" folder is already added to your ".gitignore" file. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| { | ||
| "devices": [] | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,21 +1,26 @@ | ||||||||||||||||||||||||
| import React from 'react'; | ||||||||||||||||||||||||
| import React, { useEffect } from 'react'; | ||||||||||||||||||||||||
| import { NavigationContainer } from '@react-navigation/native'; | ||||||||||||||||||||||||
| import { Provider as PaperProvider} from 'react-native-paper'; | ||||||||||||||||||||||||
| import { Provider as PaperProvider } from 'react-native-paper'; | ||||||||||||||||||||||||
| import { ThemeProvider } from './src/theme/ThemeContext'; | ||||||||||||||||||||||||
| import { AgentProvider } from './src/context/AgentContext'; | ||||||||||||||||||||||||
| import StackNavigation from './src/navigation/StackNavigator'; | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| import { initNotifications } from './src/services/notification-service'; | ||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Critical: Import path doesn't match actual file name. The import uses 🔎 Fix import path-import { initNotifications } from './src/services/notification-service';
+import { initNotifications } from './src/services/NotificationService';📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| export default function App() { | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| useEffect(() => { | ||||||||||||||||||||||||
| initNotifications(); | ||||||||||||||||||||||||
| }, []); | ||||||||||||||||||||||||
|
Comment on lines
+11
to
+13
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major Add error handling for notification initialization. If notification initialization fails (e.g., due to missing permissions or unsupported platform), the app will crash or fail silently. Consider adding error handling to gracefully handle initialization failures. 🔎 Add try-catch for initialization useEffect(() => {
- initNotifications();
+ try {
+ initNotifications();
+ } catch (error) {
+ console.error('Failed to initialize notifications:', error);
+ // App can continue without notifications
+ }
}, []);📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| return ( | ||||||||||||||||||||||||
| <PaperProvider> | ||||||||||||||||||||||||
| <ThemeProvider> | ||||||||||||||||||||||||
| <AgentProvider> | ||||||||||||||||||||||||
| <NavigationContainer> | ||||||||||||||||||||||||
| <StackNavigation /> | ||||||||||||||||||||||||
| </NavigationContainer> | ||||||||||||||||||||||||
| </AgentProvider> | ||||||||||||||||||||||||
| </ThemeProvider> | ||||||||||||||||||||||||
| </PaperProvider > | ||||||||||||||||||||||||
| <PaperProvider> | ||||||||||||||||||||||||
| <ThemeProvider> | ||||||||||||||||||||||||
| <AgentProvider> | ||||||||||||||||||||||||
| <NavigationContainer> | ||||||||||||||||||||||||
| <StackNavigation /> | ||||||||||||||||||||||||
| </NavigationContainer> | ||||||||||||||||||||||||
| </AgentProvider> | ||||||||||||||||||||||||
| </ThemeProvider> | ||||||||||||||||||||||||
| </PaperProvider> | ||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,7 +42,10 @@ | |
| "react-native-toast-message": "^2.2.1", | ||
| "react-native-vector-icons": "^10.2.0", | ||
| "react-navigation": "^4.4.4", | ||
| "react-navigation-bottom-tabs": "^1.0.2" | ||
| "react-navigation-bottom-tabs": "^1.0.2", | ||
| "react-dom": "18.3.1", | ||
| "react-native-web": "~0.19.13", | ||
| "@expo/metro-runtime": "~4.0.1" | ||
|
Comment on lines
+46
to
+48
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # First, locate NotificationService.js
find . -name "NotificationService.js" -o -name "*Notification*Service*" | head -20Repository: AOSSIE-Org/BabyNest Length of output: 109 🏁 Script executed: # Check the Frontend/package.json file to see current dependencies
cat Frontend/package.jsonRepository: AOSSIE-Org/BabyNest Length of output: 2565 🌐 Web query:
💡 Result: Latest published release: react-native-push-notification v8.1.1. [GitHub releases][1], [npm/Snyk][2] Compatibility note: the original zo0r repository was archived (read‑only) in Jan 2025 and the package shows signs of low maintenance; there is no official statement guaranteeing support for React Native 0.77.1. Test v8.1.1 in your project (or consider maintained alternatives/forks) before upgrading to RN 0.77.1. [GitHub archive][1], [Snyk/npm][2] Sources: 🏁 Script executed: # Check what NotificationService.js actually imports
cat Frontend/src/services/NotificationService.jsRepository: AOSSIE-Org/BabyNest Length of output: 1111 Critical: Missing
Add the following to the dependencies section: "react-navigation": "^4.4.4",
"react-navigation-bottom-tabs": "^1.0.2",
"react-dom": "18.3.1",
"react-native-web": "~0.19.13",
- "@expo/metro-runtime": "~4.0.1"
+ "@expo/metro-runtime": "~4.0.1",
+ "react-native-push-notification": "^8.1.1"Note: The upstream
🤖 Prompt for AI Agents |
||
| }, | ||
| "devDependencies": { | ||
| "@babel/core": "^7.25.2", | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,4 +1,5 @@ | ||||||||||||||||||||||||||||||
| import React, {useEffect, useRef, useState} from 'react'; | ||||||||||||||||||||||||||||||
| import { scheduleNotification } from '../services/notification-service'; | ||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Critical: Import path doesn't match actual file name. The import uses 🔎 Fix import path-import { scheduleNotification } from '../services/notification-service';
+import { scheduleNotification } from '../services/NotificationService';📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||
| import { | ||||||||||||||||||||||||||||||
| View, | ||||||||||||||||||||||||||||||
| Text, | ||||||||||||||||||||||||||||||
|
|
@@ -167,6 +168,12 @@ const ScheduleScreen = () => { | |||||||||||||||||||||||||||||
| appointment_location: '', | ||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||
| fetchAppointments(); | ||||||||||||||||||||||||||||||
| scheduleNotification( | ||||||||||||||||||||||||||||||
| 'Appointment Reminder', | ||||||||||||||||||||||||||||||
| newAppointment.title, | ||||||||||||||||||||||||||||||
| `${newAppointment.appointment_date}T${newAppointment.appointment_time}:00` | ||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||
|
Comment on lines
+171
to
+175
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Major: Notification scheduled AT appointment time, not in advance. The notification is scheduled for the exact appointment time ( 🔎 Schedule reminder in advance+ // Schedule reminder 1 hour before appointment
+ const appointmentDateTime = new Date(`${newAppointment.appointment_date}T${newAppointment.appointment_time}:00`);
+ const reminderTime = new Date(appointmentDateTime.getTime() - 60 * 60 * 1000);
+
scheduleNotification(
'Appointment Reminder',
newAppointment.title,
- `${newAppointment.appointment_date}T${newAppointment.appointment_time}:00`
+ reminderTime
);📝 Committable suggestion
Suggested change
🛠️ Refactor suggestion | 🟠 Major Add error handling and validation for notification scheduling. Issues:
🔎 Add validation and error handling+ try {
+ const appointmentDateTime = new Date(`${newAppointment.appointment_date}T${newAppointment.appointment_time}:00`);
+
+ if (isNaN(appointmentDateTime.getTime())) {
+ throw new Error('Invalid appointment date/time format');
+ }
+
+ const reminderTime = new Date(appointmentDateTime.getTime() - 60 * 60 * 1000);
+
+ if (reminderTime < new Date()) {
+ console.warn('Appointment time is too soon for advance reminder');
+ }
+
-scheduleNotification(
- 'Appointment Reminder',
- newAppointment.title,
- `${newAppointment.appointment_date}T${newAppointment.appointment_time}:00`
-);
+ scheduleNotification(
+ 'Appointment Reminder',
+ newAppointment.title,
+ reminderTime
+ );
+ } catch (notifErr) {
+ console.error('Failed to schedule notification:', notifErr);
+ Toast.show({
+ type: 'error',
+ text1: 'Notification scheduling failed',
+ text2: 'Appointment saved but reminder not set',
+ visibilityTime: 2000,
+ position: 'bottom',
+ });
+ }
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| Toast.show({ | ||||||||||||||||||||||||||||||
| type: 'success', | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: AOSSIE-Org/BabyNest
Length of output: 1164
Add
.expoto.gitignoreand remove tracked files.The
.expofolder is currently being tracked in version control (Frontend/.expo/README.md and Frontend/.expo/devices.json), but according to the README.md in this folder, it "does not contain any information that is relevant for other developers working on the project, it is specific to your machine." Add/.expo/to the repository's.gitignoreand remove these files from the commit.🤖 Prompt for AI Agents