diff --git a/UnstoppableWallet/UnstoppableWallet.xcodeproj/project.pbxproj b/UnstoppableWallet/UnstoppableWallet.xcodeproj/project.pbxproj index 68518ecc34..66eab25270 100644 --- a/UnstoppableWallet/UnstoppableWallet.xcodeproj/project.pbxproj +++ b/UnstoppableWallet/UnstoppableWallet.xcodeproj/project.pbxproj @@ -1821,6 +1821,8 @@ 6B29072A2AF0CB8A006157D6 /* EventHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B29071E2AF0CB8A006157D6 /* EventHandler.swift */; }; 6B55E33B2AF26D6400616B60 /* Starscream in Frameworks */ = {isa = PBXBuildFile; productRef = 6B55E33A2AF26D6400616B60 /* Starscream */; }; 6B55E33D2AF26D7A00616B60 /* Starscream in Frameworks */ = {isa = PBXBuildFile; productRef = 6B55E33C2AF26D7A00616B60 /* Starscream */; }; + 6B5F33892D07FDF3001E23A4 /* EnabledWallet_v_0_40.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B5F33882D07FDF3001E23A4 /* EnabledWallet_v_0_40.swift */; }; + 6B5F338A2D07FDF3001E23A4 /* EnabledWallet_v_0_40.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B5F33882D07FDF3001E23A4 /* EnabledWallet_v_0_40.swift */; }; 6B5F5E0E2C0C65F700E03EB2 /* MarketPlatformViewNew.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B5F5E0D2C0C65F700E03EB2 /* MarketPlatformViewNew.swift */; }; 6B5F5E0F2C0C65F700E03EB2 /* MarketPlatformViewNew.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B5F5E0D2C0C65F700E03EB2 /* MarketPlatformViewNew.swift */; }; 6B5F5E112C0C660900E03EB2 /* MarketPlatformViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B5F5E102C0C660900E03EB2 /* MarketPlatformViewModel.swift */; }; @@ -4124,6 +4126,7 @@ 6B29071B2AF0CB8A006157D6 /* WalletConnectAppShowView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WalletConnectAppShowView.swift; sourceTree = ""; }; 6B29071D2AF0CB8A006157D6 /* WidgetCoinAppShowModule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WidgetCoinAppShowModule.swift; sourceTree = ""; }; 6B29071E2AF0CB8A006157D6 /* EventHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EventHandler.swift; sourceTree = ""; }; + 6B5F33882D07FDF3001E23A4 /* EnabledWallet_v_0_40.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EnabledWallet_v_0_40.swift; sourceTree = ""; }; 6B5F5E0D2C0C65F700E03EB2 /* MarketPlatformViewNew.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MarketPlatformViewNew.swift; sourceTree = ""; }; 6B5F5E102C0C660900E03EB2 /* MarketPlatformViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MarketPlatformViewModel.swift; sourceTree = ""; }; 6B5F5E142C0DDD7100E03EB2 /* RankView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RankView.swift; sourceTree = ""; }; @@ -5085,6 +5088,7 @@ 11B356A734526DECD9606A66 /* AccountRecord_v_0_36.swift */, 11B35E255F6CA21FFA9E6B42 /* FavoriteCoinRecord_v_0_38.swift */, D3A87D5B2C8EFB1A00F6F619 /* EvmAccountRestoreState.swift */, + 6B5F33882D07FDF3001E23A4 /* EnabledWallet_v_0_40.swift */, ); path = Deprecated; sourceTree = ""; @@ -9509,6 +9513,7 @@ 58AAAA71882CB345D56BBA00 /* CoinChartFactory.swift in Sources */, 11B351856787DD75A41861B6 /* CoinInvestorsViewModel.swift in Sources */, 11B3507F17791BC895872490 /* BrandFooterView.swift in Sources */, + 6B5F338A2D07FDF3001E23A4 /* EnabledWallet_v_0_40.swift in Sources */, D08D16852C2165490086E5A5 /* TonSendHandler.swift in Sources */, 6BCD53152A161F4800993F20 /* BackupViewModel.swift in Sources */, 11B35D10A6A15EFA47FCE6D0 /* TextCell.swift in Sources */, @@ -10974,6 +10979,7 @@ D3833AFF2BF335D100ACECFB /* MarketNewsViewModel.swift in Sources */, D36DE0D8272FD887000BC916 /* OneInchDataSource.swift in Sources */, 58AAA2EBAFC1C443C48BA857 /* CoinChartFactory.swift in Sources */, + 6B5F33892D07FDF3001E23A4 /* EnabledWallet_v_0_40.swift in Sources */, D08D16842C2165490086E5A5 /* TonSendHandler.swift in Sources */, 11B35085F61E874613B2B882 /* CoinInvestorsViewModel.swift in Sources */, 6BCD53142A161F4800993F20 /* BackupViewModel.swift in Sources */, @@ -12879,7 +12885,7 @@ repositoryURL = "https://github.com/horizontalsystems/BitcoinCore.Swift"; requirement = { kind = exactVersion; - version = 3.0.1; + version = 3.0.2; }; }; 6B55461F2A6E73190054B524 /* XCRemoteSwiftPackageReference "UIExtensions" */ = { diff --git a/UnstoppableWallet/UnstoppableWallet/Core/Storage/StorageMigrator.swift b/UnstoppableWallet/UnstoppableWallet/Core/Storage/StorageMigrator.swift index bc97572c77..838bc4e643 100644 --- a/UnstoppableWallet/UnstoppableWallet/Core/Storage/StorageMigrator.swift +++ b/UnstoppableWallet/UnstoppableWallet/Core/Storage/StorageMigrator.swift @@ -724,7 +724,7 @@ enum StorageMigrator { t.primaryKey([EnabledWalletCache_v_0_36.Columns.tokenQueryId.name, EnabledWalletCache_v_0_36.Columns.accountId.name], onConflict: .replace) } - var enabledWallets: [EnabledWallet] = [] + var enabledWallets: [EnabledWallet_v_0_40] = [] let rows = try Row.fetchCursor(db, sql: "SELECT * FROM \(EnabledWallet_v_0_34.databaseTableName)") while let row = try rows.next() { @@ -732,24 +732,26 @@ enum StorageMigrator { continue } - let updatedWallet = EnabledWallet( + let updatedWallet = EnabledWallet_v_0_40( tokenQueryId: tokenQueryId, - accountId: row["accountId"], coinName: row["coinName"], - coinCode: row["coinCode"], tokenDecimals: row["tokenDecimals"] + accountId: row["accountId"], + coinName: row["coinName"], + coinCode: row["coinCode"], + tokenDecimals: row["tokenDecimals"] ) enabledWallets.append(updatedWallet) } try db.drop(table: EnabledWallet_v_0_34.databaseTableName) - try db.create(table: EnabledWallet.databaseTableName) { t in - t.column(EnabledWallet.Columns.tokenQueryId.name, .text).notNull() - t.column(EnabledWallet.Columns.accountId.name, .text).notNull() - t.column(EnabledWallet.Columns.coinName.name, .text) - t.column(EnabledWallet.Columns.coinCode.name, .text) - t.column(EnabledWallet.Columns.tokenDecimals.name, .integer) - - t.primaryKey([EnabledWallet.Columns.tokenQueryId.name, EnabledWallet.Columns.accountId.name], onConflict: .replace) + try db.create(table: EnabledWallet_v_0_40.databaseTableName) { t in + t.column(EnabledWallet_v_0_40.Columns.tokenQueryId.name, .text).notNull() + t.column(EnabledWallet_v_0_40.Columns.accountId.name, .text).notNull() + t.column(EnabledWallet_v_0_40.Columns.coinName.name, .text) + t.column(EnabledWallet_v_0_40.Columns.coinCode.name, .text) + t.column(EnabledWallet_v_0_40.Columns.tokenDecimals.name, .integer) + + t.primaryKey([EnabledWallet_v_0_40.Columns.tokenQueryId.name, EnabledWallet_v_0_40.Columns.accountId.name], onConflict: .replace) } for wallet in enabledWallets { diff --git a/UnstoppableWallet/UnstoppableWallet/Models/Deprecated/EnabledWallet_v_0_40.swift b/UnstoppableWallet/UnstoppableWallet/Models/Deprecated/EnabledWallet_v_0_40.swift new file mode 100644 index 0000000000..96e2da854c --- /dev/null +++ b/UnstoppableWallet/UnstoppableWallet/Models/Deprecated/EnabledWallet_v_0_40.swift @@ -0,0 +1,47 @@ +import GRDB +import MarketKit + +class EnabledWallet_v_0_40: Record { + let tokenQueryId: String + let accountId: String + + let coinName: String? + let coinCode: String? + let tokenDecimals: Int? + + init(tokenQueryId: String, accountId: String, coinName: String? = nil, coinCode: String? = nil, tokenDecimals: Int? = nil) { + self.tokenQueryId = tokenQueryId + self.accountId = accountId + self.coinName = coinName + self.coinCode = coinCode + self.tokenDecimals = tokenDecimals + + super.init() + } + + override class var databaseTableName: String { + "enabled_wallets" + } + + enum Columns: String, ColumnExpression { + case tokenQueryId, accountId, coinName, coinCode, tokenDecimals + } + + required init(row: Row) throws { + tokenQueryId = row[Columns.tokenQueryId] + accountId = row[Columns.accountId] + coinName = row[Columns.coinName] + coinCode = row[Columns.coinCode] + tokenDecimals = row[Columns.tokenDecimals] + + try super.init(row: row) + } + + override func encode(to container: inout PersistenceContainer) { + container[Columns.tokenQueryId] = tokenQueryId + container[Columns.accountId] = accountId + container[Columns.coinName] = coinName + container[Columns.coinCode] = coinCode + container[Columns.tokenDecimals] = tokenDecimals + } +} diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/Main/Workers/SendAppShowWorker/AddressAppShowModule.swift b/UnstoppableWallet/UnstoppableWallet/Modules/Main/Workers/SendAppShowWorker/AddressAppShowModule.swift index 1c0fb27956..370d262957 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/Main/Workers/SendAppShowWorker/AddressAppShowModule.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/Main/Workers/SendAppShowWorker/AddressAppShowModule.swift @@ -103,7 +103,7 @@ extension AddressAppShowModule: IEventHandler { } var uri = AddressUri(scheme: "") uri.address = text - return + showSendTokenList(source: source, eventType: eventType, uri: uri, allowedBlockchainTypes: types) } } } diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/MultiSwap/MultiSwapViewModel.swift b/UnstoppableWallet/UnstoppableWallet/Modules/MultiSwap/MultiSwapViewModel.swift index d264d95749..4d9ec60b01 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/MultiSwap/MultiSwapViewModel.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/MultiSwap/MultiSwapViewModel.swift @@ -21,6 +21,7 @@ class MultiSwapViewModel: ObservableObject { private let marketKit = App.shared.marketKit private let walletManager = App.shared.walletManager private let adapterManager = App.shared.adapterManager + private let decimalParser = AmountDecimalParser() @Published var currency: Currency @@ -170,7 +171,7 @@ class MultiSwapViewModel: ObservableObject { syncQuotes() syncFiatAmountIn() - let amount = Decimal(string: amountString) + let amount = decimalParser.parseAnyDecimal(from: amountString) if amount != amountIn { amountString = amountIn?.description ?? "" @@ -180,7 +181,7 @@ class MultiSwapViewModel: ObservableObject { @Published var amountString: String = "" { didSet { - let amount = Decimal(string: amountString) + let amount = decimalParser.parseAnyDecimal(from: amountString) guard amount != amountIn else { return @@ -196,7 +197,7 @@ class MultiSwapViewModel: ObservableObject { didSet { syncAmountIn() - let amount = Decimal(string: fiatAmountString)?.rounded(decimal: 2) + let amount = decimalParser.parseAnyDecimal(from: fiatAmountString)?.rounded(decimal: 2) if amount != fiatAmountIn { fiatAmountString = fiatAmountIn?.description ?? "" @@ -206,7 +207,7 @@ class MultiSwapViewModel: ObservableObject { @Published var fiatAmountString: String = "" { didSet { - let amount = Decimal(string: fiatAmountString)?.rounded(decimal: 2) + let amount = decimalParser.parseAnyDecimal(from: fiatAmountString)?.rounded(decimal: 2) guard amount != fiatAmountIn else { return diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/SendNew/PreSendViewModel.swift b/UnstoppableWallet/UnstoppableWallet/Modules/SendNew/PreSendViewModel.swift index 651fbcc950..99cc91e641 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/SendNew/PreSendViewModel.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/SendNew/PreSendViewModel.swift @@ -9,6 +9,7 @@ class PreSendViewModel: ObservableObject { private let marketKit = App.shared.marketKit private let walletManager = App.shared.walletManager private let adapterManager = App.shared.adapterManager + private let decimalParser = AmountDecimalParser() private var cancellables = Set() @@ -19,7 +20,7 @@ class PreSendViewModel: ObservableObject { syncFiatAmount() syncSendData() - let amount = Decimal(string: amountString) + let amount = decimalParser.parseAnyDecimal(from: amountString) if amount != self.amount { amountString = self.amount?.description ?? "" @@ -29,7 +30,7 @@ class PreSendViewModel: ObservableObject { @Published var amountString: String = "" { didSet { - var amount = Decimal(string: amountString) + var amount = decimalParser.parseAnyDecimal(from: amountString) if amount == 0 { amount = nil @@ -49,7 +50,7 @@ class PreSendViewModel: ObservableObject { didSet { syncAmount() - let amount = Decimal(string: fiatAmountString)?.rounded(decimal: 2) + let amount = decimalParser.parseAnyDecimal(from: fiatAmountString)?.rounded(decimal: 2) if amount != fiatAmount { fiatAmountString = fiatAmount?.description ?? "" @@ -59,7 +60,7 @@ class PreSendViewModel: ObservableObject { @Published var fiatAmountString: String = "" { didSet { - let amount = Decimal(string: fiatAmountString)?.rounded(decimal: 2) + let amount = decimalParser.parseAnyDecimal(from: fiatAmountString)?.rounded(decimal: 2) guard amount != fiatAmount else { return diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/WalletConnect/Main/Proposal/Eip155ProposalHandler.swift b/UnstoppableWallet/UnstoppableWallet/Modules/WalletConnect/Main/Proposal/Eip155ProposalHandler.swift index 3fc6dc2897..bd26b0cffb 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/WalletConnect/Main/Proposal/Eip155ProposalHandler.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/WalletConnect/Main/Proposal/Eip155ProposalHandler.swift @@ -40,7 +40,7 @@ class Eip155ProposalHandler { continue } - set.items.insert( + set.items.append( WalletConnectMainModule.BlockchainItem( namespace: blockchain.namespace, chainId: chainId, diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/WalletConnect/Main/WalletConnectMainModule.swift b/UnstoppableWallet/UnstoppableWallet/Modules/WalletConnect/Main/WalletConnectMainModule.swift index b8b36fef63..bd7876de72 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/WalletConnect/Main/WalletConnectMainModule.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/WalletConnect/Main/WalletConnectMainModule.swift @@ -63,14 +63,14 @@ extension WalletConnectMainModule { } struct BlockchainSet { - static var empty: BlockchainSet = .init(items: Set(), methods: Set(), events: Set()) + static var empty: BlockchainSet = .init(items: [], methods: Set(), events: Set()) - var items: Set + var items: [BlockchainItem] var methods: Set var events: Set mutating func formUnion(_ set: Self) { - items.formUnion(set.items) + items.append(contentsOf: set.items) methods.formUnion(set.methods) events.formUnion(set.events) } diff --git a/UnstoppableWallet/UnstoppableWallet/ru.lproj/Localizable.strings b/UnstoppableWallet/UnstoppableWallet/ru.lproj/Localizable.strings index 86621a36ec..b1f48d6f1b 100644 --- a/UnstoppableWallet/UnstoppableWallet/ru.lproj/Localizable.strings +++ b/UnstoppableWallet/UnstoppableWallet/ru.lproj/Localizable.strings @@ -571,8 +571,8 @@ "swap.trade_error.not_found" = "Невозможно обменять эти токены"; "swap.trade_error.wrap_unwrap_not_allowed" = "Эта служба не позволяет wrapping/unwrapping. Пожалуйста, попробуйте другой сервис обмена. Рекомендуется 1inch"; "swap.button_error.insufficient_balance" = "Недостаточный баланс"; -"swap.switch_provider.title" = "Служба обмена"; -"swap.amount_type.coin" = "Монета"; +"swap.switch_provider.title" = "Сервис обмена"; +"swap.amount_type.coin" = "Токен"; "swap.price" = "Цена"; "swap.buy_price" = "Цена покупки"; @@ -2159,7 +2159,7 @@ "transaction_filter.blockchain" = "Блокчейн"; "transaction_filter.all_blockchains" = "Все блокчейны"; -"transaction_filter.coin" = "Монета"; +"transaction_filter.coin" = "Токен"; "transaction_filter.all_coins" = "Все токены"; "transaction_filter.contact" = "Kонтакты"; "transaction_filter.all_contacts" = "Все контакты"; diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 9f70347642..805ac6657c 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -260,7 +260,7 @@ platform :ios do deploy_production prepare_environment(true) - apply_prod_xcconfig('true', 'true') + apply_prod_xcconfig('true', 'false') deploy_production