Skip to content

Kill BaseHelper and friends #777

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

Merged
merged 8 commits into from
Jun 27, 2017
Merged

Kill BaseHelper and friends #777

merged 8 commits into from
Jun 27, 2017

Conversation

samtstern
Copy link
Contributor

@samtstern samtstern commented Jun 26, 2017

See #776

Steps:

  1. Kill ActivityHelper and FragmentHelper, make everything a BaseHelper
  2. Help Fragments and Activities manage their own FlowParameters and ProgressDialog
  3. Separate out all factory-type responsibilities of the helpers (getFirebaseAuth(), etc) into a dedicated class for that.

Change-Id: I07599baa47fba0c0415ebec2a37b7a8ed011e0a2
Change-Id: Ie4e60c4346f5ff5cea2ea7474765c6857bd85e03
Change-Id: I216e2e6d605fb0b3750ddd198e954597db89c1d2
Change-Id: Id3c6e12f3da3fde438aa6da27e9033b30233e6d0
Change-Id: I9d7a4545a171274d5d704d9ac9f704cbaf364238
@samtstern samtstern changed the title [WIP] Kill BaseHelper and friends Kill BaseHelper and friends Jun 27, 2017
Change-Id: I850923fe00efd0be31c75196e917440ca6602708
Change-Id: I3b126f4e08cd359f7e1910cd086176159097650b
Copy link
Collaborator

@SUPERCILEX SUPERCILEX left a comment

Choose a reason for hiding this comment

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

@samtstern Awesome refactor!!! 😄 Just left a few comments.

@@ -5,24 +5,38 @@
import android.support.annotation.Nullable;
import android.support.annotation.RestrictTo;
import android.support.v4.app.DialogFragment;
import android.view.ContextThemeWrapper;

@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public class DialogBase extends DialogFragment {
Copy link
Collaborator

Choose a reason for hiding this comment

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

@samtstern Could we just get rid of this class? The only dialog using it is the RecoveryEmailSentDialog and it doesn't use any of this. I also noticed that there's dead code in the RecoveryEmailSentDialog:

public static void show(String email, FlowParameters parameters, FragmentManager manager) {
    // We never use the flow params
    bundle.putParcelable(ExtraConstants.EXTRA_FLOW_PARAMS, parameters);
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch!


@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public class FragmentBase extends Fragment {
protected FragmentHelper mHelper;

protected FlowParameters mFlowParameters;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't the flow params be private since we have a getter to handle initialization?

@SuppressWarnings("Registered")
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public class HelperActivityBase extends AppCompatActivity {

protected ActivityHelper mActivityHelper;
protected FlowParameters mFlowParameters;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same.

@SuppressWarnings("Registered")
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public class HelperActivityBase extends AppCompatActivity {

protected ActivityHelper mActivityHelper;
protected FlowParameters mFlowParameters;
protected ProgressDialogHolder mProgressDialogHolder;
Copy link
Collaborator

Choose a reason for hiding this comment

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

It looks like the dialog can also be private since you have a getter. Or we could remove the getter, seems easier and would be more consistent with the other code you've written.

RecoveryEmailSentDialog result = new RecoveryEmailSentDialog();
Bundle bundle = new Bundle();
bundle.putParcelable(ExtraConstants.EXTRA_FLOW_PARAMS, parameters);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh, just noticed you added the flow params. Yeah, lol. We should just kill DialogBase since we aren't using any of it and it's forcing us to add dead code to the RecoveryEmailSentDialog.

return Auth.CredentialsApi;
}

public static FirebaseUser getCurrentUser(FlowParameters parameters) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

@samtstern We should probably mark this as @Nullable.

Change-Id: Ib07cea70703f6f7fdc2b47e5c9aab43f764350cf
@samtstern
Copy link
Contributor Author

@SUPERCILEX thanks for the comments! Think I fixed them all.

@SUPERCILEX
Copy link
Collaborator

@samtstern LGTM! 😄

@samtstern samtstern merged commit b9a2fa4 into version-2.1.0-dev Jun 27, 2017
@samtstern samtstern deleted the helper-refactor branch July 18, 2017 18:41
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.

2 participants