Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.

Decouple Transfer from FiatConnect and auto-enable asset on buy#1837

Merged
gemcoder21 merged 5 commits into
mainfrom
fiat-auto-detect
Mar 26, 2026
Merged

Decouple Transfer from FiatConnect and auto-enable asset on buy#1837
gemcoder21 merged 5 commits into
mainfrom
fiat-auto-detect

Conversation

@gemdev111
Copy link
Copy Markdown
Contributor

@gemdev111 gemdev111 commented Mar 26, 2026

Refactor Transfer/FiatConnect dependency and improve fiat buy flow.

  • Move AmountNavigationView and ConfirmTransferNavigationView from Transfer to app target
  • Remove FiatConnect dependency from Transfer package
  • Auto-enable asset when user taps Continue on fiat buy
  • Use ViewModelFactory for FiatScene creation instead of direct init

Close: #1820

Transfer was importing FiatConnect solely to create FiatSceneViewModel
in sheet handlers, making it impossible to inject AssetsEnabler without
adding package dependencies or stub types.

- Move AmountNavigationView to Gem/Navigation/Transfer
- Extract ConfirmTransferScene sheets into ConfirmTransferNavigationView
- Remove FiatConnect dependency from Transfer
- Move @entry fiatService from FiatConnect to Gem/Types/Environment
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the transfer and fiat connect modules, notably moving sheet presentation logic from ConfirmTransferScene to a new ConfirmTransferNavigationView and updating FiatSceneViewModel to support asset enabling via the AssetsEnabler service. Additionally, many types and view models within the Transfer feature have been made public. Feedback identifies a critical compilation error in FiatSceneViewModel where the walletId property is not initialized, and suggests implementing more robust error logging for the asset enabling process to ensure visibility in production environments.

Comment on lines 55 to 59
self.wallet = wallet
self.assetsEnabler = assetsEnabler
self.type = type
let walletId = wallet.walletId
self.assetQuery = ObservableQuery(AssetRequest(walletId: walletId, assetId: assetAddress.asset.id), initialValue: .with(asset: assetAddress.asset))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

critical

The class property walletId is not being initialized in the init method, which will cause a compilation error. You should initialize it from the wallet parameter. The local walletId variable then becomes redundant.

Please also ensure that wallet and assetsEnabler are declared as properties of FiatSceneViewModel.

Suggested change
self.wallet = wallet
self.assetsEnabler = assetsEnabler
self.type = type
let walletId = wallet.walletId
self.assetQuery = ObservableQuery(AssetRequest(walletId: walletId, assetId: assetAddress.asset.id), initialValue: .with(asset: assetAddress.asset))
self.wallet = wallet
self.assetsEnabler = assetsEnabler
self.type = type
self.walletId = wallet.walletId
self.assetQuery = ObservableQuery(AssetRequest(walletId: self.walletId, assetId: assetAddress.asset.id), initialValue: .with(asset: assetAddress.asset))

Comment on lines +250 to +252
} catch {
debugLog("FiatSceneViewModel enableAsset error: \(error)")
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The error from enableAssets is only logged to the debug console. This means that in release builds, any failure to enable the asset will be silent. Consider using a more robust logging mechanism to track these errors in production.

@gemdev111 gemdev111 self-assigned this Mar 26, 2026
@gemcoder21 gemcoder21 merged commit 9ce78a7 into main Mar 26, 2026
1 check passed
@gemcoder21 gemcoder21 deleted the fiat-auto-detect branch March 26, 2026 18:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Auto-activate asset when buying crypto

3 participants