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
Make typed email persist between different AuthActivity fragments #982
Conversation
Codecov Report
@@ Coverage Diff @@
## development #982 +/- ##
=================================================
- Coverage 29.12% 29.04% -0.09%
Complexity 552 552
=================================================
Files 158 159 +1
Lines 5329 5344 +15
Branches 190 190
=================================================
Hits 1552 1552
- Misses 3712 3727 +15
Partials 65 65
Continue to review full report at Codecov.
|
@iamareebjamal I mistakenly worked on navigation, which is being refactored. Should I remove the part about navigation? |
@MishuVS Yes |
@iamareebjamal Please review |
@@ -28,6 +28,8 @@ | |||
@Inject | |||
BackPressHandler backPressHandler; | |||
|
|||
String email; |
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.
private
@@ -42,6 +43,11 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, | |||
Bundle savedInstanceState) { | |||
binding = DataBindingUtil.inflate(inflater, R.layout.forgot_password_fragment, container, false); | |||
validator = new Validator(binding); | |||
|
|||
getPresenter().getEmailId().setEmail( | |||
((AuthActivity) getActivity()).getEmail() |
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 is not safe. Communicate through interface
9768ea6
to
160dba4
Compare
@@ -42,6 +42,11 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, | |||
Bundle savedInstanceState) { | |||
binding = DataBindingUtil.inflate(inflater, R.layout.forgot_password_fragment, container, false); | |||
validator = new Validator(binding); | |||
|
|||
getPresenter().getEmailId().setEmail( | |||
((LoginFragment.EmailIdTransfer) getContext()).getEmail() |
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.
Still unsafe, no casts should be there
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.
@iamareebjamal I checked here and found that SharedViewModel should be used. But they also had cast to their interface when using it, though with try-catch. What was the correct way?
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.
Explicitly setting interface reference from activity on fragment through newInstance
This solution is better
487a0b3
to
2bc6478
Compare
@@ -32,6 +34,7 @@ | |||
|
|||
private ForgotPasswordFragmentBinding binding; | |||
private Validator validator; | |||
SharedViewModel sharedViewModel; |
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.
Why do you not use private fields?
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.
Sorry, inadvertently got left out.
…thActivity fragments
Fixes #979
Changes:
Gif for the change: