-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
fix: Fixed malfunction of settings fragment #2203
fix: Fixed malfunction of settings fragment #2203
Conversation
@@ -216,6 +219,9 @@ class ChatSettingsFragment : PreferenceFragmentCompat(), ISettingsView { | |||
|
|||
displayEmail.setOnPreferenceClickListener { | |||
settingsPresenter.loginLogout() | |||
val intent = Intent(context, LoginActivity::class.java) | |||
intent.flags = Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_NEW_TASK |
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.
Not a good idea for FLAG_ACTIVITY_CLEAR_TOP
. What if we go back after intent, it should redirect to chat screen. Right?
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.
It will redirect to the settings fragment only. And I think it should redirect there only, as we have opened the login screen from there itself
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.
It will redirect to the settings fragment only.
Your intent is redirecting to Login activity and clear all activities in the back stack. Right?
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.
Yah. Why keep the back stack filled once we are moving to the login page? Because after login the user will be redirected to the chat page. So, it's better to free up the stack
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.
IMO, not better user experience. Back button should redirect to chat screen instead of closing the application.
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.
@liveHarshit u want to say that if we press the back button at the login screen, it should redirect to the chat screen. R8?
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.
|
||
override fun onBackPressed() { | ||
super.onBackPressed() | ||
startActivity(Intent(this, ChatActivity::class.java)) |
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, add a flag to clear back stack here.
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.
You can remove duplication by creating a common method in ChatSettingsFragment
The build is failing✨ Good work on this PR so far! ✨ Unfortunately, the Circle CI build is failing as of 08fe185. Here's the output:
|
The build is failing✨ Good work on this PR so far! ✨ Unfortunately, the Circle CI build is failing as of 7f740ee. Here's the output:
|
Please resolve conflicts. |
@atm1504 Please update pending PRs and resolve conflicts. And request a review from mentors. |
Yah sure |
…into atm_settings_malfunc
@iamareebjamal @arundhati24 @batbrain7 please review it. |
super.onBackPressed() | ||
val intent = Intent(this, ChatActivity::class.java) | ||
intent.flags = Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_NEW_TASK | ||
startActivity(intent) |
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.
Wrong
…into atm_settings_malfunc
@iamareebjamal please review now. I have corrected it. |
@iamareebjamal @arundhati24 @batbrain7 please review it. |
@iamareebjamal @arundhati24 please review it. |
@@ -230,6 +230,7 @@ class LoginActivity : AppCompatActivity(), ILoginView { | |||
} | |||
|
|||
override fun onBackPressed() { | |||
super.onBackPressed() | |||
loginPresenter.skipLogin() | |||
super.onBackPressed() |
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 twice?
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.
THis happened by mistake while resolving the merge conflict. Have removed it in the update.
Fixes #2055
Changes: [Add here what changes were made in this issue and if possible provide links.]
Fixed it by checking whether the user is logged in or not. Initially, it used only anonymity as a parameter to check
Screenshots for the change:
![settings](https://user-images.githubusercontent.com/43731599/57731459-4da17e00-76b8-11e9-8e21-32653bf10221.gif)