Skip to content

Conversation

@shanavas123
Copy link
Contributor

No description provided.

@shanavas123 shanavas123 changed the base branch from master to development April 9, 2021 10:13
SaiNarendran
SaiNarendran previously approved these changes Apr 9, 2021
SaiNarendran
SaiNarendran previously approved these changes Apr 9, 2021
@SaiNarendran SaiNarendran self-requested a review April 12, 2021 15:54
SaiNarendran
SaiNarendran previously approved these changes Apr 12, 2021
Comment on lines 164 to 166
protected static boolean isZeroFeeAvailable(@NonNull final Context context, String fee) {
return fee.contains(context.getResources().getString(R.string.noFee));
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

method name doesn't sound right, if there is noFee then why does that mean zero fee is available ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

renamed as isNoFeeStringAvailable.

feeAndProcessingTime.setText(
feeAndProcessingTime.getContext().getString(R.string.feeAndProcessingTimeInformation, formattedFee,
processingTime.getValue()));
if (isZeroFeeAvailable(feeAndProcessingTime.getContext(), formattedFee)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This method has now become too complicated with so many if/else conditions, I recommend refactoring it.
Hint: Perhaps you can handle fee and processing time in separate conditions rather than mixing them up and then call feeAndProcessingTime.setText at the end when you have final value to be displayed

Copy link
Contributor Author

@shanavas123 shanavas123 Apr 13, 2021

Choose a reason for hiding this comment

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

moved to common method in FeeFormatter as getFormattedFeeAndProcessingTime()

mDescriptionFeesAndProcessingTime.setText(mDescriptionFeesAndProcessingTime.getContext()
.getString(R.string.feeAndProcessingTimeInformation, formattedFee,
selectionItem.getProcessingTime().getValue()));
if (isZeroFeeAvailable(mDescriptionFeesAndProcessingTime.getContext(), formattedFee)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

same applies in this method too, too many if/else conditions, please refactor

Copy link
Contributor Author

@shanavas123 shanavas123 Apr 13, 2021

Choose a reason for hiding this comment

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

moved to common method in FeeFormatter as getFormattedFeeAndProcessingTime()

feeAndProcessingTime.setText(
feeAndProcessingTime.getContext().getString(R.string.feeAndProcessingTimeInformation, formattedFee,
processingTime.getValue()));
if (isZeroFeeAvailable(feeAndProcessingTime.getContext(), formattedFee)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

too many if/else conditions in this method too, please refactor here too

Copy link
Contributor Author

@shanavas123 shanavas123 Apr 13, 2021

Choose a reason for hiding this comment

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

moved to common method in FeeFormatter as getFormattedFeeAndProcessingTime()

@SaiNarendran SaiNarendran dismissed stale reviews from aparthibanpaypal and themself via c10af51 April 13, 2021 08:48
@SaiNarendran SaiNarendran self-requested a review April 13, 2021 11:41
@vwagh-hw vwagh-hw merged commit aaff7e3 into development Apr 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants