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

fix: Fixed malfunction of settings fragment #2203

Merged
merged 18 commits into from
Jun 13, 2019
Merged

fix: Fixed malfunction of settings fragment #2203

merged 18 commits into from
Jun 13, 2019

Conversation

atm1504
Copy link
Member

@atm1504 atm1504 commented May 14, 2019

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

@auto-label auto-label bot added the fix label May 14, 2019
@@ -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
Copy link
Member

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?

Copy link
Member Author

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

Copy link
Member

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?

Copy link
Member Author

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

Copy link
Member

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.

Copy link
Member Author

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?

Copy link
Member

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))
Copy link
Member

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.

Copy link
Member

@liveHarshit liveHarshit left a 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

@ci-reporter
Copy link

ci-reporter bot commented May 22, 2019

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:

Run Tests
> Task :app:preBuild UP-TO-DATE

I'm sure you can fix it! If you need help, don't hesitate to ask a maintainer of the project!


Failed build for 6f4906b
Run Tests
> Task :app:preBuild UP-TO-DATE
Failed build for 7f740ee
lint check
> Task :app:preBuild UP-TO-DATE

This comment was automagically generated by ci-reporter. If you see a problem, open an issue here.

@ci-reporter
Copy link

ci-reporter bot commented May 22, 2019

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:

lint check
> Task :app:preBuild UP-TO-DATE

I'm sure you can fix it! If you need help, don't hesitate to ask a maintainer of the project!


This comment was automagically generated by ci-reporter. If you see a problem, open an issue here.

@mariobehling
Copy link
Member

Please resolve conflicts.

@liveHarshit
Copy link
Member

You can remove duplication by creating a common method in ChatSettingsFragment

@atm1504 Please update pending PRs and resolve conflicts. And request a review from mentors.

@atm1504
Copy link
Member Author

atm1504 commented Jun 2, 2019

You can remove duplication by creating a common method in ChatSettingsFragment

@atm1504 Please update pending PRs and resolve conflicts. And request a review from mentors.

Yah sure

@atm1504
Copy link
Member Author

atm1504 commented Jun 6, 2019

@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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong

@atm1504
Copy link
Member Author

atm1504 commented Jun 6, 2019

@iamareebjamal please review now. I have corrected it.

@atm1504
Copy link
Member Author

atm1504 commented Jun 8, 2019

@iamareebjamal @arundhati24 @batbrain7 please review it.

@atm1504
Copy link
Member Author

atm1504 commented Jun 12, 2019

@iamareebjamal @arundhati24 please review it.

@@ -230,6 +230,7 @@ class LoginActivity : AppCompatActivity(), ILoginView {
}

override fun onBackPressed() {
super.onBackPressed()
loginPresenter.skipLogin()
super.onBackPressed()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why twice?

Copy link
Member Author

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.

@iamareebjamal iamareebjamal merged commit e71bdc7 into fossasia:development Jun 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Settings page malfunctions on moving back from about us
5 participants