-
Notifications
You must be signed in to change notification settings - Fork 499
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 #2427: Create LogoutDialogFragment #3119
Conversation
@rt4914 PTAL. |
The bazel checks are failing. Probably because LogoutDialogFragment is not visible to AdministratorControlsAccountActionsViewModel. |
Will review it once it gets review by @prayutsu or @FareesHussain |
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.
Left some comments. PTAL @ArpitShukIa
...rcontrols/administratorcontrolsitemviewmodel/AdministratorControlsAccountActionsViewModel.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/org/oppia/android/app/administratorcontrols/LogoutDialogFragment.kt
Show resolved
Hide resolved
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.
@ArpitShukIa Implementation LGTM,
PTAL there is a bazel build error.
As AdministratorControlsAccountActionsViewModel
no longer imports the resources move it from VIEW_MODELS_WITH_RESOURCE_IMPORTS to VIEW_MODELS source set to optimize the build but this doesn't solve the bazel error, as we don't have Activities or Fragments in the viewmodels so far there is no dep
added to the view_models target.
To fix this we need to add the :app
dep to the :view_models
but this is definitely not a good practice.
I suggest creating a new Listner and use the LogoutDialogFragment within the AdministratorControlsActivity or AdministratorControlsFragment
@BenHenning WDYT?
...rcontrols/administratorcontrolsitemviewmodel/AdministratorControlsAccountActionsViewModel.kt
Outdated
Show resolved
Hide resolved
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.
LGTM, Thanks
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.
LGTM, Thanks @ArpitShukIa
Sorry, I think I'll need to take a pass on this tomorrow, but I can follow up to the comment above now. |
I agree with moving this out of the resources view model list if R is no longer needed. Regarding the dependency, I'm fairly certain you can't add :app to :view_models since that will likely result in a circular dependency. I'm not sure I'm following what the need for the listener is. What specific problem do you see here @FareesHussain? |
https://github.com/oppia/oppia-android/runs/2445936672 Before using the listener. the |
Ah I see, thanks for clarifying @FareesHussain. Yes, that seems like the correct way to solve this since the interface provides indirection (plus it's a bit cleaner not to directly interact with the activity/fragment lifecycles except at in that activity or fragment implementation class). |
I'm actually going to take a pass on just my codeowners here (presumably Bazel) after @rt4914 has a chance to review it in case there are any big changes. |
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.
LGTM, thanks.
@@ -16,14 +16,16 @@ const val SELECTED_CONTROLS_TITLE_SAVED_KEY = | |||
const val LAST_LOADED_FRAGMENT_KEY = "LAST_LOADED_FRAGMENT_KEY" | |||
const val PROFILE_LIST_FRAGMENT = "PROFILE_LIST_FRAGMENT" | |||
const val APP_VERSION_FRAGMENT = "APP_VERSION_FRAGMENT" | |||
const val LOGOUT_DIALOG_FRAGMENT = "LOGOUT_DIALOG_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.
This tag should be shifted to LogoutDialogFragment
companion object and then it should be used wherever requried.
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.
Done
dialog.dismiss() | ||
} | ||
.setPositiveButton(R.string.log_out_dialog_okay_button) { _, _ -> | ||
// TODO(#762): Replace [ProfileChooserActivity] to [LoginActivity] once it is added. |
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 TODO is not needed here. You can remove this.
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.
Done
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.
Thanks @ArpitShukIa! Generally LGTM for Bazel changes, but had 2 nit comments to address before approving.
app/src/main/java/org/oppia/android/app/administratorcontrols/ShowLogoutDialogListener.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/org/oppia/android/app/administratorcontrols/ShowLogoutDialogListener.kt
Show resolved
Hide resolved
@BenHenning I have committed the requested changes. PTAL. |
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.
Thanks @ArpitShukIa. LGTM for codeowners.
The Bazel issues are existing problems and are unrelated to this PR, so merging this as-is. |
Explanation
Fixes #2427: I created a new DialogFragment replacing the old AlertDialog in AdministratorControlsAccountActionsViewModel and removed the IntentFactoryShim dependency as it is no longer being used. Also added test for the fix.
Test Results:
Robolectric:
Expresso:
Checklist