COSC481W-2024Winter / ResoluteApp

A fitness tracking/logging application with social media aspects. The purpose of Resolute is to encourage users and their friends to be involved in each other's fitness endeavors through non-intrusive mobile notifications.
0 stars 1 forks source link

feat: Staying logged in after closing Resolute #47

Closed agentry5 closed 8 months ago

agentry5 commented 8 months ago

Overview: When a user logs into Resolute, then closes and reopens the app, the SharedPreferences file is referenced to check if the user needs to enter their login information. Assuming they did not choose to logout and clear SharedPreferences, logged in users should be moved directly to the Home screen fragment of Resolute automatically.

Summary: There is a new function in MainActivity.java called "checkForUsername" which checks if there is a Username string stored in SharedPreferences, and returns a boolean value. This is used in the onCreate function in LoginFragment.java: if true, then skip login and navigate directly to HomeFragment. There is also a new function in MainActivity.java called "clearSharedPref" which removes the saved values in SharedPreferences. This is called when the Logout button is clicked in ProfileFragment. These two changes should greatly improve user experience, getting in and out of the app more efficiently.

SharedPref_IT.java is the testing file housing tests for this issue #30's acceptance criteria. There are tests that check that logging in and logging out affect SharedPreferences appropriately. Additionally, a Before/After block was added to every previous test file that simply empties all SharedPreferences so that every prior test can run properly, since they all involve logging in.

Removed/Changed tags: Everybody must be tagged, since the merging of this branch may cause Sprint 2 tests to fail without an appropriate Before/After block that clears SharedPreferences between multiple tests. @vceci @kbedoway @Albaraa18 @dubedo580

Closes #30

dubedo580 commented 8 months ago

After some hiccups All Good