-
Notifications
You must be signed in to change notification settings - Fork 114
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
‼️📅 Rewrite - notifScheduler.ts #1092
‼️📅 Rewrite - notifScheduler.ts #1092
Commits on Oct 31, 2023
-
Translated notifScheduler.js from Angular to React Typescript commHelper.ts - Added a temporary "any" return type for getUser because the TS needed it ProfileSettings.jsx - Imported the new useSchedulerHelper function (name in progress - need to find a good name for this hook) - Replaced any instances of the old Angular NotificationScheduler module with the new schedulerHelper hook notifScheduler.ts - Translated the file from Angular to React TS - This file exports a single function which initializes the appConfig and then returns an object containing the functions that the Notification Scheduler functions need (only ProfileSettings.jsx is using this file currently) - Replaced any instances of moment with Luxon equivalent
Configuration menu - View commit details
-
Copy full SHA for 4abe86d - Browse repository at this point
Copy the full SHA 4abe86dView commit details
Commits on Nov 2, 2023
-
Configuration menu - View commit details
-
Copy full SHA for da87f47 - Browse repository at this point
Copy the full SHA da87f47View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1bfb113 - Browse repository at this point
Copy the full SHA 1bfb113View commit details -
Configuration menu - View commit details
-
Copy full SHA for 131eca5 - Browse repository at this point
Copy the full SHA 131eca5View commit details -
Configuration menu - View commit details
-
Copy full SHA for cc7664f - Browse repository at this point
Copy the full SHA cc7664fView commit details -
Temporary any type, handled purely in notifScheduler getReminderPrefs
In order to not mess with commHelper.ts as it is outside of the scope of this issue - related to e-mission#1092 (comment)
Configuration menu - View commit details
-
Copy full SHA for 39986a3 - Browse repository at this point
Copy the full SHA 39986a3View commit details -
Undoing imports getting duplicated during prettier changes
During the prettier changes, a bunch of the imports got merged. Undoing in this commit: e-mission@1bfb113
Configuration menu - View commit details
-
Copy full SHA for 58539ca - Browse repository at this point
Copy the full SHA 58539caView commit details -
Configuration menu - View commit details
-
Copy full SHA for 384ffe8 - Browse repository at this point
Copy the full SHA 384ffe8View commit details
Commits on Nov 3, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 9d3c718 - Browse repository at this point
Copy the full SHA 9d3c718View commit details -
Configuration menu - View commit details
-
Copy full SHA for a1e035f - Browse repository at this point
Copy the full SHA a1e035fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 8b09cb3 - Browse repository at this point
Copy the full SHA 8b09cb3View commit details -
Configuration menu - View commit details
-
Copy full SHA for 96d1d50 - Browse repository at this point
Copy the full SHA 96d1d50View commit details -
Configuration menu - View commit details
-
Copy full SHA for a6d99e7 - Browse repository at this point
Copy the full SHA a6d99e7View commit details
Commits on Nov 7, 2023
-
Configuration menu - View commit details
-
Copy full SHA for b0da6e9 - Browse repository at this point
Copy the full SHA b0da6e9View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6b9d222 - Browse repository at this point
Copy the full SHA 6b9d222View commit details -
Added typing for User object in getReminderPrefs
notifScheduler.ts - Added a User interface that acts as a structure instead of using any for the type
Configuration menu - View commit details
-
Copy full SHA for 97571ee - Browse repository at this point
Copy the full SHA 97571eeView commit details -
Restructure promise format and replaced moment with Luxon
ProfileSettings.tsx - 2 locations that used moment I replaced with Luxon because the notifScheduler is returning DateTime objects which don't mesh with moment - Restructured the if(uiConfig?.reminderSchemes) in refreshNotificationSettings to execute the promises at first, and then set the data - Some Prettier formatting took over here automatically too
Configuration menu - View commit details
-
Copy full SHA for a29705d - Browse repository at this point
Copy the full SHA a29705dView commit details
Commits on Nov 9, 2023
-
Merge branch 'service_rewrite_2023' of https://github.com/e-mission/e…
…-mission-phone into notifScheduler-rewrite
Configuration menu - View commit details
-
Copy full SHA for 9b4b1d0 - Browse repository at this point
Copy the full SHA 9b4b1d0View commit details -
Resolve the app crashing errors
From e-mission#1092 (comment) notifScheduler.ts - Replaced toISO for the date object with toJSDate, per @JGreenlee suggestion: e-mission#1092 (comment)
Configuration menu - View commit details
-
Copy full SHA for ba239e6 - Browse repository at this point
Copy the full SHA ba239e6View commit details
Commits on Nov 10, 2023
-
notifScheduler.ts - Removed angular (no longer used), - React useState and useEffect (no hooks used), - and useAppConfig (pulled in as arguments in the exported functions)
Configuration menu - View commit details
-
Copy full SHA for 2f75de9 - Browse repository at this point
Copy the full SHA 2f75de9View commit details
Commits on Nov 14, 2023
-
notif-scheduling-state variables kept in ProfileSettings.jsx and hand…
…ed as parameters ProfileSettings.jsx - Created scheduledPromise and isScheduling - Hand these variables as arguments to notifScheduler functions that require it notifScheduler - Removed scheduledPromise and isScheduling as they aren't doing anything - Added isScheduling and scheduledPromise as parameters to functions that require it - Some prettier formatting came in
Configuration menu - View commit details
-
Copy full SHA for 5e572d4 - Browse repository at this point
Copy the full SHA 5e572d4View commit details -
Remove empty objects from notifs, fixing the "n.trigger.at does not e…
…xist" error notifScheduler.ts - Added some typing - Created removeEmptyObjects to remove any empty objects from notifs coming from the cordova plugin
Configuration menu - View commit details
-
Copy full SHA for db91c8c - Browse repository at this point
Copy the full SHA db91c8cView commit details -
Configuration menu - View commit details
-
Copy full SHA for e4817da - Browse repository at this point
Copy the full SHA e4817daView commit details
Commits on Nov 16, 2023
-
Added sorting to list of notifications right before they get scheduled
notifScheduler.ts - Added a sort function to the list of notifications before they get scheduled - I chose to go with id since it's an convenient way to sort, since the id is the number of epoch seconds. the alternative is .trigger.at, but that is a full on JSDate in Luxon which is a string ("Date Thu Nov 16 2023 09:36:17 GMT-0700 (Mountain Standard Time)") and harder to sort
Configuration menu - View commit details
-
Copy full SHA for 0ee468a - Browse repository at this point
Copy the full SHA 0ee468aView commit details -
Change static variable isScheduling to a useState
I was not confident that isScheduling would be set properly if it were set as a static variable being passed as an arg, so I used useState and passed the value and set function
Configuration menu - View commit details
-
Copy full SHA for e209f10 - Browse repository at this point
Copy the full SHA e209f10View commit details -
Replace console.logs with logDebugs
We want to standardize on using logDebug, so I replaced all important console.logs with logDebugs that use JSON.stringify for object printouts
Configuration menu - View commit details
-
Copy full SHA for b8bf1cf - Browse repository at this point
Copy the full SHA b8bf1cfView commit details -
notifScheduler.ts - notifs uses any[], because n.trigger.at is not recognized if we use object[] - TODO: We may want to create a typing file for these types, such as User, which is currently declared as an interface within this file - TODO: We will want to add a type for notifs coming from cordova, and for ReminderScheme from the config, but I'm not sure how since ReminderScheme is an object with a variety of inner objects whose keys may or may not be named the same (weekly, week-quarterly, passive, etc.)
Configuration menu - View commit details
-
Copy full SHA for b27ae9a - Browse repository at this point
Copy the full SHA b27ae9aView commit details -
Add Jest Testing - getScheduledNotifs
cordovaMocks.ts - Added a reminder mock for the cordova plugin for reminders notifScheduler.test.ts - Mock the cordova plugin to return the active reminders - Test the getScheduledNotifs function
Configuration menu - View commit details
-
Copy full SHA for abbe618 - Browse repository at this point
Copy the full SHA abbe618View commit details
Commits on Nov 17, 2023
-
Add first updateScheduledNotifs test
A lot of mocking was required to do this: globalMocks.ts - Added log mock for console.alert - Added log mock for console.error - Both of these are called in displayErrorMsg, which is why we have to mock them notifScheduler.ts - Added a resolve in the if statement for the case of "reminders are already scheduled", so that we don't keep running the test and possibly time-out notifScheduler.test.ts - added new mocks for clientStats, logger, commHelper, and notifScheduler - Added comments for clarity in tests - Renamed any instances of mockNotifications to mockNotifs for more clarity and to mirror the variable name notifs in the actual file - Created the new test for updateScheduledNotifs that currently only tests to see if it sees that notifications have already been scheduled and then ends
Configuration menu - View commit details
-
Copy full SHA for fbd1b62 - Browse repository at this point
Copy the full SHA fbd1b62View commit details
Commits on Nov 21, 2023
-
Add reminder scheme missing test for updateScheduledNotifs
I also had to adjust the error coming from notifScheduler because it wasn't helping much with the way it was defined before
Configuration menu - View commit details
-
Copy full SHA for 87fdae5 - Browse repository at this point
Copy the full SHA 87fdae5View commit details
Commits on Nov 22, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 214081e - Browse repository at this point
Copy the full SHA 214081eView commit details -
Configuration menu - View commit details
-
Copy full SHA for f5ebb1e - Browse repository at this point
Copy the full SHA f5ebb1eView commit details
Commits on Nov 24, 2023
-
Final overall test for updateScheduledNotifs
This tests the final functionality and longest path through this function
Configuration menu - View commit details
-
Copy full SHA for 6892580 - Browse repository at this point
Copy the full SHA 6892580View commit details
Commits on Nov 30, 2023
-
Merge branch 'service_rewrite_2023' of https://github.com/e-mission/e…
…-mission-phone into notifScheduler-rewrite
Configuration menu - View commit details
-
Copy full SHA for e8b449f - Browse repository at this point
Copy the full SHA e8b449fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 85f0519 - Browse repository at this point
Copy the full SHA 85f0519View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0528fb0 - Browse repository at this point
Copy the full SHA 0528fb0View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2c0ec40 - Browse repository at this point
Copy the full SHA 2c0ec40View commit details
Commits on Dec 6, 2023
-
Merge branch 'service_rewrite_2023' of https://github.com/e-mission/e…
…-mission-phone into notifScheduler-rewrite
Configuration menu - View commit details
-
Copy full SHA for 35ffc41 - Browse repository at this point
Copy the full SHA 35ffc41View commit details -
fix error on configs without reminderSchemes
If there are no reminderSchemes in the appConfig, notifScheduler doesn't need to do anything so let's not invoke it. Also, let's create the type definition for reminderSchemes and use it here in notifScheduler.
Configuration menu - View commit details
-
Copy full SHA for 4e44dba - Browse repository at this point
Copy the full SHA 4e44dbaView commit details
Commits on Dec 12, 2023
-
Add getReminderPrefs test for when user does not exist
notifScheduler.test.ts - Imported getUser and updateUser so that we can mock them in the tests - Imported addStatReading so we can mock it to do nothing - Removed the old way of mocking the implementation of getUser, and the new way allows us to change them per-test - Added automatic mock for clientStats - added beforeEach statements to mock getUser inside the describe blocks -
Configuration menu - View commit details
-
Copy full SHA for 5ee4d64 - Browse repository at this point
Copy the full SHA 5ee4d64View commit details -
Add simple setReminderPrefs test
- Tests to see if setReminderPrefs works when called in the way that ProfileSettings.jsx calls it
Configuration menu - View commit details
-
Copy full SHA for d3750c3 - Browse repository at this point
Copy the full SHA d3750c3View commit details
Commits on Dec 15, 2023
-
Add test for updateScheduledNotifs to test if notifs successfully get…
… scheduled - There were many places where I used to/fromMillis instead of to/fromJSDate, causing a type difference that was causing errors - Added a i18n mock because not having a language code return was messing with the debugScheduledNotifs log outputs - Added a funcitonality for mockNotifs in the test, so that it can be adjusted, cleared, added to, etc. so that we can test with getScheduledNotifs if it successfully scheduled the notifs
Configuration menu - View commit details
-
Copy full SHA for ec9729d - Browse repository at this point
Copy the full SHA ec9729dView commit details