[trello.com/c/1lX3h2xx] eliminated 0 commission in transaction details #887
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
the scenario of displaying 0 commission in transaction details has been completely eliminated
I think the root cause is 0 in @atomic private(set) var transactionFee: Decimal = 0.0, but after considering the scenario of rewriting it to optional, I still came to the conclusion that it is better to check the fee at the last moment before displaying it in the UI. 2 main reasons for this decision:
1.) protocols and methods are strongly tied to the non-optional value of transactionFee and will require refactoring for all coin services
2.) the fee goes through dozens of files and the chance of human error in determining the value when processing the optional is too high, so it is better to guarantee correct display in the UI even if somewhere the optional is mistakenly unpacked to 0