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 #657: Lowfi Admin Controls (Part 1) #665

Merged
merged 16 commits into from
Feb 21, 2020

Conversation

Luffy18346
Copy link
Contributor

Explanation

Fix: #657 : Lowfi Admin Controls (Part 1) - Show/hide admin controls option in navigation drawer.

Checklist

  • The PR title starts with "Fix #bugnum: ", followed by a short, clear summary of the changes. (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".)
  • The PR explanation includes the words "Fixes #bugnum: ..." (or "Fixes part of #bugnum" if the PR only partially fixes an issue).
  • The PR follows the style guide.
  • The PR does not contain any unnecessary auto-generated code from Android Studio.
  • The PR is made from a branch that's not called "develop".
  • The PR is made from a branch that is up-to-date with "develop".
  • The PR's branch is based on "develop" and not on any other branch.
  • The PR is assigned to an appropriate reviewer in both the Assignees and the Reviewers sections.

Copy link
Contributor

@rt4914 rt4914 left a comment

Choose a reason for hiding this comment

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

I have taken an overview look at this. PTAL, I will review it in detail later on. Thanks.

@rt4914 rt4914 assigned Luffy18346 and unassigned rt4914 Feb 14, 2020
@Luffy18346 Luffy18346 assigned rt4914 and unassigned Luffy18346 Feb 16, 2020
Copy link
Contributor

@rt4914 rt4914 left a comment

Choose a reason for hiding this comment

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

This looks like a very good implementation. Thanks. I have requested some changes. Also, once you open the Administrator Controls on back click it is going to ProfileChooser instead it should go to HOME

app/src/main/AndroidManifest.xml Outdated Show resolved Hide resolved
app/src/main/java/org/oppia/app/help/HelpActivity.kt Outdated Show resolved Hide resolved
companion object {
fun createHelpActivityIntent(context: Context, profileId: Int?): Intent {
val intent = Intent(context, HelpActivity::class.java)
intent.putExtra(KEY_HOME_PROFILE_ID, profileId)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not required in HELP

Copy link
Contributor Author

@Luffy18346 Luffy18346 Feb 18, 2020

Choose a reason for hiding this comment

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

@rt4914 I have done this implementation and also changed both the intent calls in NavigationDrawerFragmentPresenter because otherwise Administrator Controls option won't be visible when we move to Help Activity and then open nav. drawer.

Copy link
Contributor

Choose a reason for hiding this comment

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

Replied above

@rt4914 rt4914 assigned Luffy18346 and unassigned rt4914 Feb 18, 2020
Copy link
Contributor

@rt4914 rt4914 left a comment

Choose a reason for hiding this comment

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

I think you can change the HelpActivity intent implementation, we don't need profileId in that. Also you have missed my earlier comment: #665 (review)

This looks like a very good implementation. Thanks. I have requested some changes. Also, once you open the Administrator Controls on back click it is going to ProfileChooser instead it should go to HOME and also write test case for checking this.

Along with this non-flaky tests are failing, maybe merge this PR with develop to get latest code.

@Luffy18346
Copy link
Contributor Author

Luffy18346 commented Feb 19, 2020

I think you can change the HelpActivity intent implementation, we don't need profileId in that. Also you have missed my earlier comment: #665 (review)

This looks like a very good implementation. Thanks. I have requested some changes. Also, once you open the Administrator Controls on back click it is going to ProfileChooser instead it should go to HOME and also write test case for checking this.

Along with this non-flaky tests are failing, maybe merge this PR with develop to get latest code.

@rt4914 I have written a testcase, actually extended the code in a test-case which was opening the AdminControlsActivity, there I have put backPressed and checked if recyclerView from homeActivity is visible or not. The test-case is passing successfully.

@Luffy18346 Luffy18346 assigned rt4914 and unassigned Luffy18346 Feb 19, 2020
Copy link
Contributor

@rt4914 rt4914 left a comment

Choose a reason for hiding this comment

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

LGTM, just one change regarding the test case.

}

@Test
fun testNavigationDrawerTestActivity_withAdminProfile_openNavigationDrawer_clickAdministratorControls_checkOpensAdministratorControlsActivity_onBackPressed_showsHomeActivity() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Actually this test case is correct but this test case is not a functionality of NavigationDrawer, instead it is the functionality of AdministratorControlsActivity. So please create a new dedicated test file AdministratorControlsActivityTest and in this file write this test case. Also, note that the function name will be updated accordingly.

Copy link
Contributor Author

@Luffy18346 Luffy18346 Feb 20, 2020

Choose a reason for hiding this comment

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

I have made a new test file and written same testcase in it. Test is passing successfully. and changed this test-case so that it will now only check for AdministratorActivity opened or not.

@rt4914 rt4914 assigned Luffy18346 and unassigned rt4914 Feb 20, 2020
@Luffy18346 Luffy18346 assigned rt4914 and unassigned Luffy18346 Feb 20, 2020
Copy link
Contributor

@rt4914 rt4914 left a comment

Choose a reason for hiding this comment

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

Just one final Nit. Also, always self-review your PR to make your PR merge ready faster. Thanks

@Test
fun testAdministratorControlsActivity_withAdminProfile_openAdministratorControlsActivityFromNavigationDrawer_onBackPressed_showsHomeActivity() {
ActivityScenario.launch<NavigationDrawerTestActivity>(createNavigationDrawerActivityIntent(0)).use {
Espresso.onView(withContentDescription(R.string.drawer_open_content_description)).perform(click())
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit about imports:

      onView(withContentDescription(R.string.drawer_open_content_description)).perform(click())
      onView(withId(R.id.administrator_controls_linear_layout)).check(matches(isDisplayed())).perform(click())
      intended(hasComponent(AdministratorControlsActivity::class.java.name))
      intended(hasExtra(AdministratorControlsActivity.getIntentKey(), 0))
      onView(isRoot()).perform(pressBack())
      onView(withId(R.id.home_recycler_view)).check(matches(isDisplayed()))

@rt4914 rt4914 assigned Luffy18346 and unassigned rt4914 Feb 21, 2020
@Luffy18346 Luffy18346 assigned rt4914 and unassigned Luffy18346 Feb 21, 2020
Copy link
Contributor

@rt4914 rt4914 left a comment

Choose a reason for hiding this comment

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

LGTM

@rt4914 rt4914 merged commit 9fcfca7 into oppia:develop Feb 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lowfi Admin Controls (Part 1): Show/Hide Admin Controls option in navigation drawer
2 participants