UltimateHealth icon indicating copy to clipboard operation
UltimateHealth copied to clipboard

💡[FEATURE]: Restrict Navigation

Open SB2318 opened this issue 1 year ago • 17 comments

Is your feature request related to a problem? Please describe.

https://github.com/SB2318/UltimateHealth/assets/133581245/136bd381-2348-44ea-81d1-fdcf42721332

Describe the solution you'd like

You have to restrict the navigation, If the user already logged in, or the token has not expired yet, then you have to land the user from SplashScreen to Home page, Otherwise, land the user on the login page.

Additional context Continuation of Login Page Development

SB2318 avatar May 20 '24 04:05 SB2318

Hi @SB2318, please assign this issue to me.

Himanshu8850 avatar May 20 '24 14:05 Himanshu8850

Hi @SB2318, please assign this issue to me.

Please start work with the completion of issue no #55

SB2318 avatar May 20 '24 14:05 SB2318

@Himanshu8850 You can start work.

SB2318 avatar May 23 '24 18:05 SB2318

Hello @SB2318! Your issue #63 has been closed. Thank you for your contribution!

github-actions[bot] avatar May 23 '24 18:05 github-actions[bot]

So I have to make login page, then allow user to access home page only if his token is not expired, right?

Himanshu8850 avatar May 24 '24 06:05 Himanshu8850

So I have to make login page, then allow user to access home page only if his token is not expired, right?

  1. Run the backend server (Follow the instructions given in Readme.md).
  2. Create an account
  3. Get the useremail and password.
  4. Go to frontend folder.
  5. Install the necessary dependencies.
  6. Install @react-native-async-storage/async-storage
  7. Create Util functions to storeItem and retrieveItem
  8. Open SplashScreen file,

image

Here you have to make your changes, By default, it is navigating to TabNavigation (HomePage)

You have to create a function which will determine whether the user logged in or not, Try to retrieve user data from local storage( async-storage).

if(null) login-page else homepage

SB2318 avatar May 24 '24 09:05 SB2318

@Himanshu8850 Those are a brief overview of your task, you can also find your solutions. For further doubts, please reach out to me on Discord.

SB2318 avatar May 24 '24 09:05 SB2318

all right i'm on it.

Himanshu8850 avatar May 24 '24 11:05 Himanshu8850

@SB2318 is this good?

https://github.com/SB2318/UltimateHealth/assets/128601673/2179a5b6-8532-4fe4-8781-a8037b75f771

Himanshu8850 avatar May 24 '24 13:05 Himanshu8850

@Himanshu8850 No, please go through the problem statements and instructions.

For your reference:

https://reactnavigation.org/docs/auth-flow/

SB2318 avatar May 24 '24 14:05 SB2318

It's just that onclick login button store function adds user value ok in the storage and then navigates to tabnavigation , where the user value is again checked and now that the value is present it logs in, isn't this what you specified ,further login and sign up are in other issues?

Himanshu8850 avatar May 24 '24 14:05 Himanshu8850

It's just that onclick login button store function adds user value ok in the storage and then navigates to tabnavigation , where the user value is again checked and now that the value is present it logs in, isn't this what you specified ,further login and sign up are in other issues?

Please think first, We will discuss about it tomorrow.

SB2318 avatar May 24 '24 15:05 SB2318

can you please pinpoint what's missing?

Himanshu8850 avatar May 25 '24 01:05 Himanshu8850

can you please pinpoint what's missing?

Let's visualize the thing, Suppose you download an application from Play Store for the first time you have opened it. Then the authentication page comes in front of you, you authenticate yourself then you proceed further.

Generally, those modules are like, LaunchScreen -> Login-> SignUp -> Login (For an unregistered user) LaunchScreen-> Login -> Home (User with an existing account, but somehow they log out themselves) LaunchScreen -> Home (User already logged in, from splash-screen you can get user data in local storage).

For further doubt please maintain the encapsulation strategy and message me on discord, I will available there.

SB2318 avatar May 25 '24 06:05 SB2318

I can't find you can you message me my discord id is himanshu8850.

Himanshu8850 avatar May 26 '24 05:05 Himanshu8850

I can't find you can you message me my discord id is himanshu8850.

Sent, Weather is not good, so you may get late reply

SB2318 avatar May 26 '24 05:05 SB2318

https://discord.com/invite/D3xhDnPj

Himanshu8850 avatar May 26 '24 09:05 Himanshu8850

@Himanshu8850 Sorry, was unavailable for few days due to natural calamity . Please come in the discord server, today we will discuss about your issue.

SB2318 avatar May 28 '24 05:05 SB2318

Hello @SB2318! Your issue #63 has been closed. Thank you for your contribution!

github-actions[bot] avatar May 29 '24 12:05 github-actions[bot]