Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@SUPERCILEX
Copy link
Collaborator

Fixes #1392

}

public void onSaveInstanceState(@NonNull Bundle outState) {
outState.putString(VERIFICATION_ID_KEY, mVerificationId);
Copy link
Contributor

Choose a reason for hiding this comment

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

I have no issue with this, but just wondering have you seen this pattern of handing the instance state in the ViewModel elsewhere or is this your own invention? Seems a to tie it a little too close to the Activity but I can't think of a reason why it's any worse than having the logic directly in the Activity.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I looked around, but couldn't find sample code with onSaveInstanceState. πŸ˜• So I guess it's time to patent my new invention, right? πŸ˜‚

I wouldn't mind moving it to the activity, but it made more sense to me to let the ViewModel manage its saved state. (Otherwise, we'd end up with getters and setters for mVerificationId which shouldn't be used outside of the state restoration context.) Whad'ya think?

Copy link
Contributor

Choose a reason for hiding this comment

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

I am cool with it, let's just pinky swear not to show Jake Wharton or Yigit the monster we've created!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

πŸ‘ŒπŸ˜‚

@samtstern samtstern merged commit 71fa34a into firebase:version-4.2.0-dev Jul 18, 2018
@SUPERCILEX SUPERCILEX deleted the phone-state-loss branch July 18, 2018 18:43
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