Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Features/deletedata: Create Privacy Controls UI and Add deleteFlag to…
… specified timestamp (#33) # *Add deleteFlag to a specified timestamp in Firestore* ## ♻️ Current situation & Problem While the current version of the app allows reading in health data to be disabled via toggles in ToggleTestView.swift, it does not allow past health data to be reviewed and hidden or deleted. This PR creates a page ManageDataView for users to be able to see all health data types (e.g, step count) with toggle status shown as well as detailed pages per datatype in DeleteDataView that allows users to switch toggle status (enable/disable reading data type) and hide data from a list of timestamps. A function addDeleteFlag was created to add a deleteFlag and set it to true for a timestamp the user chooses to hide. ## ⚙️ Release Notes Updates - Created ManageDataView: A list of all healthkit data sample types that link to a DeleteDataView screen specific to the selected category. - Created new file DeleteDataView: Using the dictionaries in PrivacyModule we created a details screen showing the disable/enable status and a hardcoded array of timestamps (of collected data points). This array will be replaced by an array populated by the actual timestamps from firestore in the next PR. The user will navigate to this screen to hide/unhide collected data. - Inside Privacy Module: Created dictionaries iconsMapping, togglesMap, and identifierUIString to map data sample types to icon image, toggle status, and UI title respectively. - Inside PrismaStandard+HealthKit.swift, created func addDeleteFlag(quantityType: String, timestamp: String) async that takes in a quantityType (e.g, stepcount, heartrate) and timestamp, uses getPath, and uses setData to add and set a new flag “deleteFlag” to true without replacing original fields. Next Steps - While the timestamps in the listview UI were hard-coded, in the next few days, we will query the 10 most recent timestamps from firestore using order and limit data, store it into an array, and display them (allowing the user to also load in more sets of timestamps in increments of 10). - Change "delete" to "hide" data for adding deleteFlag - Allow users to delete data view custom range (they will input start and end date for deletion). ## 📚 Documentation N/A ## ✅ Testing On HCI-Prisma repository, run `firebase emulators:start --import=firestore_export` to run the firebase emulator. Erase all contents and settings from the device on the simulator. Log in with “[[email protected]](mailto:[email protected])” and “testing123”. If a timestamp is deleted on DeleteDataView.swift, a new field “deleteFlag” set to true should be created inside the matching timestamp document in the emulator. ## 📝 Code of Conduct & Contributing Guidelines By submitting creating this pull request, you agree to follow our [Code of Conduct](https://github.com/CS342/.github/blob/main/CODE_OF_CONDUCT.md) and [Contributing Guidelines](https://github.com/CS342/.github/blob/main/CONTRIBUTING.md): - I agree to follow the [Code of Conduct](https://github.com/CS342/.github/blob/main/CODE_OF_CONDUCT.md) and [Contributing Guidelines](https://github.com/CS342/.github/blob/main/CONTRIBUTING.md). ## Roles: - Evelyn: We both worked together on each step but I focused on creating the ManageDataView page to display a list of data type sources and disabled/enabled status using a new struct DataCategoryItem; creating environment accessible dictionaries in Privacy Modules to map data sample types to toggle status, icon, and title; UI for displaying list and animating deletion of timestamps in DeleteDataView; creating addDeleteFlag to create and set new field deleteFlag to true in corresponding timestamp in Firestore; and debugging addDeleteFlag to fix out-of-index and incorrect getPath errors. - Caroline: We both worked together on each step but I focused on the linking between the screens (Home and navigation bar, ManageDataView to DeleteDataView, communication between functions and dictionaries in Privacy Modules); creating the user action trigger that writes a deleteFlag into Firestore; restructuring our logic and functionality in DeleteDataView to use getPath() and HKSamples; bug fixes for the UI on both ManageDataView and DeleteDataView; and bug fixes to the addDeleteFlag and UI item remove animation so the item is flagged in the backend before the deletion is shown to the user. - Dhruv: I focused on implementing certain functionalities throughout the entire UI development process. This included providing the initial architecture for the PrivacyModule class, adding toggle functionality for a users to omit a certain data type from being collected within our new UI post-midterm, and writing functions to set up this toggle creation by altering the PrismaStandard class and the PrivacyModule class to take in a list of HKSampleTypes and create a Binding set of Toggles which map identifiers to the Boolean toggle’s state. --------- Co-authored-by: Evelyn <[email protected]> Co-authored-by: Bryant Jimenez <[email protected]> Co-authored-by: Matthew Jörke <[email protected]> Co-authored-by: dhruvna1k <[email protected]>
- Loading branch information