Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions MobileWallet.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,7 @@
F8472F722E745A3E0094163D /* ProgressIndicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8472F712E745A3D0094163D /* ProgressIndicator.swift */; };
F849ACB62ED5D024005B38AF /* SwapInProgress.swift in Sources */ = {isa = PBXBuildFile; fileRef = F849ACB52ED5D01C005B38AF /* SwapInProgress.swift */; };
F849ACBA2ED5F823005B38AF /* CodableStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = F849ACB92ED5F822005B38AF /* CodableStorage.swift */; };
F849ACC02EDF47BF005B38AF /* SwapHistory.swift in Sources */ = {isa = PBXBuildFile; fileRef = F849ACBF2EDF47BF005B38AF /* SwapHistory.swift */; };
F88781AF2EB10B1E00207D0B /* TokenPicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = F88781AE2EB10B1E00207D0B /* TokenPicker.swift */; };
F88781B12EB1EC5A00207D0B /* SwapDeposit.swift in Sources */ = {isa = PBXBuildFile; fileRef = F88781B02EB1EC5A00207D0B /* SwapDeposit.swift */; };
F88781B32EB1EE4C00207D0B /* SwapProgress.swift in Sources */ = {isa = PBXBuildFile; fileRef = F88781B22EB1EE4C00207D0B /* SwapProgress.swift */; };
Expand Down Expand Up @@ -566,6 +567,7 @@
F8C0653F2E37C3A5009BFC8F /* ConnectionStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8C0653E2E37C3A5009BFC8F /* ConnectionStatus.swift */; };
F8C065422E38A2F5009BFC8F /* ChainTipObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8C065412E38A2F4009BFC8F /* ChainTipObserver.swift */; };
F8CDD7AD2E40CFD4008E82B5 /* SheetRouter.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8CDD7AC2E40CFCE008E82B5 /* SheetRouter.swift */; };
F8D011962EE087FA009476FA /* MailFeedbackViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8D011952EE087F3009476FA /* MailFeedbackViewController.swift */; };
F8D63B252E81684400071B66 /* UIVideoPlayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8D63B242E81684100071B66 /* UIVideoPlayer.swift */; };
F8E279802E24F6010017C3F5 /* UIProfileViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8E2797F2E24F5F80017C3F5 /* UIProfileViewController.swift */; };
F8E279862E2540570017C3F5 /* UIReceiveViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8E279852E25404A0017C3F5 /* UIReceiveViewController.swift */; };
Expand Down Expand Up @@ -1134,6 +1136,7 @@
F8472F712E745A3D0094163D /* ProgressIndicator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProgressIndicator.swift; sourceTree = "<group>"; };
F849ACB52ED5D01C005B38AF /* SwapInProgress.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwapInProgress.swift; sourceTree = "<group>"; };
F849ACB92ED5F822005B38AF /* CodableStorage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CodableStorage.swift; sourceTree = "<group>"; };
F849ACBF2EDF47BF005B38AF /* SwapHistory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwapHistory.swift; sourceTree = "<group>"; };
F88781AE2EB10B1E00207D0B /* TokenPicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TokenPicker.swift; sourceTree = "<group>"; };
F88781B02EB1EC5A00207D0B /* SwapDeposit.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwapDeposit.swift; sourceTree = "<group>"; };
F88781B22EB1EE4C00207D0B /* SwapProgress.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwapProgress.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1164,6 +1167,7 @@
F8C065412E38A2F4009BFC8F /* ChainTipObserver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChainTipObserver.swift; sourceTree = "<group>"; };
F8CDD7AC2E40CFCE008E82B5 /* SheetRouter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SheetRouter.swift; sourceTree = "<group>"; };
F8CDD7EF2E42159B008E82B5 /* dependencies.env */ = {isa = PBXFileReference; lastKnownFileType = text; path = dependencies.env; sourceTree = SOURCE_ROOT; };
F8D011952EE087F3009476FA /* MailFeedbackViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MailFeedbackViewController.swift; sourceTree = "<group>"; };
F8D63B242E81684100071B66 /* UIVideoPlayer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIVideoPlayer.swift; sourceTree = "<group>"; };
F8E2797F2E24F5F80017C3F5 /* UIProfileViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIProfileViewController.swift; sourceTree = "<group>"; };
F8E279852E25404A0017C3F5 /* UIReceiveViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIReceiveViewController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -3023,6 +3027,7 @@
F88781B22EB1EE4C00207D0B /* SwapProgress.swift */,
F88781CD2EB3B7C300207D0B /* SwapProgress+Actions.swift */,
F8246B382E9FBB0400376CD7 /* SelectSwapCurrency.swift */,
F849ACBF2EDF47BF005B38AF /* SwapHistory.swift */,
);
path = Swaps;
sourceTree = "<group>";
Expand Down Expand Up @@ -3154,6 +3159,7 @@
F899FBCF2E548C0600653B5A /* Sheets */ = {
isa = PBXGroup;
children = (
F8D011952EE087F3009476FA /* MailFeedbackViewController.swift */,
F899FBD02E548C1F00653B5A /* InfoSheet.swift */,
);
path = Sheets;
Expand Down Expand Up @@ -3584,6 +3590,7 @@
F8BA7D232E1D75DE00BDBEF1 /* AppTabs.swift in Sources */,
006D211D23CEDF16007D1C10 /* MicroTari.swift in Sources */,
F88A5F882E8459D40033A454 /* ContactDetail+Actions.swift in Sources */,
F849ACC02EDF47BF005B38AF /* SwapHistory.swift in Sources */,
3AFAC362271C6F9E008AA842 /* UITextField+Combine.swift in Sources */,
373CCDBD2490B66E00D0A2C9 /* CircularProgressView.swift in Sources */,
3A20A6B82722EE00002B15DB /* VideoView.swift in Sources */,
Expand Down Expand Up @@ -3824,6 +3831,7 @@
3ACC4F602876D2F100632F64 /* NSAttributedString+Format.swift in Sources */,
3A72DC4126DFA1E100E0BC43 /* NetworkSettings.swift in Sources */,
3ADA73DD270A02B900D50E3B /* WalletSettings.swift in Sources */,
F8D011962EE087FA009476FA /* MailFeedbackViewController.swift in Sources */,
3AF985FA286B233100290387 /* PopUpSelectionView.swift in Sources */,
375DB1E0246E90D100B2BEF4 /* NavigationBar.swift in Sources */,
F899FBCA2E532F7700653B5A /* UpdateRequiredSheet.swift in Sources */,
Expand Down Expand Up @@ -4133,7 +4141,7 @@
CODE_SIGN_ENTITLEMENTS = MobileWallet/Tari.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 5;
CURRENT_PROJECT_VERSION = 7;
DEVELOPMENT_TEAM = 8XGMD9X2H2;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -4168,7 +4176,7 @@
CODE_SIGN_ENTITLEMENTS = MobileWallet/Tari.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 5;
CURRENT_PROJECT_VERSION = 7;
DEVELOPMENT_TEAM = 8XGMD9X2H2;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,47 @@
"images" : [
{
"filename" : "exolix.pdf",
"idiom" : "universal"
"idiom" : "universal",
"scale" : "1x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "ell-22.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x7D",
"green" : "0xFC",
"red" : "0x2C"
"blue" : "0x47",
"green" : "0xC0",
"red" : "0x00"
}
},
"idiom" : "universal"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x47",
"green" : "0xC0",
"red" : "0x00"
"blue" : "0x7D",
"green" : "0xFC",
"red" : "0x2C"
}
},
"idiom" : "universal"
Expand Down
15 changes: 14 additions & 1 deletion MobileWallet/Common/Extensions/String+Double.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,19 @@ extension String {
}

var double: Double? {
NumberFormatter().number(from: self)?.doubleValue
NumberFormatter().number(from: self.replacingOccurrences(of: " ", with: ""))?.doubleValue
}
}

extension Double {
var formattedAnyAmount: String {
abs(self) < 0.000001 ? formatted(maxDecimals: 10) : formatted(maxDecimals: 6)
}

func formatted(maxDecimals: Int) -> String {
let formatter = NumberFormatter()
formatter.minimumFractionDigits = 0
formatter.maximumFractionDigits = maxDecimals
return formatter.string(from: self as NSNumber) ?? String(format: "%.\(maxDecimals)f", self)
}
}
11 changes: 10 additions & 1 deletion MobileWallet/Screens/Home/Home/Scenes/Home.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ struct Home: View, ChainTipObserver {
@State var swapTransaction: ExolixTransactionResponse?
@State var isReceivePresented = false
@State var isTransactionHistoryPresented = false
@State var isSwapHistoryPresented = false
@State var isConnectionStatusPresented = false
@State var exolix = Exolix.shared

Expand Down Expand Up @@ -95,6 +96,9 @@ struct Home: View, ChainTipObserver {
.navigationDestination(isPresented: $isTransactionHistoryPresented) {
TransactionHistory(transactions: recentTransactions)
}
.navigationDestination(isPresented: $isSwapHistoryPresented) {
SwapHistory(presentedSwap: $presentedSwapProgress)
}
.fullScreenCover(isPresented: $router.isSwapPresented) {
NavigationStack {
Swaps()
Expand Down Expand Up @@ -274,11 +278,16 @@ private extension Home {
VStack {
sectionHeader("Recent Swaps")
.frame(maxWidth: .infinity, alignment: .leading)
ForEach(transactions) { swapTransaction in
ForEach(transactions.prefix(2)) { swapTransaction in
SwapInProgressItem(transaction: swapTransaction) {
presentedSwapProgress = swapTransaction
}
}
if 2 < transactions.count {
TariButton("View all swaps", style: .text, size: .medium) {
isSwapHistoryPresented = true
}
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions MobileWallet/Screens/Swaps/Models/ExolixConfirmation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ struct ExolixConfirmation: Hashable {
let coinTo: ExolixCurrency
let networkTo: ExolixNetwork
let amount: String
let withdrawalAmount: String?
let rate: ExolixRate
let rateType: ExolixRateType
let withdrawalAddress: String
Expand Down
2 changes: 1 addition & 1 deletion MobileWallet/Screens/Swaps/Models/SwapInProgress.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
import Foundation

struct SwapTransactionList: Codable, Hashable {
var maxSwaps: Int { 5 }
var maxSwaps: Int { .max }
var swaps = [String]()

init() {
Expand Down
2 changes: 1 addition & 1 deletion MobileWallet/Screens/Swaps/SelectSwapCurrency.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ struct SelectSwapCurrency: View {
.navigationBarBackButtonHidden()
.navigationBarTitleDisplayMode(.inline)
.toolbar {
toolbarTitle("Select token")
toolbarTitle("Select Currency")
toolbarCloseItem { dismiss() }
}
}
Expand Down
4 changes: 2 additions & 2 deletions MobileWallet/Screens/Swaps/SwapDeposit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ struct SwapDeposit: View {
.padding(.top, 8)
Spacer()

TariButton("Cancel transaction", style: .destructiveText, size: .medium) {
TariButton("Remove transaction", style: .destructiveText, size: .medium) {
cancelTransaction()
}
}
Expand All @@ -88,7 +88,7 @@ struct SwapDeposit: View {
.background(Color.secondaryBackground)
.navigationBarBackButtonHidden()
.toolbar {
toolbarTitle("Send funds")
toolbarTitle("Send Funds")
toolbarBackItem { dismiss() }
}
.alert(title: "Exolix error", message: $errorMessage)
Expand Down
82 changes: 82 additions & 0 deletions MobileWallet/Screens/Swaps/SwapHistory.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
// SwiftUIView.swift

/*
Package MobileWallet
Created by Tomas Hakel on 02.12.2025
Using Swift 6.0
Running on macOS 26.0

Copyright 2019 The Tari Project

Redistribution and use in source and binary forms, with or
without modification, are permitted provided that the
following conditions are met:

1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of
its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

import SwiftUI

struct SwapHistory: View {
@Environment(\.dismiss) var dismiss
@State var exolix = Exolix.shared

@Binding var presentedSwap: ExolixTransactionResponse?

var body: some View {
let transactions = exolix.sortedTransactions
ScrollView {
VStack {
ForEach(transactions) { swapTransaction in
SwapInProgressItem(transaction: swapTransaction) {
presentedSwap = swapTransaction
}
}
}
.padding(16)
.toolbar {
toolbarTitle("Swap History")
toolbarBackItem { dismiss() }
}
}
.frame(maxWidth: .infinity)
.background(Color.secondaryBackground)
.navigationBarBackButtonHidden()
.navigationBarTitleDisplayMode(.inline)
.overlay {
if transactions.isEmpty {
Text("No recent swaps")
.body2()
.foregroundStyle(.secondaryText)

}
}
}
}

#Preview {
SwapHistory(presentedSwap: .constant(nil))
}
Loading