-
Notifications
You must be signed in to change notification settings - Fork 553
feat: Change authentication process and remove navigation (#1749) #1763
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
Conversation
return rootView | ||
} | ||
|
||
private fun redirectToLogin(email: String = "") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this default value?
smartAuthViewModel.isCredentialStored | ||
.nonNull() | ||
.observe(this, Observer { | ||
if (it) redirectToLogin() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nikit19 Here no email address is passing, so set its default value to an empty string.
Please review it. |
|
@anhanh11001 Please peer review PRs |
} | ||
|
||
override fun onBackPressed() { | ||
when (currentFragmentId) { | ||
R.id.loginFragment, | ||
R.id.signUpFragment -> { | ||
R.id.authFragment -> { | ||
navController.popBackStack(R.id.eventsFragment, false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a small problem: this will always pop back to EventsFragment -> So if the user navigate from other fragments like Order or Ticket to log in and somehow they press back button, they will not return to the correct one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I have not removed it because imo it make scene. User is redirected to auth fragment where authentication requires, if user cancel the authentication then it should redirect to home screen.
If you want I will remove the condition from auth fragment and navigation flow will work in it's natural way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also think that popping back to EventsFragment is fine in most case, except when a user is booking tickets in AttendeeFragment, canceling logging in will not return them to the current event/ticket detail that they're searching for.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay so It will make complex to apply different conditions for different fragments. I will remove it. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any other changes you want to suggest?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't. I think the rest is good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got a problem in that case. If the user goes to tickets, redirected to auth fragment. After pressing the back button, the user must redirect to events fragment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iamareebjamal Can we use fragment's navArgs()
in Main activity?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would it be a problem?
Please resolve conflicts and finalize the PR. |
Updated |
Fixes #1749
Fixes #1251
Fixes #1762