This repository was archived by the owner on Mar 26, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 59
Add fiat transactions history on buy/sell screen #1810
Merged
DRadmir
merged 9 commits into
main
from
1807-add-fiat-transactions-history-on-buy-sell-screen
Mar 25, 2026
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
bbebb95
Add fiat transactions history on buy/sell screen
DRadmir 851a342
Remove fiat transaction detail screen
DRadmir bf94b7f
Merge branch 'main' into 1807-add-fiat-transactions-history-on-buy-se…
DRadmir 1180835
Show crypto amount and fiat value on fiat transactions list
DRadmir 653bbc6
Merge FiatTransactionService into FiatService with GemAPIFiatService …
DRadmir 84eda23
Merge branch 'main' of github.com:gemwalletcom/gem-ios into 1807-add-…
DRadmir 7106c49
Update fiat transaction typeshare model
DRadmir 885194c
Merge branch 'main' of github.com:gemwalletcom/gem-ios into 1807-add-…
DRadmir 7ab661d
Order fiat transactions by newest first
DRadmir File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
53 changes: 53 additions & 0 deletions
53
Features/FiatConnect/Sources/Scenes/FiatTransactionsScene.swift
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| // Copyright (c). Gem Wallet. All rights reserved. | ||
|
|
||
| import SwiftUI | ||
| import Components | ||
| import Primitives | ||
| import Store | ||
| import Style | ||
| import PrimitivesComponents | ||
|
|
||
| public struct FiatTransactionsScene: View { | ||
| @State private var model: FiatTransactionsViewModel | ||
|
|
||
| public init(model: FiatTransactionsViewModel) { | ||
| _model = State(initialValue: model) | ||
| } | ||
|
|
||
| public var body: some View { | ||
| List { | ||
| ForEach(model.sections) { section in | ||
| Section { | ||
| ForEach(section.values) { | ||
| let viewModel = FiatTransactionViewModel(info: $0) | ||
| if let url = viewModel.detailsUrl { | ||
| SafariNavigationLink(url: url) { | ||
| ListItemView(model: viewModel.listItemModel) | ||
| } | ||
| } else { | ||
| NavigationCustomLink( | ||
| with: ListItemView(model: viewModel.listItemModel), | ||
| action: {} | ||
| ) | ||
| } | ||
| } | ||
| } header: { | ||
| section.title.map { Text($0) } | ||
| } | ||
| } | ||
| .listRowInsets(.assetListRowInsets) | ||
| } | ||
| .overlay { | ||
| if model.transactions.isEmpty { | ||
| EmptyContentView(model: model.emptyContentModel) | ||
| .padding(.horizontal, .medium) | ||
| } | ||
| } | ||
| .contentMargins(.top, .scene.top, for: .scrollContent) | ||
| .listSectionSpacing(.compact) | ||
| .bindQuery(model.query) | ||
| .refreshable { await model.fetch() } | ||
| .navigationTitle(model.title) | ||
| .task { await model.fetch() } | ||
| } | ||
| } | ||
8 changes: 0 additions & 8 deletions
8
Features/FiatConnect/Sources/Types/FiatServiceEnvironment.swift
This file was deleted.
Oops, something went wrong.
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
43 changes: 43 additions & 0 deletions
43
Features/FiatConnect/Sources/ViewModels/FiatTransactionsViewModel.swift
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| // Copyright (c). Gem Wallet. All rights reserved. | ||
|
|
||
| import Components | ||
| import Foundation | ||
| import FiatService | ||
| import Localization | ||
| import Primitives | ||
| import PrimitivesComponents | ||
| import Store | ||
|
|
||
| @Observable | ||
| @MainActor | ||
| public final class FiatTransactionsViewModel { | ||
| private let service: FiatService | ||
| let walletId: WalletId | ||
|
|
||
| public let query: ObservableQuery<FiatTransactionsRequest> | ||
| var transactions: [FiatTransactionInfo] { query.value } | ||
|
|
||
| var sections: [ListSection<FiatTransactionInfo>] { | ||
| DateSectionBuilder(items: transactions, dateKeyPath: \.transaction.createdAt).build() | ||
| } | ||
|
|
||
| public init(walletId: WalletId, service: FiatService) { | ||
| self.walletId = walletId | ||
| self.service = service | ||
| self.query = ObservableQuery(FiatTransactionsRequest(walletId: walletId), initialValue: []) | ||
| } | ||
|
|
||
| var title: String { Localized.Activity.title } | ||
|
|
||
| var emptyContentModel: EmptyContentTypeViewModel { | ||
| EmptyContentTypeViewModel(type: .activity(isViewOnly: false)) | ||
| } | ||
|
|
||
| func fetch() async { | ||
| do { | ||
| try await service.updateTransactions(walletId: walletId) | ||
| } catch { | ||
| debugLog("FiatTransactionsViewModel fetch error: \(error)") | ||
| } | ||
|
DRadmir marked this conversation as resolved.
|
||
| } | ||
| } | ||
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
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
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.
There will be chevron with no action, maybe instead just use ListItemView?