Skip to content
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

Add caching on Frontend #168

Open
4 tasks
Tracked by #166
adhi0331 opened this issue Oct 20, 2023 · 0 comments · May be fixed by #173
Open
4 tasks
Tracked by #166

Add caching on Frontend #168

adhi0331 opened this issue Oct 20, 2023 · 0 comments · May be fixed by #173
Assignees
Labels
cleanup epic:bugfixes stack:frontend All issues strictly involving work frontend (react or swift)

Comments

@adhi0331
Copy link
Member

adhi0331 commented Oct 20, 2023

Description of Issue

Caching is the process of storing information locally so that it can retrieved without having to make network calls. Currently our app makes API calls to get the necessary information for a page. For example if I go from the sessions page to the profile page a get request is made. This is fine when the app is connected to a network however when it's offline and the user is logged in, they should be able to still navigate the app.

This can be resolved by using a swift library for storing information called NSCache. It works kind of a like a map (or dictionary if you like python terminology) in that it stores information in key value pairs. All information that is in some way being displayed on the app should be cached. This includes sessions and user profile information.

Note another thing that needs to be implemented is that the pre- and pos- session note feature should still work when offline. In others words, responses should be stored locally on the cache when offline and once the app is online the necessary API calls need to be made. It's up to you how you want to implement this whether it be refreshing the app or detecting when a network is available to make the calls.

For simplicity, we are not going to implement offline features in regards to scheduling sessions (booking, reschedule, cancel, etc.) For now if a user tries to use these features when offline throw the network error custom alert.

Also, Login should not work when offline. This should already have been set up by PR #151

Tasks

  • Store all relevant information locally in a cache object
  • Ensure that pre- and post- session features work even when offline (store responses in cache).
  • Once app is back online make necessary API calls to properly update server
  • Add network error alert when trying to access calendly stuff offline

Helpful Links

Youtube video on basic caching
Documentation on using NSCache
Another article on caching using Swift

See PR #151 on how to deal with Network Handling

FYI: This issue will also handle optimizing Models/ModelView on Frontend

@adhi0331 adhi0331 added stack:frontend All issues strictly involving work frontend (react or swift) cleanup epic:bugfixes labels Oct 20, 2023
@YashRavipati1 YashRavipati1 linked a pull request Nov 17, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup epic:bugfixes stack:frontend All issues strictly involving work frontend (react or swift)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants