Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into version/0.42
Browse files Browse the repository at this point in the history
# Conflicts:
#	UnstoppableWallet/UnstoppableWallet.xcodeproj/project.pbxproj
  • Loading branch information
ant013 committed Dec 18, 2024
2 parents 62f29da + f942311 commit b4b8304
Show file tree
Hide file tree
Showing 10 changed files with 87 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 */; };
Expand Down Expand Up @@ -4124,6 +4126,7 @@
6B29071B2AF0CB8A006157D6 /* WalletConnectAppShowView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WalletConnectAppShowView.swift; sourceTree = "<group>"; };
6B29071D2AF0CB8A006157D6 /* WidgetCoinAppShowModule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WidgetCoinAppShowModule.swift; sourceTree = "<group>"; };
6B29071E2AF0CB8A006157D6 /* EventHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EventHandler.swift; sourceTree = "<group>"; };
6B5F33882D07FDF3001E23A4 /* EnabledWallet_v_0_40.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EnabledWallet_v_0_40.swift; sourceTree = "<group>"; };
6B5F5E0D2C0C65F700E03EB2 /* MarketPlatformViewNew.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MarketPlatformViewNew.swift; sourceTree = "<group>"; };
6B5F5E102C0C660900E03EB2 /* MarketPlatformViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MarketPlatformViewModel.swift; sourceTree = "<group>"; };
6B5F5E142C0DDD7100E03EB2 /* RankView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RankView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -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 = "<group>";
Expand Down Expand Up @@ -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 */,
Expand Down Expand Up @@ -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 */,
Expand Down Expand Up @@ -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" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -724,32 +724,34 @@ 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() {
guard let tokenQueryId = tokenQueryId(tokenQueryId: row["tokenQueryId"], coinSettingsId: row["coinSettingsId"]) else {
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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ extension AddressAppShowModule: IEventHandler {
}
var uri = AddressUri(scheme: "")
uri.address = text
return
showSendTokenList(source: source, eventType: eventType, uri: uri, allowedBlockchainTypes: types)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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 ?? ""
Expand All @@ -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
Expand All @@ -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 ?? ""
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<AnyCancellable>()

Expand All @@ -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 ?? ""
Expand All @@ -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
Expand All @@ -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 ?? ""
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class Eip155ProposalHandler {
continue
}

set.items.insert(
set.items.append(
WalletConnectMainModule.BlockchainItem(
namespace: blockchain.namespace,
chainId: chainId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<BlockchainItem>
var items: [BlockchainItem]
var methods: Set<String>
var events: Set<String>

mutating func formUnion(_ set: Self) {
items.formUnion(set.items)
items.append(contentsOf: set.items)
methods.formUnion(set.methods)
events.formUnion(set.events)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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" = "Цена покупки";
Expand Down Expand Up @@ -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" = "Все контакты";
Expand Down
2 changes: 1 addition & 1 deletion fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ platform :ios do
deploy_production

prepare_environment(true)
apply_prod_xcconfig('true', 'true')
apply_prod_xcconfig('true', 'false')

deploy_production

Expand Down

0 comments on commit b4b8304

Please sign in to comment.