Skip to content

Commit

Permalink
Merge branch 'feature/private_beta_feedback' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
simonmcl committed Feb 16, 2024
2 parents febcb22 + aaf9ec7 commit 3e7143e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"location" : "https://github.com/kukai-wallet/kukai-core-swift",
"state" : {
"branch" : "develop",
"revision" : "8d6869c4ed35d2930e657497a66e741947f0f76e"
"revision" : "4e775b2632f44b24fee55de769aa438e0e5eb6d5"
}
},
{
Expand Down
2 changes: 2 additions & 0 deletions Kukai Mobile/Modules/Activity/ActivityViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ class ActivityViewModel: ViewModel, UITableViewDiffableDataSourceHandler {
let currentAddress = DependencyManager.shared.selectedWalletAddress
var full = DependencyManager.shared.activityService.pendingTransactionGroups.filter({ $0.transactions.first?.sender.address == currentAddress })
full.append(contentsOf: DependencyManager.shared.activityService.transactionGroups)

full.sort(by: { ($0.transactions.first?.counter) ?? 0 > ($1.transactions.first?.counter) ?? 0 })

self.groups = full
self.loadGroups(animate: animate)
Expand Down
2 changes: 1 addition & 1 deletion Kukai Mobile/Modules/Stake/StakeViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class StakeViewModel: ViewModel, UITableViewDiffableDataSourceHandler {
return false
}

return baker.stakingCapacity > xtzBalanceAsDecimal && baker.openForDelegation && baker.serviceHealth != .dead
return baker.stakingCapacity > xtzBalanceAsDecimal && baker.openForDelegation && baker.serviceHealth != .dead && baker.serviceType != "exchange"
}

let sortedResults = filteredResults.sorted(by: { lhs, rhs in
Expand Down
11 changes: 8 additions & 3 deletions Kukai Mobile/Services/ActivityService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ public class ActivityService {

public func addPending(opHash: String, type: TzKTTransaction.TransactionType, counter: Decimal, fromWallet: WalletMetadata, destinationAddress: String, destinationAlias: String?, xtzAmount: TokenAmount, parameters: [String: String]?, primaryToken: Token?) -> Bool {
let destination = TzKTAddress(alias: destinationAlias, address: destinationAddress)
var transaction = TzKTTransaction.placeholder(withStatus: .unconfirmed, opHash: opHash, type: type, counter: counter, fromWallet: fromWallet, destination: destination, xtzAmount: xtzAmount, parameters: parameters, primaryToken: primaryToken)
let previousId = pendingTransactionGroups.count == 0 ? (transactionGroups.first?.transactions.first?.id ?? 0) : (pendingTransactionGroups.first?.id ?? 0)
var transaction = TzKTTransaction.placeholder(withStatus: .unconfirmed, id: previousId + 1, opHash: opHash, type: type, counter: counter, fromWallet: fromWallet, destination: destination, xtzAmount: xtzAmount, parameters: parameters, primaryToken: primaryToken)
transaction.processAdditionalData(withCurrentWalletAddress: fromWallet.address)

if let group = TzKTTransactionGroup(withTransactions: [transaction], currentWalletAddress: fromWallet.address) {
Expand All @@ -125,9 +126,12 @@ public class ActivityService {
}

public func addPendingBatch(opHash: String, counter: Decimal, fromWallet: WalletMetadata, batchInfo: [PendingBatchInfo]) -> Bool {
var previousId = pendingTransactionGroups.count == 0 ? (transactionGroups.first?.transactions.first?.id ?? 0) : (pendingTransactionGroups.first?.id ?? 0)

var transactions: [TzKTTransaction] = []
for info in batchInfo {
var temp = TzKTTransaction.placeholder(withStatus: .unconfirmed, opHash: opHash, type: info.type, counter: counter, fromWallet: fromWallet, destination: info.destination, xtzAmount: info.xtzAmount, parameters: info.parameters, primaryToken: info.primaryToken)
previousId += 1
var temp = TzKTTransaction.placeholder(withStatus: .unconfirmed, id: previousId, opHash: opHash, type: info.type, counter: counter, fromWallet: fromWallet, destination: info.destination, xtzAmount: info.xtzAmount, parameters: info.parameters, primaryToken: info.primaryToken)
temp.processAdditionalData(withCurrentWalletAddress: fromWallet.address)

transactions.append(temp)
Expand All @@ -146,7 +150,8 @@ public class ActivityService {
}

public func addPending(opHash: String, type: TzKTTransaction.TransactionType, counter: Decimal, fromWallet: WalletMetadata, newDelegate: TzKTAddress?) -> Bool {
let transaction = TzKTTransaction.placeholder(withStatus: .unconfirmed, opHash: opHash, type: type, counter: counter, fromWallet: fromWallet, newDelegate: newDelegate)
let previousId = pendingTransactionGroups.count == 0 ? (transactionGroups.first?.transactions.first?.id ?? 0) : (pendingTransactionGroups.first?.id ?? 0)
let transaction = TzKTTransaction.placeholder(withStatus: .unconfirmed, id: previousId + 1, opHash: opHash, type: type, counter: counter, fromWallet: fromWallet, newDelegate: newDelegate)

if let group = TzKTTransactionGroup(withTransactions: [transaction], currentWalletAddress: fromWallet.address) {
if fromWallet.address == DependencyManager.shared.selectedWalletAddress {
Expand Down

0 comments on commit 3e7143e

Please sign in to comment.