refactor: AmountInputViewModel to @Observable#3
Closed
CypherPoet wants to merge 1 commit into
Closed
Conversation
Replaces the legacy ObservableObject/@StateObject/@ObservedObject pattern with @observable + @State, aligning with the project's stated SwiftUI direction. No behavior change: there are no two-way bindings to the view model, so no @bindable is needed. Touches the view model, NumberPadTextField, and the 8 amount-entry call sites.
Owner
Author
|
Re-opened upstream as synonymdev#586. Closing this fork self-review PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Depends on
This PR is based on #2's branch (
fix/amount-screens-cap), and transitively on #4. It targets that branch as its base, so the diff below shows only this PR's changes. Land #4 then #2 first, then re-target this tomaster.Description
This PR migrates AmountInputViewModel from the legacy ObservableObject pattern to the @observable macro, matching the project's stated SwiftUI direction. There is no behavior change.
The view model swaps ObservableObject and @published for @observable, NumberPadTextField drops @ObservedObject, and the eight amount-entry screens move from @StateObject to @State. No @bindable is needed anywhere, since nothing creates two-way bindings to the view model; every consumer reads its values or calls its methods.
Linked Issues/Tasks
Follows up synonymdev#346 and the amount-screen cap work.
Screenshot / Video
N/A; no behavior change.
QA Notes
Manual Tests
regression:Send -> Amount: typing updates the displayed amount and fiat conversion; the cap still works.regression:Receive -> Amount: typing updates the invoice amount.regression:Transfer -> Spending Amount: typing updates and caps as before.regression:LNURL Pay / Withdraw -> Amount: typing and cap behave as before.Automated Checks
BitkitTests/NumberPadTestspasses (24 tests).